aien-sovereign-core-mv
AienOS host runtime: inference scheduling, paged KV state, the aien CLI and Spark verification tooling. Its inference engine is in alpha testing (DGX Spark GB10); Omega is the implementation destination.
Brought by drakestapleton
aien-sovereign-core-mv / release / repro / apt-install.sh
| 1 | #!/usr/bin/env bash |
| 2 | # SPDX-License-Identifier: Apache-2.0 |
| 3 | # Copyright 2026 Drake Stapleton (AIEN / aien-dev) |
| 4 | # |
| 5 | # Licensed under the Apache License, Version 2.0 (the "License"); |
| 6 | # you may not use this file except in compliance with the License. |
| 7 | # You may obtain a copy of the License at |
| 8 | # |
| 9 | # http://www.apache.org/licenses/LICENSE-2.0 |
| 10 | # |
| 11 | # Unless required by applicable law or agreed to in writing, software |
| 12 | # distributed under the License is distributed on an "AS IS" BASIS, |
| 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 14 | # See the License for the specific language governing permissions and |
| 15 | # limitations under the License. |
| 16 | |
| 17 | # Installs exactly the .deb files apt-packages.lock names (DRA-108). Runs inside release/repro/Dockerfile. |
| 18 | # |
| 19 | # apt-install.sh LOCK MANIFEST |
| 20 | # |
| 21 | # No apt index is read: each file is fetched by its pool path and accepted only if its sha256 equals the lock row. |
| 22 | # Sources, in order: the lock's snapshot.ubuntu.com snapshot, ports.ubuntu.com (current pool), Launchpad's archive |
| 23 | # file store. A source that does not serve the exact bytes is skipped; the next one is tried. TLS peer checks are off |
| 24 | # because the base image has no CA certificates; the sha256 from the repository is the check. After the install the |
| 25 | # image's whole dpkg-query listing must equal MANIFEST, so a missing, extra or upgraded package fails the build. |
| 26 | set -euo pipefail |
| 27 | |
| 28 | lock=${1:?usage: apt-install.sh LOCK MANIFEST} |
| 29 | manifest=${2:?usage: apt-install.sh LOCK MANIFEST} |
| 30 | export DEBIAN_FRONTEND=noninteractive LC_ALL=C |
| 31 | snap=$(sed -n 's/^# snapshot: //p' "$lock") |
| 32 | [[ $snap =~ ^[0-9]{8}T[0-9]{6}Z$ ]] || { echo "apt-install.sh: $lock names no snapshot" >&2; exit 1; } |
| 33 | |
| 34 | fetch() { # fetch URL FILE SHA256 |
| 35 | /usr/lib/apt/apt-helper -o Acquire::https::Verify-Peer=false download-file "$1" "$2" "SHA256:$3" >/dev/null |
| 36 | } |
| 37 | |
| 38 | dir=$(mktemp -d) |
| 39 | cd "$dir" |
| 40 | n=0 |
| 41 | while read -r pkg ver arch sha size path; do |
| 42 | case $pkg in '' | '#'*) continue ;; esac |
| 43 | file=${path##*/} |
| 44 | fetch "https://snapshot.ubuntu.com/ubuntu/$snap/$path" "$file" "$sha" || |
| 45 | fetch "http://ports.ubuntu.com/ubuntu-ports/$path" "$file" "$sha" || |
| 46 | fetch "https://launchpad.net/ubuntu/+archive/primary/+files/$file" "$file" "$sha" || |
| 47 | { echo "apt-install.sh: no source served $file ($pkg $ver $arch) with sha256 $sha" >&2; exit 1; } |
| 48 | [ "$(stat -c %s "$file")" = "$size" ] || { echo "apt-install.sh: $file is not $size bytes" >&2; exit 1; } |
| 49 | n=$((n + 1)) |
| 50 | done <"$lock" |
| 51 | # Recheck every file with coreutils, independent of apt-helper. |
| 52 | awk '!/^#/ && NF { n = split($6, p, "/"); print $4 " " p[n] }' "$lock" | sha256sum -c --quiet - |
| 53 | [ "$(find . -name '*.deb' | wc -l)" = "$n" ] || { echo "apt-install.sh: file count differs from $n lock rows" >&2; exit 1; } |
| 54 | |
| 55 | apt-get install -y -q --no-install-recommends ./*.deb |
| 56 | dpkg-query -W -f='${Package}\t${Version}\t${Architecture}\n' | sort | diff -u "$manifest" - || |
| 57 | { echo "apt-install.sh: image package set differs from $manifest" >&2; exit 1; } |
| 58 | cd / |
| 59 | rm -rf "$dir" /var/lib/apt/lists/* /var/cache/apt/*.bin |
| 60 | echo "apt-install.sh: $n locked packages installed (snapshot $snap); dpkg-query equals $manifest" |