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,7 +7,7 @@ log() {
|
|||
|
||||
usage() {
|
||||
cat <<'EOF'
|
||||
Usage: ./scripts/interactive.sh <base-rootfs> [--out <path>] [--size <size>]
|
||||
Usage: ./scripts/interactive.sh <base-rootfs> --kernel <path> [--initrd <path>] [--size <size>]
|
||||
|
||||
Creates a writable copy of the base rootfs and boots a VM so you can
|
||||
customize it manually over SSH. No automatic package/config changes
|
||||
|
|
@ -32,42 +32,10 @@ parse_size() {
|
|||
|
||||
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
REPO_ROOT="$(cd "$SCRIPT_DIR/.." && pwd)"
|
||||
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
|
||||
STATE="${BANGER_STATE_DIR:-${XDG_STATE_HOME:-$HOME/.local/state}/banger/interactive}"
|
||||
VM_ROOT="$STATE/vms"
|
||||
mkdir -p "$VM_ROOT"
|
||||
|
||||
BUNDLE_METADATA="$RUNTIME_DIR/bundle.json"
|
||||
|
||||
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"
|
||||
}
|
||||
|
||||
FC_BIN="$RUNTIME_DIR/firecracker"
|
||||
KERNEL="$(bundle_path default_kernel "$RUNTIME_DIR/wtf/root/boot/vmlinux-6.8.0-94-generic")"
|
||||
INITRD="$(bundle_path default_initrd "$RUNTIME_DIR/wtf/root/boot/initrd.img-6.8.0-94-generic")"
|
||||
SSH_KEY="$RUNTIME_DIR/id_ed25519"
|
||||
|
||||
BR_DEV="br-fc"
|
||||
BR_IP="172.16.0.1"
|
||||
CIDR="24"
|
||||
|
|
@ -96,6 +64,10 @@ resolve_banger_bin() {
|
|||
|
||||
BANGER_BIN="$(resolve_banger_bin)"
|
||||
NAT_ACTIVE=0
|
||||
FC_BIN="$("$BANGER_BIN" internal firecracker-path)"
|
||||
SSH_KEY="$("$BANGER_BIN" internal ssh-key-path)"
|
||||
KERNEL=""
|
||||
INITRD=""
|
||||
|
||||
banger_nat() {
|
||||
local action="$1"
|
||||
|
|
@ -115,6 +87,14 @@ while [[ $# -gt 0 ]]; do
|
|||
SIZE_SPEC="${2:-}"
|
||||
shift 2
|
||||
;;
|
||||
--kernel)
|
||||
KERNEL="${2:-}"
|
||||
shift 2
|
||||
;;
|
||||
--initrd)
|
||||
INITRD="${2:-}"
|
||||
shift 2
|
||||
;;
|
||||
-h|--help)
|
||||
usage
|
||||
exit 0
|
||||
|
|
@ -140,11 +120,15 @@ if [[ ! -f "$BASE_ROOTFS" ]]; then
|
|||
log "base rootfs not found: $BASE_ROOTFS"
|
||||
exit 1
|
||||
fi
|
||||
if [[ -z "$KERNEL" ]]; then
|
||||
log "kernel path is required; pass --kernel"
|
||||
exit 1
|
||||
fi
|
||||
if [[ ! -f "$KERNEL" ]]; then
|
||||
log "kernel not found: $KERNEL"
|
||||
exit 1
|
||||
fi
|
||||
if [[ ! -f "$INITRD" ]]; then
|
||||
if [[ -n "$INITRD" && ! -f "$INITRD" ]]; then
|
||||
log "initrd not found: $INITRD"
|
||||
exit 1
|
||||
fi
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue