Skip to content
zitzhenPublic

About

ZIT General Software source

Resources

Contributing

Security policy

Stars

1 star

Watchers

0 watching

Forks

Latest commit

 

History

17 Commits

Folders and files

Repository files navigation

ZGS — ZIT General Software Source

ZGS (ZIT General Software Source) is a general-purpose Debian software repository maintained by ZIT Studio. It automatically builds amd64 .deb packages from upstream GitHub projects, signs them, and publishes them as an apt repository hosted at https://apt-general.zitzhen.cn.

Relationship to zhento-Software-Source / kzhento-Software-Source

ZGS came after zhento-Software-Source and kzhento-Software-Source, and reuses the vast majority of their code (the build scripts, CI workflows, publishing process, and signing mechanism are essentially identical).

Unlike the first two, which target ZhenTo (and its derivative distributions), ZGS is a general-purpose software repository:

It is not limited to use within ZhenTo — it works on every Debian-based distribution (Debian, Ubuntu, Linux Mint, Deepin, UOS, Kali, and all manner of Debian/Ubuntu derivatives).

In other words, any Debian-based system can add this repository and install its software, provided the architecture and dependency requirements are met.

How it works

The repository is driven by a Software.list manifest file, with each line pointing to an upstream GitHub repository that contains a debian/ packaging directory. A manually triggered GitHub Actions workflow:

  1. Parses Software.list and produces a build matrix, optionally narrowed to the repositories given in the manual run's repositories input (see Building only selected repositories);
  2. Clones each upstream repository, installs its build dependencies with mk-build-deps, and runs dpkg-buildpackage -b -us -uc to produce amd64 binary packages;
  3. Generates the apt indexes and Release metadata with dpkg-scanpackages / apt-ftparchive;
  4. Signs InRelease / Release.gpg with the GPG private key and exports the public key;
  5. Generates a browsable index.html for the repository root and every subdirectory, so https://apt-general.zitzhen.cn can be explored in a browser like an Apache directory listing;
  6. Writes the log of every package build to /log/<owner>-<repo>.log and publishes it next to the packages (see Build logs);
  7. Syncs the repository to Cloudflare R2 via aws s3 sync for apt to fetch. The index.html files are uploaded separately with a text/html content type, the logs with text/plain, and both with a short max-age, so browsers render them instead of downloading them. Build logs are archived per run under log/<date>-<run-id>/ and are never pruned automatically.

Repository layout

ZGS/
├── Software.list                 # Upstream software manifest (one GitHub repo URL per line)
├── scripts/
│   ├── parse-software-list.sh   # Parses the manifest, emits the build-matrix JSON
│   ├── select-software.sh       # Validates and applies the optional repository filter
│   ├── merge-artifacts.sh       # Re-indexes published packages a filtered run skipped
│   ├── diff-software-list.sh    # Computes repositories newly added since a base revision
│   ├── build-deb.sh             # Builds an amd64 .deb from an upstream repository
│   ├── publish-repo.sh          # Assembles, signs, and exports the apt metadata
│   ├── collect-logs.sh          # Copies build logs into /log/<run-dir>/ in the tree
│   ├── log-file-name.sh         # Derives the published log name from a repo URL
│   ├── log-run-dir.sh           # Derives the per-run archive directory name
│   ├── stage-log-index.sh       # Rebuilds /log/ from all run directories
│   ├── stage-log-repo.sh        # Stages a run's logs into the log repository
│   ├── render-log-readme.sh     # Rebuilds the log repository README index
│   ├── publish-log-release.sh   # Publishes a release with the run's logs
│   ├── github-app-token.sh      # Mints a GitHub App installation token
│   ├── generate-index.sh        # Writes browsable index.html files for the tree
│   ├── test-workflow-build-step.sh  # Runs a workflow run: block under bash
│   └── test-repository-filter.sh    # Tests the repository filter and artifact merge
├── .github/workflows/           # Build-check and publish CI
├── .githooks/                   # Versioned Git hooks for DCO sign-off
├── CONTRIBUTING.md              # Contribution guide
└── LICENSE                      # AGPL-3.0-only

Quick start

Add this repository

On any Debian-based distribution, import the signing key and add the source:

# Import the repository signing key
sudo curl -fsSL https://apt-general.zitzhen.cn/apt-key.asc | sudo gpg --dearmor \
  -o /etc/apt/trusted.gpg.d/zgs.gpg

# Add the repository source (works across Debian-family distributions)
echo "deb https://apt-general.zitzhen.cn stable main" \
  | sudo tee /etc/apt/sources.list.d/zgs.list

# Update and install
sudo apt-get update
sudo apt-get install <package-name>

The repository currently publishes packages for the amd64 architecture, the stable suite, and the main component only.

Browse the repository

Open https://apt-general.zitzhen.cn in a browser: the root and every subdirectory (pool/, dists/stable/, log/, ...) expose a generated index.html that lists files and folders with sizes and modification times.

Build and validate locally

On a Debian/Ubuntu environment (CI runs on ubuntu-latest), install the dependencies and try a build:

sudo apt-get update
sudo apt-get install -y git devscripts equivs dpkg-dev gnupg apt-utils

# Validate the manifest
./scripts/parse-software-list.sh Software.list

# Try building a specific upstream repository (log is optional)
./scripts/build-deb.sh https://github.com/zitzhen/patchsplit /tmp/debs /tmp/logs/patchsplit.log

Build logs

Every publish run archives the build log of each package into its own directory, so past runs are kept instead of being overwritten:

https://apt-general.zitzhen.cn/log/                                  # every run
https://apt-general.zitzhen.cn/log/2026-12-01-46640252167/           # one run
https://apt-general.zitzhen.cn/log/2026-12-01-46640252167/zitzhen-patchsplit.log
  • The run directory is <date>-<run-id> (2026-12-01-46640252167): the current UTC date plus the numeric run id, produced by scripts/log-run-dir.sh. The date is read from the clock inside the script rather than passed in from the workflow, because a timestamp taken from an unknown github context field is silently substituted with an empty string. Each run therefore gets a fresh directory and nothing from an earlier run is replaced.
  • Inside a run directory the file name is <owner>-<repo>.log, derived from the Software.list URL (https://github.com/zitzhen/patchsplit → zitzhen-patchsplit.log).
  • Each log starts with the upstream URL, start time, runner and commit, and ends with the finish time and the build's exit status, so a failed build is diagnosable without opening the Actions run. The run line links straight back to the workflow run that produced it.
  • scripts/build-deb.sh takes an optional third argument for the log path. When it is omitted, nothing is written; the build behaves exactly as before.
  • The logs are staged into the repository tree before publish-repo.sh generates the indexes, so log/ appears in the root listing at https://apt-general.zitzhen.cn alongside dists/ and pool/.
  • The /log/ listing is rebuilt from the run directories that actually exist in the bucket, so older runs stay browsable. It is done with a delimiter-based list-objects-v2, which keeps the listing cheap however many runs accumulate. Only that one index.html is regenerated: the per-run indexes come from publish-repo.sh, and rebuilding the listing must never overwrite them.
  • Nothing is deleted from /log/: the sync runs without --delete, so archiving a new run never removes an old one. Pruning is a manual decision.
  • Logs are public and served with Cache-Control: no-cache. Never let a build print secrets (tokens, credentials) into them; the workflow only publishes what the build itself wrote.

Mirror in the log repository

Every publish also mirrors the same logs into zitzhen/ZGS-build-log, which uses the same <date>-<run-id>/<owner>-<repo>.log layout:

  • The README there is regenerated on every publish and carries an index of all archived runs, newest first, linking each run's directory and release.
  • A release named after the run (2026-12-01-46640252167) is created with the run's log files attached as assets, so a run can be downloaded without cloning. Each release starts as a draft, receives its assets, and is published last: the repository has immutable releases enabled, and GitHub rejects asset uploads to an already published release.
  • Commits are made on main as zgs-software[bot] (363535165+zgs-software[bot]@users.noreply.github.com).
  • Authentication uses a GitHub App installation token minted by scripts/github-app-token.sh from the APP_KEY secret, so no long-lived personal token is involved. The job runs alongside the R2 publication, so a failure there never blocks an apt release.

Adding software

Append a GitHub repository URL (containing a debian/ directory) to Software.list, one per line, and open a pull request. After merging, a maintainer manually triggers the Publish apt repository to R2 workflow to publish. See CONTRIBUTING.md for details.

Manifest rules (enforced by scripts/parse-software-list.sh):

  • One HTTPS GitHub repository URL per line, e.g. https://github.com/zitzhen/patchsplit;
  • A trailing .git or / is accepted and normalized;
  • Blank lines and lines starting with # are ignored; inline # comments are stripped;
  • Duplicate URLs are ignored (a warning is printed);
  • The upstream repository must contain a valid debian/ directory and produce an amd64 .deb.

Building only selected repositories

The Publish apt repository to R2 workflow has an optional repositories input, so a maintainer can rebuild one or a few packages instead of the whole manifest. Leave it empty to build every entry, which is the previous behaviour.

The input is a comma-separated list of repository URLs on a single line, for example:

https://github.com/zitzhen/patchsplit,https://github.com/zitzhen/GitTune

Rules enforced by scripts/select-software.sh:

  • Surrounding spaces are ignored, a trailing .git or / is normalized, and the full-width comma , and the ideographic comma 、 are accepted, because the field is typed by hand;
  • Every URL must already be listed in Software.list. A URL that is missing from the manifest (or is not a GitHub repository URL at all) fails the prepare job, so no package is built by that run. Add the repository to the manifest first;
  • The matrix follows the manifest order, and repeated URLs are selected once.

Publishing is unaffected by the filter: the publish job downloads the previously published .deb files from the bucket and re-indexes them together with the packages just built, keeping only the newest version of each package and always preferring the freshly built one. A filtered run therefore never removes another package from the apt index. See scripts/merge-artifacts.sh.

License and contributing

This project is released under AGPL-3.0-only. All commits must follow the DCO (Signed-off-by trailer); enable the versioned hooks after cloning to add the sign-off automatically:

git config core.hooksPath .githooks

Contributions via issues and pull requests are welcome; see CONTRIBUTING.md.

About

ZIT General Software source

Resources

Contributing

Security policy

Stars

1 star

Watchers

0 watching

Forks

Contributors

Languages