49 lines
1.6 KiB
Bash
49 lines
1.6 KiB
Bash
#!/bin/sh
|
|||
|
|
# mmdebstrap customize-hook: stamp narOS identity into the rootfs (NAROS.md §2.3).
|
||
|
|
# $1 = rootfs dir; NAROS_* env exported by build-rootfs.sh. Debian's own
|
||
|
|
# /usr/lib/os-release stays intact (ID_LIKE tooling keeps working); we replace only the
|
||
|
|
# /etc/os-release symlink with the narOS file.
|
||
|
|
set -eu
|
||
|
|
R="$1"
|
||
|
|
|
||
|
|
rm -f "$R/etc/os-release"
|
||
|
|
cat > "$R/etc/os-release" <<EOF
|
||
|
|
NAME="narOS"
|
||
|
|
PRETTY_NAME="narOS $NAROS_VERSION (Nucleic Agent Runtime OS)"
|
||
|
|
ID=naros
|
||
|
|
ID_LIKE=debian
|
||
|
|
VERSION_ID="$NAROS_VERSION"
|
||
|
|
VERSION="$NAROS_VERSION ($NAROS_CHANNEL)"
|
||
|
|
VERSION_CODENAME=$NAROS_SUITE
|
||
|
|
VARIANT="$NAROS_TIER"
|
||
|
|
VARIANT_ID=$NAROS_TIER
|
||
|
|
HOME_URL="https://github.com/abkslm/nucleic"
|
||
|
|
DOCUMENTATION_URL="https://github.com/abkslm/nucleic/blob/main/docs/NAROS.md"
|
||
|
|
EOF
|
||
|
|
|
||
|
|
mkdir -p "$R/etc/naros"
|
||
|
|
echo "$NAROS_CHANNEL" > "$R/etc/naros/channel"
|
||
|
|
echo "$NAROS_SNAPSHOT" > "$R/etc/naros/snapshot-date"
|
||
|
|
echo "container" > "$R/etc/naros/role"
|
||
|
|
|
||
|
|
# Capability manifest (NAROS.md §6.3). Base fields here; toolchain entries are appended
|
||
|
|
# by the tiers that install them (agent-tier hook, N2). Versions of Nucleic packages are
|
||
|
|
# queryable via dpkg, listed here for one-stop reads.
|
||
|
|
nash_ver="$(chroot "$R" dpkg-query -W -f '${Version}' nash 2>/dev/null || echo null)"
|
||
|
|
[ "$nash_ver" = null ] || nash_ver="\"$nash_ver\""
|
||
|
|
cat > "$R/etc/naros/manifest.json" <<EOF
|
||
|
|
{
|
||
|
|
"os": "naros",
|
||
|
|
"version": "$NAROS_VERSION",
|
||
|
|
"channel": "$NAROS_CHANNEL",
|
||
|
|
"tier": "$NAROS_TIER",
|
||
|
|
"arch": "$NAROS_ARCH",
|
||
|
|
"debian": { "suite": "$NAROS_SUITE", "snapshot": "$NAROS_SNAPSHOT" },
|
||
|
|
"nash": $nash_ver,
|
||
|
|
"toolchains": {},
|
||
|
|
"caches": {}
|
||
|
|
}
|
||
|
|
EOF
|
||
|
|
|
||
|
|
echo "narOS identity: $(. "$R/etc/os-release" && echo "$PRETTY_NAME [$VARIANT/$NAROS_ARCH]")"
|