#!/bin/bash # Build sicd__.deb using dpkg-deb. Mirrors the lmcp/claude-his-agent # pattern, plus a Go cross-build step (sicd is a compiled binary). # # Usage: ./build-deb.sh [amd64|arm64] (default: host dpkg architecture) # Needs: go, dpkg-deb, curl. set -euo pipefail PKGVER=0.2.1 PKGREL=1 SIC_TARBALL_SHA256=0efe5acc0218fab02faf0c3c6f8cc1bcd57de64d0bff64bd08affe293b4f0bb6 HERE=$(dirname "$(readlink -f "$0")") DEB_ARCH="${1:-$(dpkg --print-architecture)}" case "$DEB_ARCH" in amd64) GOARCH=amd64 ;; arm64) GOARCH=arm64 ;; *) echo "unsupported arch: $DEB_ARCH (use amd64 or arm64)" >&2; exit 1 ;; esac # Reproducible build: pin mtimes + ar timestamps (v0.1.0, 2026-07-19 12:00 UTC). export SOURCE_DATE_EPOCH=1784829600 work=$(mktemp -d) trap "rm -rf $work" EXIT cd "$work" curl -sSLfo sic.tar.gz \ "https://git.reauktion.de/marfrit/sic/archive/v${PKGVER}.tar.gz" echo "$SIC_TARBALL_SHA256 sic.tar.gz" | sha256sum -c tar xzf sic.tar.gz ( cd sic && GOOS=linux GOARCH="$GOARCH" CGO_ENABLED=0 \ GOFLAGS='-buildvcs=false -trimpath' go build -ldflags='-s -w' -o sicd ./cmd/sicd ) ROOT="$work/pkgroot" mkdir -p "$ROOT/DEBIAN" "$ROOT/usr/bin" "$ROOT/usr/share/doc/sicd" install -m755 sic/sicd "$ROOT/usr/bin/sicd" install -m644 sic/gateway/sicd "$ROOT/usr/share/doc/sicd/sicd-reference.py" install -m644 sic/docs/design.md "$ROOT/usr/share/doc/sicd/design.md" install -m644 "$HERE/debian/copyright" "$ROOT/usr/share/doc/sicd/copyright" { echo "Package: sicd" echo "Version: ${PKGVER}-${PKGREL}" echo "Architecture: ${DEB_ARCH}" echo "Maintainer: Markus Fritsche " echo "Section: net" echo "Priority: optional" echo "Recommends: openssh-server" echo "Homepage: https://git.reauktion.de/marfrit/sic" echo "Description: sic daemon — netstring argv over stdin, execvp'd" echo " sicd reads netstring-framed argv from stdin and runs it with execvp," echo " so no shell re-parses the arguments. Deploy on target hosts and run" echo " it over ssh (as the remote command, or command=\"sicd\" on a key)." } > "$ROOT/DEBIAN/control" OUT="$HERE/sicd_${PKGVER}-${PKGREL}_${DEB_ARCH}.deb" rm -f "$OUT" dpkg-deb --root-owner-group --build "$ROOT" "$OUT" echo "built $OUT"