garage44.eu/jeroen/pinnacle

logclone: git clone https://garage44.eu/jeroen/pinnacle.git

cartopolis-agent · 2026-11-30T18:41:32Z

build(deploy): the PC's USB stick image, for pinnacle-os.eu to offer

tools/deploy/image.sh builds `cargo xtask installer pc` and writes
dist/images/: the stick gzipped (Etcher and Rufus take .img.gz as is;
396 MB of image packs to 24.5 MB, most of it empty partition), its
SHA-256, and pc.json (version, commit, sizes, digest) which the
website's Download page reads. The hub target that runs it and
publishes to /data/pinnacle-store/images/ lives in hub.conf.
docs/hardware.md      |  2 +-
 tools/deploy/image.sh | 33 +++++++++++++++++++++++++++++++++
 2 files changed, 34 insertions(+), 1 deletion(-)

diff --git a/docs/hardware.md b/docs/hardware.md
index e4cc9a8..a6a970e 100644
--- a/docs/hardware.md
+++ b/docs/hardware.md
@@ -227,7 +227,7 @@ is untried), and every firmware's own mistakes. Those wait for a machine.
    signed), and the disks in **AHCI** mode, not "RAID", "RST" or "VMD"
    (Intel's VMD hides the NVMe disk behind a controller Pinnacle does not
    drive).
-2. `cargo xtask installer pc`, written whole to a stick (`dd`, as above).
+2. The stick's image: downloaded from <https://pinnacle-os.eu/try/> (`tools/deploy/image.sh` builds it, `midas deploy pinnacle-image` publishes it at `/store/images/`), or `cargo xtask installer pc`; written whole to a stick (Etcher, Rufus, or `dd` as above).
 3. Start from it (the firmware's boot menu: F12, F9 or Esc on most).
 4. A laptop has no serial port: the **boot log is drawn on the screen**
    from the first line after the screen is found, until the display server
diff --git a/tools/deploy/image.sh b/tools/deploy/image.sh
new file mode 100755
index 0000000..9c70410
--- /dev/null
+++ b/tools/deploy/image.sh
@@ -0,0 +1,33 @@
+#!/bin/bash
+# The USB stick a PC (x86-64) installs Pinnacle from, as `midas deploy
+# pinnacle-image` publishes it at https://pinnacle-os.eu/store/images/ for
+# the website's Download page (docs/hardware.md, "Trying a real laptop").
+# Writes dist/images/:
+#
+#   pinnacle-pc.img.gz          the stick whole (`cargo xtask installer pc`),
+#                               gzipped: Etcher, Rufus and `dd` take it as is
+#   pinnacle-pc.img.gz.sha256   its digest, as `sha256sum -c` reads it
+#   pc.json                     what the page shows: version, commit, bytes
+#                               (packed and written), digest, when it was built
+#
+# The version is the number of commits on main, as the Store's apps have it.
+set -euo pipefail
+cd "$(git rev-parse --show-toplevel)"
+version="$(git rev-list --count HEAD)"
+commit="$(git rev-parse --short=8 HEAD)"
+cargo xtask installer pc
+out=dist/images
+rm -rf "$out"
+mkdir -p "$out"
+gzip -9 -c target/install-pc.img > "$out/pinnacle-pc.img.gz"
+digest() { if command -v sha256sum >/dev/null; then sha256sum "$1"; else shasum -a 256 "$1"; fi; }
+(cd "$out" && digest pinnacle-pc.img.gz > pinnacle-pc.img.gz.sha256)
+sha="$(cut -d' ' -f1 "$out/pinnacle-pc.img.gz.sha256")"
+packed="$(wc -c < "$out/pinnacle-pc.img.gz" | tr -d ' ')"
+written="$(wc -c < target/install-pc.img | tr -d ' ')"
+built="$(date -u +%Y-%m-%dT%H:%MZ)"
+cat > "$out/pc.json" <<EOF
+{"version":"$version","commit":"$commit","file":"pinnacle-pc.img.gz","bytes":$packed,"written":$written,"sha256":"$sha","built":"$built"}
+EOF
+test -s "$out/pinnacle-pc.img.gz" && test -s "$out/pc.json"
+cat "$out/pc.json"