OXYGENHUB

The oh .deb adds the apt repository at oxygenhub.io f2c9757605c1

As oxy's: the archive key, the source on first install, removed on
purge when oxy is not installed either; dist.sh takes ONLY=GLOB.

closes #85
Author
Andy McCall @andymccall <[email protected]>
When
· 2026-10-02 19:07 UTC
Signature
✔ signed by Andy McCall
Hash
f2c9757605c15d2ab0ad442235c32c762f43d4a5a135bcd5d89fe5496965b627
Depends on
99ca93d60bca
Depended on by
5d66f27cebe2 73beb84b202a 913e5ad27b17
In bookmarks
api-unknown-fields cancel-landed-runs clear-waiting close-proposal-140 diffusion-pin-bookmark draft-ready image-check job-waits main oh-comment-body-file proposal-list-fast run-one-job wiki-says-so
In tags
v0.3.1 v0.4.0 v0.4.1 v0.4.2 v0.5.0 v0.5.1 v0.5.2 v0.6.0 v0.6.1 v0.7.0 v0.8.0 v0.9.0 v0.9.1 v0.9.11 v0.9.15 v0.9.16 v0.9.19 v0.9.2 v0.9.20 v0.9.21 v0.9.22 v0.9.23 v0.9.24 v0.9.3 v0.9.4 v0.9.5 v0.9.6 v0.9.7 v0.9.8 v0.9.9
Edits
7 atoms, 2 tree operations, 2 files

Browse the tree at this change

added packaging/oxygenhub-archive-keyring.gpg +0 −0

No line changes.

modified scripts/dist.sh +38 −1
…
5 unchanged lines
6 6
# plus SHA256SUMS, in target/dist/VERSION.
7 7
#
8 8
#   scripts/dist.sh [VERSION]    (default: the package version)
9 +
#   ONLY=linux-x86_64 scripts/dist.sh   builds one platform (a glob)
9 10
#
10 11
# Needs: rustup targets x86_64-pc-windows-gnu, aarch64-unknown-linux-gnu,
11 12
# x86_64-apple-darwin and aarch64-apple-darwin; cargo-zigbuild and zig on
…
4 unchanged lines
16 17
PKG=oh                   # the cargo package
17 18
BIN=oh                   # the binary it builds
18 19
DEB_NAME=oh              # the Debian package
20 +
OTHER_DEB=oxy            # the other package sharing the apt repository files
19 21
SUMMARY="OxygenHub from the command line"
20 22
DESCRIPTION="oh talks to an OxygenHub (such as https://oxygenhub.io): issues,
21 23
 proposals and their reviews, releases, Flow runs and checks, from the
…
25 unchanged lines
47 49
for p in "${PLATFORMS[@]}"; do
48 50
  IFS='|' read -r target platform tool deb <<<"$p"
49 51
  triple="${target%%.2.*}"
52 +
  # ONLY=linux-x86_64 (a glob) builds just the platforms it matches.
53 +
  if [ -n "${ONLY:-}" ] && [[ "$platform" != $ONLY ]]; then continue; fi
50 54
  echo "== $platform ($target)"
51 55
  if [ "$tool" = zig ]; then
52 56
    cargo zigbuild -q --release --locked --target "$target" -p "$PKG"
…
19 unchanged lines
72 76
    install -m 0755 "$built" "$root/usr/bin/$BIN"
73 77
    cp README.md docs/oh.md "$root/usr/share/doc/$DEB_NAME/"
74 78
    cp LICENSE "$root/usr/share/doc/$DEB_NAME/copyright"
79 +
    # The apt repository at oxygenhub.io (oxygenhub#85): the package ships
80 +
    # the archive's key and, on its first install, adds the repository, so
81 +
    # apt upgrade keeps it current. oxy and oh share the files they write.
82 +
    mkdir -p "$root/usr/share/$DEB_NAME"
83 +
    install -m 0644 packaging/oxygenhub-archive-keyring.gpg "$root/usr/share/$DEB_NAME/"
84 +
    sed "s/@PKG@/$DEB_NAME/" >"$root/DEBIAN/postinst" <<'EOF'
85 +
#!/bin/sh
86 +
set -e
87 +
if [ "$1" = configure ]; then
88 +
  # The key is refreshed on every install, so a new one reaches everyone.
89 +
  install -m 0644 /usr/share/@PKG@/oxygenhub-archive-keyring.gpg /usr/share/keyrings/oxygenhub-archive-keyring.gpg
90 +
  # The repository is added on the first install only: removing it
91 +
  # keeps it removed.
92 +
  L=/etc/apt/sources.list.d/oxygenhub.sources
93 +
  if [ -z "$2" ] && [ ! -e "$L" ] && ! grep -rqs "oxygenhub.io/apt" /etc/apt/sources.list /etc/apt/sources.list.d; then
94 +
    cat >"$L" <<SRC
95 +
Types: deb
96 +
URIs: https://oxygenhub.io/apt
97 +
Suites: stable
98 +
Components: main
99 +
Signed-By: /usr/share/keyrings/oxygenhub-archive-keyring.gpg
100 +
SRC
101 +
  fi
102 +
fi
103 +
EOF
104 +
    sed "s/@OTHER@/$OTHER_DEB/" >"$root/DEBIAN/postrm" <<'EOF'
105 +
#!/bin/sh
106 +
set -e
107 +
if [ "$1" = purge ] && ! dpkg-query -W -f='${Status}' @OTHER@ 2>/dev/null | grep -q "ok installed"; then
108 +
  rm -f /etc/apt/sources.list.d/oxygenhub.sources /usr/share/keyrings/oxygenhub-archive-keyring.gpg
109 +
fi
110 +
EOF
111 +
    chmod 0755 "$root/DEBIAN/postinst" "$root/DEBIAN/postrm"
75 112
    cat >"$root/DEBIAN/control" <<EOF
76 113
Package: $DEB_NAME
77 114
Version: $VERSION
…
12 unchanged lines
90 127
done
91 128
92 129
rm -rf "$OUT/stage"
93 -
(cd "$OUT" && sha256sum -- *.tar.gz *.zip *.deb >SHA256SUMS)
130 +
(cd "$OUT" && shopt -s nullglob && sha256sum -- *.tar.gz *.zip *.deb >SHA256SUMS)
94 131
echo "== $OUT"
95 132
ls -l "$OUT"