interplane.Get Omega
Read in your language

omega-packages

aien-dev/omega-packages

Brought by drakestapleton

branch main Branches Tags History

omega-packages / debian / build-deb.sh

25 lines · 1247 bytes Raw Blame History
1#!/bin/sh
2# build-deb.sh OMC OUTDIR -- package an already hash-checked omc (scripts/omc-from-seed.sh) as
3# OUTDIR/omc_<version>-1_arm64.deb. Binary package only, assembled with dpkg-deb; the build itself
4# is the seed chain, which needs no compiler, so there is no debhelper source package.
5set -eu
6here=$(CDPATH= cd -- "$(dirname "$0")/.." && pwd)
7. "$here/pins.env"
8[ $# -eq 2 ] || { echo "usage: build-deb.sh OMC OUTDIR" >&2; exit 2; }
9omc=$1 out=$2
10got=$(sha256sum "$omc" | cut -d' ' -f1)
11[ "$got" = "$OMC_SHA256" ] || { echo "FAIL omc sha256 $got, pinned $OMC_SHA256" >&2; exit 1; }
12ver=$OMC_VERSION-1
13mkdir -p "$out"
14root=$(mktemp -d)
15trap 'rm -rf "$root"' EXIT
16install -Dm0755 "$omc" "$root/usr/bin/omc"
17install -Dm0644 "$here/LICENSE" "$root/usr/share/doc/omc/copyright"
18install -Dm0644 "$here/examples/hello.om" "$root/usr/share/doc/omc/examples/hello.om"
19mkdir -p "$root/DEBIAN"
20size=$(du -sk "$root/usr" | cut -f1)
21sed -e "s/@VERSION@/$ver/" -e "s/@SIZE@/$size/" -e "s/@COMMIT@/$OMEGA_MV_COMMIT/" \
22 -e "s/@OMC_SHA256@/$OMC_SHA256/" "$here/debian/control.in" > "$root/DEBIAN/control"
23deb=$out/omc_${ver}_arm64.deb
24SOURCE_DATE_EPOCH=${SOURCE_DATE_EPOCH:-0} dpkg-deb --root-owner-group -Zxz --build "$root" "$deb" >/dev/null
25echo "$deb"