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-lock.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 | # Regenerates apt-packages.lock and dpkg-manifest.tsv for the release/repro/Dockerfile image (DRA-108). |
| 18 | # |
| 19 | # release/repro/apt-lock.sh SNAPSHOT SNAPSHOT is a snapshot.ubuntu.com timestamp, e.g. 20261031T120000Z |
| 20 | # |
| 21 | # Starts the Dockerfile's base image (by digest), points apt at https://snapshot.ubuntu.com/ubuntu/SNAPSHOT/ (it |
| 22 | # carries arm64), resolves apt-packages.in with --no-install-recommends, and writes one lock row per .deb apt |
| 23 | # fetched: package, version, architecture, sha256, size, pool path. Each sha256 is checked against the signed |
| 24 | # snapshot index (apt verifies InRelease with the base image's ubuntu-keyring; TLS peer checks are off because the |
| 25 | # base image has no CA certificates, and integrity rests on the signature and the sha256). Then it installs the set |
| 26 | # and writes the whole image's dpkg-query listing, which the Dockerfile requires to match exactly. The same SNAPSHOT |
| 27 | # gives the same two files. |
| 28 | set -euo pipefail |
| 29 | |
| 30 | snap=${1:?usage: release/repro/apt-lock.sh SNAPSHOT (e.g. 20261031T120000Z)} |
| 31 | [[ $snap =~ ^[0-9]{8}T[0-9]{6}Z$ ]] || { echo "$0: $snap is not a snapshot timestamp like 20261031T120000Z" >&2; exit 2; } |
| 32 | here=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd -P) |
| 33 | base=$(sed -n 's/^FROM \(ubuntu:[^ ]*@sha256:[0-9a-f]\{64\}\)$/\1/p' "$here/Dockerfile") |
| 34 | [ -n "$base" ] || { echo "$0: no digest-pinned FROM line in $here/Dockerfile" >&2; exit 2; } |
| 35 | out=$(mktemp -d) |
| 36 | trap 'rm -rf "$out"' EXIT |
| 37 | |
| 38 | # shellcheck disable=SC2016 # expanded inside the container |
| 39 | inner='set -euo pipefail |
| 40 | export DEBIAN_FRONTEND=noninteractive LC_ALL=C |
| 41 | sed -i "s|^URIs: .*|URIs: https://snapshot.ubuntu.com/ubuntu/$SNAP/|" /etc/apt/sources.list.d/ubuntu.sources |
| 42 | o=(-o Acquire::https::Verify-Peer=false -o Acquire::Check-Valid-Until=false) |
| 43 | apt-get "${o[@]}" update -q >/out/update.log |
| 44 | mapfile -t pkgs < <(grep -v "^#" /repro/apt-packages.in | grep .) |
| 45 | apt-get "${o[@]}" install -y -q --no-install-recommends --download-only "${pkgs[@]}" >/out/download.log |
| 46 | for deb in /var/cache/apt/archives/*.deb; do |
| 47 | p=$(dpkg-deb -f "$deb" Package) v=$(dpkg-deb -f "$deb" Version) a=$(dpkg-deb -f "$deb" Architecture) |
| 48 | s=$(sha256sum "$deb" | cut -d" " -f1) |
| 49 | show=$(apt-cache show "$p=$v") |
| 50 | idx=$(sed -n "s/^SHA256: //p" <<<"$show" | head -n1) |
| 51 | [ "$s" = "$idx" ] || { echo "$deb: sha256 $s, signed index says $idx" >&2; exit 1; } |
| 52 | printf "%s %s %s %s %s %s\n" "$p" "$v" "$a" "$s" "$(stat -c %s "$deb")" "$(sed -n "s/^Filename: //p" <<<"$show" | head -n1)" |
| 53 | done | sort >/out/rows |
| 54 | apt-get "${o[@]}" install -y -q --no-install-recommends "${pkgs[@]}" >/out/install.log |
| 55 | dpkg-query -W -f="\${Package}\t\${Version}\t\${Architecture}\n" | sort >/out/dpkg-manifest.tsv |
| 56 | chown -R "$OWNER" /out' |
| 57 | |
| 58 | docker run --rm -e SNAP="$snap" -e OWNER="$(id -u):$(id -g)" -v "$here:/repro:ro" -v "$out:/out" "$base" \ |
| 59 | bash -c "$inner" |
| 60 | |
| 61 | { |
| 62 | echo "# Generated by release/repro/apt-lock.sh $snap from apt-packages.in; do not edit by hand." |
| 63 | echo "# base: $base" |
| 64 | echo "# snapshot: $snap" |
| 65 | echo "# columns: package version architecture sha256 size pool-path" |
| 66 | cat "$out/rows" |
| 67 | } >"$here/apt-packages.lock" |
| 68 | cp "$out/dpkg-manifest.tsv" "$here/dpkg-manifest.tsv" |
| 69 | echo "$0: $(wc -l <"$out/rows") packages locked at snapshot $snap" |