Remove runtime-bundle image dependencies
Hard-cut banger away from source-checkout runtime bundles as an implicit source of\nimage and host defaults. Managed images now own their full boot set,\nimage build starts from an existing registered image, and daemon startup\nno longer synthesizes a default image from host paths.\n\nResolve Firecracker from PATH or firecracker_bin, make SSH keys config-owned\nwith an auto-managed XDG default, replace the external name generator and\npackage manifests with Go code, and keep the vsock helper as a companion\nbinary instead of a user-managed runtime asset.\n\nUpdate the manual scripts, web/CLI forms, config surface, and docs around\nthe new build/manual flow and explicit image registration semantics.\n\nValidation: GOCACHE=/tmp/banger-gocache go test ./..., bash -n scripts/*.sh,\nand make build.
This commit is contained in:
parent
01c7cb5e65
commit
572bf32424
44 changed files with 1194 additions and 3456 deletions
|
|
@ -7,21 +7,19 @@ log() {
|
|||
|
||||
usage() {
|
||||
cat <<'EOF'
|
||||
Usage: ./scripts/make-rootfs-void.sh [--out <path>] [--size <size>] [--mirror <url>] [--arch <arch>] [--packages <path>]
|
||||
Usage: ./scripts/make-rootfs-void.sh [--out <path>] [--size <size>] [--mirror <url>] [--arch <arch>]
|
||||
|
||||
Build an experimental Void Linux rootfs image plus a matching /root work-seed.
|
||||
|
||||
Defaults:
|
||||
--out ./build/runtime/rootfs-void.ext4
|
||||
--out ./build/manual/rootfs-void.ext4
|
||||
--size 2G
|
||||
--mirror https://repo-default.voidlinux.org
|
||||
--arch x86_64
|
||||
--packages ./config/packages.void
|
||||
|
||||
This path is experimental and local-only. If ./build/runtime/void-kernel exists
|
||||
it uses the staged Void kernel modules from that directory; otherwise it falls
|
||||
back to the current runtime bundle modules. It does not change the default
|
||||
Debian image flow.
|
||||
This path is experimental and local-only. If ./build/manual/void-kernel exists
|
||||
it uses the staged Void kernel modules from that directory. It does not change
|
||||
the default Debian image flow.
|
||||
EOF
|
||||
}
|
||||
|
||||
|
|
@ -76,21 +74,6 @@ normalize_mirror() {
|
|||
printf '%s\n' "$mirror"
|
||||
}
|
||||
|
||||
bundle_path() {
|
||||
local key="$1"
|
||||
local fallback="$2"
|
||||
local rel=""
|
||||
|
||||
if [[ -f "$BUNDLE_METADATA" ]] && command -v jq >/dev/null 2>&1; then
|
||||
rel="$(jq -r --arg key "$key" '.[$key] // empty' "$BUNDLE_METADATA" 2>/dev/null || true)"
|
||||
fi
|
||||
if [[ -n "$rel" && "$rel" != "null" ]]; then
|
||||
printf '%s\n' "$RUNTIME_DIR/$rel"
|
||||
return
|
||||
fi
|
||||
printf '%s\n' "$fallback"
|
||||
}
|
||||
|
||||
find_latest_module_dir() {
|
||||
local root="$1"
|
||||
if [[ ! -d "$root" ]]; then
|
||||
|
|
@ -108,6 +91,19 @@ find_static_keys_dir() {
|
|||
find "$STATIC_DIR" -type d -path '*/var/db/xbps/keys' | sort | head -n 1
|
||||
}
|
||||
|
||||
load_package_preset() {
|
||||
local preset="$1"
|
||||
local -n out="$2"
|
||||
mapfile -t out < <("$BANGER_BIN" internal packages "$preset")
|
||||
(( ${#out[@]} > 0 ))
|
||||
}
|
||||
|
||||
write_rootfs_manifest_metadata() {
|
||||
local rootfs_path="$1"
|
||||
local manifest_hash="$2"
|
||||
printf '%s\n' "$manifest_hash" > "${rootfs_path}.packages.sha256"
|
||||
}
|
||||
|
||||
install_root_authorized_key() {
|
||||
local public_key
|
||||
public_key="$(ssh-keygen -y -f "$SSH_KEY")"
|
||||
|
|
@ -382,24 +378,10 @@ cleanup() {
|
|||
|
||||
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
REPO_ROOT="$(cd "$SCRIPT_DIR/.." && pwd)"
|
||||
PACKAGES_FILE="$REPO_ROOT/config/packages.void"
|
||||
export BANGER_APT_PACKAGES_FILE="$PACKAGES_FILE"
|
||||
source "$SCRIPT_DIR/lib/packages.sh"
|
||||
|
||||
DEFAULT_RUNTIME_DIR="$REPO_ROOT/build/runtime"
|
||||
if [[ ! -d "$DEFAULT_RUNTIME_DIR" && -d "$REPO_ROOT/runtime" ]]; then
|
||||
DEFAULT_RUNTIME_DIR="$REPO_ROOT/runtime"
|
||||
fi
|
||||
RUNTIME_DIR="${BANGER_RUNTIME_DIR:-$DEFAULT_RUNTIME_DIR}"
|
||||
if [[ ! -d "$RUNTIME_DIR" ]]; then
|
||||
log "runtime bundle not found: $RUNTIME_DIR"
|
||||
log "run 'make runtime-bundle' or set BANGER_RUNTIME_DIR"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
BUNDLE_METADATA="$RUNTIME_DIR/bundle.json"
|
||||
SSH_KEY="$(bundle_path ssh_key_path "$RUNTIME_DIR/id_ed25519")"
|
||||
OUT_ROOTFS="$RUNTIME_DIR/rootfs-void.ext4"
|
||||
MANUAL_DIR="${BANGER_MANUAL_DIR:-$REPO_ROOT/build/manual}"
|
||||
BANGER_BIN="$(resolve_banger_bin)"
|
||||
SSH_KEY="$("$BANGER_BIN" internal ssh-key-path)"
|
||||
OUT_ROOTFS="$MANUAL_DIR/rootfs-void.ext4"
|
||||
SIZE_SPEC="2G"
|
||||
MIRROR="https://repo-default.voidlinux.org"
|
||||
ARCH="x86_64"
|
||||
|
|
@ -408,12 +390,9 @@ MISE_INSTALL_PATH="/usr/local/bin/mise"
|
|||
OPENCODE_TOOL="github:anomalyco/opencode"
|
||||
GUESTNET_BOOTSTRAP_SCRIPT="$REPO_ROOT/internal/guestnet/assets/bootstrap.sh"
|
||||
GUESTNET_VOID_CORE_SERVICE="$REPO_ROOT/internal/guestnet/assets/void-core-service.sh"
|
||||
MODULES_DIR="$(bundle_path default_modules_dir "$RUNTIME_DIR/wtf/root/lib/modules/6.8.0-94-generic")"
|
||||
VOID_KERNEL_MODULES_DIR="$(find_latest_module_dir "$RUNTIME_DIR/void-kernel/lib/modules" || true)"
|
||||
VSOCK_AGENT="$(bundle_path vsock_agent_path "$RUNTIME_DIR/banger-vsock-agent")"
|
||||
if [[ "$VSOCK_AGENT" == "$RUNTIME_DIR/banger-vsock-agent" && ! -x "$VSOCK_AGENT" ]]; then
|
||||
VSOCK_AGENT="$(bundle_path vsock_ping_helper_path "$RUNTIME_DIR/banger-vsock-pingd")"
|
||||
fi
|
||||
MODULES_DIR=""
|
||||
VOID_KERNEL_MODULES_DIR="$(find_latest_module_dir "$MANUAL_DIR/void-kernel/lib/modules" || true)"
|
||||
VSOCK_AGENT="$("$BANGER_BIN" internal vsock-agent-path)"
|
||||
if [[ -n "$VOID_KERNEL_MODULES_DIR" ]]; then
|
||||
MODULES_DIR="$VOID_KERNEL_MODULES_DIR"
|
||||
fi
|
||||
|
|
@ -436,11 +415,6 @@ while [[ $# -gt 0 ]]; do
|
|||
ARCH="${2:-}"
|
||||
shift 2
|
||||
;;
|
||||
--packages)
|
||||
PACKAGES_FILE="${2:-}"
|
||||
export BANGER_APT_PACKAGES_FILE="$PACKAGES_FILE"
|
||||
shift 2
|
||||
;;
|
||||
-h|--help)
|
||||
usage
|
||||
exit 0
|
||||
|
|
@ -463,17 +437,13 @@ if [[ "$ARCH" != "x86_64" ]]; then
|
|||
exit 1
|
||||
fi
|
||||
|
||||
if [[ ! -f "$PACKAGES_FILE" ]]; then
|
||||
log "package manifest not found: $PACKAGES_FILE"
|
||||
exit 1
|
||||
fi
|
||||
if [[ ! -d "$MODULES_DIR" ]]; then
|
||||
log "modules dir not found: $MODULES_DIR"
|
||||
if [[ -z "$MODULES_DIR" || ! -d "$MODULES_DIR" ]]; then
|
||||
log "modules dir not found; run 'make void-kernel' first"
|
||||
exit 1
|
||||
fi
|
||||
if [[ ! -x "$VSOCK_AGENT" ]]; then
|
||||
log "vsock agent not found or not executable: $VSOCK_AGENT"
|
||||
log "run 'make build' or refresh the runtime bundle"
|
||||
log "run 'make build'"
|
||||
exit 1
|
||||
fi
|
||||
if [[ ! -f "$GUESTNET_BOOTSTRAP_SCRIPT" ]]; then
|
||||
|
|
@ -505,12 +475,12 @@ require_command truncate
|
|||
require_command mountpoint
|
||||
|
||||
VOID_PACKAGES=()
|
||||
if ! banger_packages_read_array VOID_PACKAGES "$PACKAGES_FILE"; then
|
||||
log "package manifest is empty: $PACKAGES_FILE"
|
||||
if ! load_package_preset void VOID_PACKAGES; then
|
||||
log "void package preset is empty"
|
||||
exit 1
|
||||
fi
|
||||
if ! PACKAGES_HASH="$(banger_packages_manifest_hash "$PACKAGES_FILE")"; then
|
||||
log "failed to hash package manifest: $PACKAGES_FILE"
|
||||
if ! PACKAGES_HASH="$(printf '%s\n' "${VOID_PACKAGES[@]}" | sha256sum | awk '{print $1}')"; then
|
||||
log "failed to hash package preset"
|
||||
exit 1
|
||||
fi
|
||||
if ! SIZE_BYTES="$(parse_size "$SIZE_SPEC")"; then
|
||||
|
|
@ -518,7 +488,6 @@ if ! SIZE_BYTES="$(parse_size "$SIZE_SPEC")"; then
|
|||
exit 1
|
||||
fi
|
||||
|
||||
BANGER_BIN="$(resolve_banger_bin)"
|
||||
if [[ "$OUT_ROOTFS" == *.ext4 ]]; then
|
||||
WORK_SEED="${OUT_ROOTFS%.ext4}.work-seed.ext4"
|
||||
else
|
||||
|
|
@ -613,7 +582,7 @@ sudo rm -rf \
|
|||
|
||||
sudo umount "$ROOT_MOUNT"
|
||||
|
||||
banger_write_rootfs_manifest_metadata "$OUT_ROOTFS" "$PACKAGES_HASH"
|
||||
write_rootfs_manifest_metadata "$OUT_ROOTFS" "$PACKAGES_HASH"
|
||||
|
||||
log "building work-seed $WORK_SEED"
|
||||
"$BANGER_BIN" internal work-seed --rootfs "$OUT_ROOTFS" --out "$WORK_SEED"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue