diff --git a/.github/workflows/pages.yml b/.github/workflows/pages.yml index 09a382a8a..915bade89 100644 --- a/.github/workflows/pages.yml +++ b/.github/workflows/pages.yml @@ -132,6 +132,17 @@ jobs: env: GH_TOKEN: ${{ github.token }} + # apt users follow the published release at https://breeze.waozi.xyz/apt. + - name: Build APT Repository + if: github.event_name != 'pull_request' + env: + GH_TOKEN: ${{ github.token }} + APT_SIGNING_KEY: ${{ secrets.APT_SIGNING_KEY }} + run: | + set -euo pipefail + command -v apt-ftparchive >/dev/null || sudo apt-get install -y --no-install-recommends apt-utils + sh scripts/build-apt-repo.sh build/site/apt "$SITE_RELEASE_VERSION" + - name: Upload Web diagnostics after a failed build if: ${{ failure() && env.USE_RELEASED_WEB != 'true' }} uses: actions/upload-artifact@v4 diff --git a/CHANGELOG.md b/CHANGELOG.md index 6f76678f0..9eca7933b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,7 @@ ## [Unreleased] +- Linux: install from the signed APT repository and get updates with apt. - Filter Android account-key imports to key files and related backup types. - Practice results show smooth, labeled mood faces with a clear selection. - Apps keeps each grid card's ⋮ control unchanged while editing. diff --git a/mk/tests-suite.mk b/mk/tests-suite.mk index 30f3f0443..8d8d867ad 100644 --- a/mk/tests-suite.mk +++ b/mk/tests-suite.mk @@ -125,6 +125,7 @@ test: modal-rules-test test: elist-screen-test test: theme-catalog-bundle-check test: site-assets-test +test: apt-repo-test test: android-smoke-script-test test: sync-recovery-test test: sync-connection-test diff --git a/mk/tests-web.mk b/mk/tests-web.mk index 518d73371..809c9c0dd 100644 --- a/mk/tests-web.mk +++ b/mk/tests-web.mk @@ -22,6 +22,10 @@ web-window-zi-test: $(ZI2C_BIN) site-assets-test: node tests/site_assets_test.mjs +.PHONY: apt-repo-test +apt-repo-test: + sh tests/apt_repo_test.sh + web-canvas-smoke-test: $(WEB_SMOKE_TEST) WEB_SMOKE_RENDERER=canvas WEB_SMOKE_BROWSER="$(WEB_SMOKE_BROWSER)" node $(WEB_SMOKE_TEST) $(WEB_DIST_DIR) diff --git a/packaging/linux/apt/breeze-archive-keyring.gpg b/packaging/linux/apt/breeze-archive-keyring.gpg new file mode 100644 index 000000000..a1b6fcfca Binary files /dev/null and b/packaging/linux/apt/breeze-archive-keyring.gpg differ diff --git a/scripts/build-apt-repo.sh b/scripts/build-apt-repo.sh new file mode 100755 index 000000000..3b91baa1b --- /dev/null +++ b/scripts/build-apt-repo.sh @@ -0,0 +1,92 @@ +#!/bin/sh +# Build the signed APT repository for a published release under the site: +# build-apt-repo.sh OUT_DIR VERSION +# APT_SIGNING_KEY holds the armored private key; its public half is +# packaging/linux/apt/breeze-archive-keyring.gpg. APT_DEB_DIR, when set, +# supplies the .deb files instead of downloading them from the release. + +set -eu + +script_dir=$(CDPATH= cd -- "$(dirname -- "$0")" && pwd) +root_dir=$(dirname -- "$script_dir") +keyring=${APT_KEYRING:-"$root_dir/packaging/linux/apt/breeze-archive-keyring.gpg"} +archs="amd64 arm64" + +if [ "$#" -ne 2 ]; then + printf 'Usage: %s OUT_DIR VERSION\n' "$0" >&2 + exit 2 +fi +out_dir=$1 +version=$2 + +if [ -z "${APT_SIGNING_KEY:-}" ]; then + printf 'Error: APT_SIGNING_KEY is not set\n' >&2 + exit 1 +fi +for tool in apt-ftparchive gpg gpgv; do + if ! command -v "$tool" >/dev/null 2>&1; then + printf 'Error: %s is required\n' "$tool" >&2 + exit 1 + fi +done + +GNUPGHOME=$(mktemp -d) +export GNUPGHOME +trap 'rm -rf "$GNUPGHOME"' EXIT INT TERM + +rm -rf "$out_dir" +pool="$out_dir/pool/main/i/inbe" +mkdir -p "$pool" +for arch in $archs; do + deb="inbe_${version}_${arch}.deb" + if [ -n "${APT_DEB_DIR:-}" ]; then + cp "$APT_DEB_DIR/$deb" "$pool/$deb" + else + gh release download "v$version" --repo waozixyz/breeze --pattern "$deb" --dir "$pool" + fi + # A deb whose control fields disagree with its name would publish a wrong upgrade. + fields=$(dpkg-deb -f "$pool/$deb" Package Version Architecture | tr '\n' ' ') + if [ "$fields" != "Package: inbe Version: $version Architecture: $arch " ]; then + printf 'Error: %s has control fields %s\n' "$deb" "$fields" >&2 + exit 1 + fi +done + +dist="$out_dir/dists/stable" +for arch in $archs; do + mkdir -p "$dist/main/binary-$arch" + # Uncompressed only: the CDN may re-encode .gz responses. + (cd "$out_dir" && apt-ftparchive --arch "$arch" packages pool) > "$dist/main/binary-$arch/Packages" +done + +apt-ftparchive \ + -o APT::FTPArchive::Release::Origin="Waozi" \ + -o APT::FTPArchive::Release::Label="Inner Breeze" \ + -o APT::FTPArchive::Release::Suite="stable" \ + -o APT::FTPArchive::Release::Codename="stable" \ + -o APT::FTPArchive::Release::Architectures="$archs" \ + -o APT::FTPArchive::Release::Components="main" \ + -o APT::FTPArchive::Release::Description="Inner Breeze releases" \ + release "$dist" > "$GNUPGHOME/Release" +mv "$GNUPGHOME/Release" "$dist/Release" + +printf '%s\n' "$APT_SIGNING_KEY" | gpg --batch --quiet --import +gpg --batch --yes --digest-algo SHA512 --clearsign --output "$dist/InRelease" "$dist/Release" +gpg --batch --yes --digest-algo SHA512 --armor --detach-sign --output "$dist/Release.gpg" "$dist/Release" + +# Users trust only the committed keyring, so the signature must verify against it. +gpgv --keyring "$keyring" "$dist/InRelease" 2>/dev/null || { + printf 'Error: APT_SIGNING_KEY does not match %s\n' "$keyring" >&2 + exit 1 +} +gpgv --keyring "$keyring" "$dist/Release.gpg" "$dist/Release" 2>/dev/null + +cp "$keyring" "$out_dir/breeze-archive-keyring.gpg" +cat > "$out_dir/inbe.sources" <<'EOF' +Types: deb +URIs: https://breeze.waozi.xyz/apt +Suites: stable +Components: main +Signed-By: /usr/share/keyrings/breeze-archive-keyring.gpg +EOF +printf 'APT repository for inbe %s written to %s\n' "$version" "$out_dir" diff --git a/site/build.sh b/site/build.sh index 7563397c2..1a53bb343 100755 --- a/site/build.sh +++ b/site/build.sh @@ -243,6 +243,7 @@ python3 "$root_dir/scripts/prepare-site-assets.py" "$out_dir" for path in \ index.html \ privacy.html \ + install-apt.html \ delete-account.html \ delete-account/index.html \ legacy-converter.html \ diff --git a/site/index.html b/site/index.html index 5cd46f638..5e063c1c5 100644 --- a/site/index.html +++ b/site/index.html @@ -103,6 +103,7 @@
diff --git a/site/static/install-apt.html b/site/static/install-apt.html new file mode 100644 index 000000000..6624301f6 --- /dev/null +++ b/site/static/install-apt.html @@ -0,0 +1,46 @@ + + + + + +Debian, Ubuntu and their derivatives can install Inner Breeze from its signed APT repository. New releases then arrive with your other system updates. The repository has packages for amd64 and arm64.
+sudo curl -fsSLo /usr/share/keyrings/breeze-archive-keyring.gpg https://breeze.waozi.xyz/apt/breeze-archive-keyring.gpg
+sudo curl -fsSLo /etc/apt/sources.list.d/inbe.sources https://breeze.waozi.xyz/apt/inbe.sources
+sudo apt update
+sudo apt install inbe
+ Start it from your app menu or with breeze. The signing key fingerprint is 70C3 0C13 CB00 6C50 9B19 1480 BC01 11C7 1342 0287.
sudo apt remove inbe
+sudo rm /etc/apt/sources.list.d/inbe.sources /usr/share/keyrings/breeze-archive-keyring.gpg
+ Your practices and habits stay in ~/.local/share/inbe.