From 8408d63f84a96db54b637208c46716f5c64fa020 Mon Sep 17 00:00:00 2001 From: Waozi Date: Sat, 31 Oct 2026 03:07:30 -0300 Subject: [PATCH] Publish a signed APT repository for Linux releases The site deploy builds https://breeze.waozi.xyz/apt from the published release's .deb files, signed with the APT_SIGNING_KEY secret and checked against the committed keyring. install-apt.html explains setup and the Linux card links to it. --- .github/workflows/pages.yml | 11 +++ CHANGELOG.md | 1 + mk/tests-suite.mk | 1 + mk/tests-web.mk | 4 + .../linux/apt/breeze-archive-keyring.gpg | Bin 0 -> 1168 bytes scripts/build-apt-repo.sh | 92 ++++++++++++++++++ site/build.sh | 1 + site/index.html | 1 + site/static/install-apt.html | 46 +++++++++ tests/apt_repo_test.sh | 76 +++++++++++++++ 10 files changed, 233 insertions(+) create mode 100644 packaging/linux/apt/breeze-archive-keyring.gpg create mode 100755 scripts/build-apt-repo.sh create mode 100644 site/static/install-apt.html create mode 100644 tests/apt_repo_test.sh 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 0000000000000000000000000000000000000000..a1b6fcfca5e76e89d551c1d84da5eae239a7f8f5 GIT binary patch literal 1168 zcmV;B1aJG90u2Oe<%DAa5CGW5j%t60BLNdsW$&eI>nWyu*=sC7wEZlA@017PW_%^f zJ&kBGP6DNQdy9H}`qp|E z{hr(~XSQFQwhdjmNf4=9`Z+82;9BCr>HC?JQh)LEn?_^#84*e;d$-A=FQMG)P23~W zu5#8$?1w1WYU~)gTc-qCILlH^Bki>0@|_lrVl%=<&YK0J%3l_sNp3niPgVUoUR4QX zEkf*9eO^pvvBp{w@r;|Ol|ssT)PV|G9FZ9}asJ-f#*NDN|L`yd2-?TBxw@+7qjU)M z|3Q0c+S@r0(>y-ou%Rs$3^MG}oJXJ_Th@G`ravF&SvULQFT7UM(cFwlmxb1*{Ikls z{M2ibfFeC$8AC>46x~G@;=w5slY$OxS5N3W)U+dUGdtzXaIE6FYFW#gp%i#A4gttE zv0peelR!^fx#CE>CYBC~O%}dPeRZ`z21#|@^j$Col+~zjg>L&fyy_%Y+sKb*WSF;! z1<9%^2jCf2ySf*B#=&4$WZqgG_biWn26wJDl5(q)ey5>y06cQ$t0|JNjpY=|?dq}Be z&#_5O8q3on9zOsP0RRECElF-}WpW@wa%E+DWgtONR3LI?aBp*IbZ>HbAUt|Eaa`P2g9m@Cqq=<<6PAS#gpcWjqQFI7LaD#9T_Di8a!xu^B`^*q;l0D>`&Biw-{paHgpO9R_yX5MwFKp; ziP_hgdoTry5xw z!!uUIDrKVZ$R#N*Q57+Q`z5BkHU^N_mWE}S6%0$QChJVpUNc_>ID7%}2!YBV$AqY9 zD2FE%lbP&C7uO|rmmg+h{a0anBo&$oFI8GPus4%&K07A)v#pIHIRY=ImNlm~+xC~D znSWgG`7#Q5q&s2zgkH}YeZhker;$;ZpI6-(?if4IhR%M0qMa567Qr|xz%nLFs}Ei$ z)1_?%`#h%1sJFhjP#Z~J*=w6@&4JKWEpeXPG(I5VRK1?LPzH`C;z}XEcy7-`Su49Y zQR;dT6|Mc#)W>|t&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 @@ + + + + + + Install with APT - Inner Breeze + + + + + + +
Inner Breeze
+
+
+

Install with APT

+

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.

+
+ +
+

Add the repository

+
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.

+
+ +
+

Remove it

+
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.

+
+
+ + diff --git a/tests/apt_repo_test.sh b/tests/apt_repo_test.sh new file mode 100644 index 000000000..2e8efe404 --- /dev/null +++ b/tests/apt_repo_test.sh @@ -0,0 +1,76 @@ +#!/bin/sh +# scripts/build-apt-repo.sh signs a repository apt accepts, and refuses a key +# that differs from the published keyring or a deb that differs from its name. +set -eu +root=$(CDPATH= cd -- "$(dirname -- "$0")/.." && pwd) +work=$(mktemp -d) +trap 'rm -rf "$work"' EXIT INT TERM +version=9.8.7 + +fail() { + printf 'apt repo test: %s\n' "$1" >&2 + exit 1 +} + +make_deb() { + pkg=$work/pkg-$1 + mkdir -p -m 755 "$pkg/DEBIAN" "$pkg/usr/bin" + printf '#!/bin/sh\n' > "$pkg/usr/bin/breeze" + chmod 755 "$pkg/DEBIAN" "$pkg/usr/bin/breeze" + printf 'Package: inbe\nVersion: %s\nArchitecture: %s\nMaintainer: Test \nDescription: test\n' \ + "$2" "$1" > "$pkg/DEBIAN/control" + dpkg-deb --root-owner-group --build "$pkg" "$work/debs/inbe_${version}_$1.deb" >/dev/null +} + +new_key() { + GNUPGHOME=$work/gpg-$1 && export GNUPGHOME + mkdir -m 700 "$GNUPGHOME" + gpg --batch --quiet --passphrase '' --quick-gen-key "test $1 " rsa2048 sign never 2>/dev/null + gpg --export > "$work/$1.gpg" + gpg --armor --export-secret-keys + unset GNUPGHOME +} + +mkdir -p "$work/debs" +make_deb amd64 "$version" +make_deb arm64 "$version" +key=$(new_key good) +other=$(new_key other) + +APT_DEB_DIR=$work/debs APT_KEYRING=$work/good.gpg APT_SIGNING_KEY=$key \ + sh "$root/scripts/build-apt-repo.sh" "$work/repo" "$version" >/dev/null +for path in dists/stable/InRelease dists/stable/Release.gpg breeze-archive-keyring.gpg inbe.sources \ + dists/stable/main/binary-amd64/Packages dists/stable/main/binary-arm64/Packages \ + pool/main/i/inbe/inbe_${version}_amd64.deb pool/main/i/inbe/inbe_${version}_arm64.deb; do + [ -s "$work/repo/$path" ] || fail "missing $path" +done + +if APT_DEB_DIR=$work/debs APT_KEYRING=$work/good.gpg APT_SIGNING_KEY=$other \ + sh "$root/scripts/build-apt-repo.sh" "$work/bad-key" "$version" 2>/dev/null; then + fail "accepted a key that differs from the keyring" +fi + +make_deb arm64 9.8.6 +if APT_DEB_DIR=$work/debs APT_KEYRING=$work/good.gpg APT_SIGNING_KEY=$key \ + sh "$root/scripts/build-apt-repo.sh" "$work/bad-deb" "$version" 2>/dev/null; then + fail "accepted a deb whose version differs from its name" +fi + +# apt itself verifies the signature and finds the package, without root. +apt_dir=$work/apt +mkdir -p "$apt_dir/etc/sources.list.d" "$apt_dir/etc/preferences.d" "$apt_dir/state/lists/partial" \ + "$apt_dir/cache/archives/partial" +: > "$apt_dir/state/status" +sed -e "s#https://breeze.waozi.xyz/apt#file://$work/repo#" \ + -e "s#/usr/share/keyrings/breeze-archive-keyring.gpg#$work/good.gpg#" \ + "$work/repo/inbe.sources" > "$apt_dir/etc/sources.list.d/inbe.sources" +apt_opts="-o Dir::Etc=$apt_dir/etc -o Dir::Etc::sourcelist=/dev/null -o Dir::State=$apt_dir/state + -o Dir::State::status=$apt_dir/state/status -o Dir::Cache=$apt_dir/cache -o Debug::NoLocking=1 + -o APT::Architecture=amd64" +# shellcheck disable=SC2086 +apt-get $apt_opts update >"$work/apt-update.log" 2>&1 || { cat "$work/apt-update.log" >&2; fail "apt update failed"; } +grep -q -E '^(W|E):' "$work/apt-update.log" && { cat "$work/apt-update.log" >&2; fail "apt update warned"; } +# shellcheck disable=SC2086 +candidate=$(apt-cache $apt_opts policy inbe | awk '/Candidate:/ { print $2 }') +[ "$candidate" = "$version" ] || fail "apt candidate is '$candidate', expected $version" +echo "apt repo test passed"