# Hello PPKG **Repository Path**: FogVDN/hello-ppkg ## Basic Information - **Project Name**: Hello PPKG - **Description**: Hello PPKG - **Primary Language**: Unknown - **License**: Apache-2.0 - **Default Branch**: main - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2024-11-01 - **Last Updated**: 2026-02-28 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README Hello PPKG to demostrate PPKG generation ======================================== Building a Software Package --------------- Follow the steps below to create and package an application: 1. Create a directory named after the application (e.g., `hello`) in both the `src` and `ppkg` directories. 2. Place the source files in `src/hello`. 3. In `ppkg/hello`, create a `control` directory and add necessary execution scripts as needed: - `pre_unpack.sh` - `post_unpack.sh` - `pre_remove.sh` - `post_remove.sh` 4. Run the following command and get the package `hello-1.0.0.ppkg` and config file `ppkg_config.json` in the `packages/hello` directory: ```sh make hello version=1.0.0 ``` The supported environment variables in the control script: - `APP_NAME`:the name of the app. - `VERSION`:the version of the package. - `INSTALLATION_PATH`:the `installation_path` defined in the configuration file. - `PACKAGE_FILE`:the file path of the ppkg package. - `DATA_FILE`:the path of the `data.tar` file obtained by extracting the ppkg package. (which did not exist in the script before extraction) - `PACKAGE_CONF`:the file path of the local configuration fSile of the package. - `ARCHITECTURE`:applicable CPU architecture. - `ACTION`:1: Installation or Upgrade, 2: Uninstallation. The supported parameters are: - **version** (default: `.`) - **prefix** (default: `/opt/pear/$app_name`) - **priority** (default: `50`) - **data_type** (default: `file`) - **data_url** (default: empty) Core Idea --------- Check [`generate.py`](ppkg/generate.py). This Python script does the following: 1. Read the template config file (e.g. [`ppkg/ppkg_config.json`](ppkg/ppkg_config.json)) 2. Make the PPKG (a GZipped TAR archive) from a `data.tar` and a `control.tar` 3. Replace variable parts of the template (e.g. `size`, `md5sum`, etc.), then output as `ppkg_config.json` ### Complete accepted options ```text usage: generate.py [-h] [-c CONFIG] [-d DATA] [-t CONTROL] [--write-name WRITE_NAME] [--write-version WRITE_VERSION] [--update-number KEY NUMBER] [--update-string KEY STRING] filename [config_out] Generates the PPKG package and the PPKG config file. positional arguments: filename the generated filename config_out the output config file (default stdout) options: -h, --help show this help message and exit -c CONFIG, --config CONFIG specify a PPKG config file (default: ppkg_config.json) -d DATA, --data DATA specify a data archive (default: data.tar) -t CONTROL, --control CONTROL specify a package control archive (default: control.tar) --write-name WRITE_NAME write new app_name string --write-version WRITE_VERSION write new version string --update-number KEY NUMBER append or update key-number pair to the output config file --update-string KEY STRING append or update key-string pair to the output config file ``` By default, `-c`, `-d`, and `-t` are looking for, respectively, `ppkg_config.json`, `data.tar`, and `control.tar` in the current working directory. No matter what is the original file name passed to `DATA` and `CONTROL`, the PPKG generation will rename to `data.tar` and `control.tar` respectively. `--write-name` and `--write-version` respectively replace the `app_name` and `version` fields of the output config file (shorthand for `--update-string`). Run Environment --------------- Tested working with: - GNU Make 4.4.1 - Python 3.12.7 License ------- MIT or Apache-2.0