furtka-apps/scripts/build-catalog-tarball.sh
Daniel Maksymilian Syrnicki 8cd9e3bcf4
All checks were successful
CI / validate (push) Successful in 36s
CI / shellcheck (push) Successful in 1m1s
Release / release (push) Successful in 38s
chore: bootstrap furtka-apps catalog repo
Initial layout: apps/fileshare/ (seeded from daniel/furtka apps/), CI
(JSON + manifest validator + shellcheck), release pipeline (tag-driven,
mirrors core repo), vendored manifest schema for offline validation.

The core repo (daniel/furtka) at 26.6-alpha keeps apps/fileshare as a
seed so offline first-boot still has an installable app; this catalog
becomes authoritative once a box has synced at least once.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-20 14:14:50 +02:00

47 lines
1.4 KiB
Bash
Executable file

#!/usr/bin/env bash
# Build a Furtka apps-catalog release tarball + sha256 sidecar + release.json.
#
# Usage: ./scripts/build-catalog-tarball.sh <version>
#
# Produces (in ./dist/):
# furtka-apps-<version>.tar.gz contents extract to /var/lib/furtka/catalog/
# furtka-apps-<version>.tar.gz.sha256 single-line sha256 (<hash> <name>)
# release.json {"version","sha256","size","created_at"}
#
# Tarball shape: VERSION at root + apps/<name>/ trees underneath. The on-box
# `furtka catalog sync` extracts into a staging dir, validates every
# manifest, then atomically renames into /var/lib/furtka/catalog/.
set -euo pipefail
VERSION="${1:?usage: $0 <version>}"
REPO_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
DIST_DIR="$REPO_ROOT/dist"
STAGE="$(mktemp -d)"
trap 'rm -rf "$STAGE"' EXIT
cp -a "$REPO_ROOT/apps" "$STAGE/"
find "$STAGE" -type d -name __pycache__ -exec rm -rf {} +
echo "$VERSION" > "$STAGE/VERSION"
mkdir -p "$DIST_DIR"
TARBALL="$DIST_DIR/furtka-apps-$VERSION.tar.gz"
tar -czf "$TARBALL" -C "$STAGE" .
SHA=$(sha256sum "$TARBALL" | awk '{print $1}')
SIZE=$(stat -c%s "$TARBALL")
printf '%s %s\n' "$SHA" "$(basename "$TARBALL")" > "$TARBALL.sha256"
cat > "$DIST_DIR/release.json" <<EOF
{
"version": "$VERSION",
"sha256": "$SHA",
"size": $SIZE,
"created_at": "$(date -Iseconds)"
}
EOF
echo "Built $TARBALL"
echo " sha256: $SHA"
echo " size: $SIZE bytes"