Make installed banger self-contained
Fix the misleading make install path where banger and bangerd still depended on a repo checkout for Firecracker, guest artifacts, image builds, and the SSH key. Replace repo-root inference with an explicit runtime bundle model: resolve a runtime_dir from env/config/install layout, derive concrete artifact paths from it, and update the daemon, CLI, and image-build flow to use those paths. Keep repo_root only as an explicit compatibility alias instead of auto-detecting it. Teach customize.sh to run from a read-only bundled runtime tree while writing transient state under XDG/BANGER_STATE_DIR, and make make install copy the runtime assets into PREFIX/lib/banger so installed binaries stay usable outside the repo. Validate with go test ./..., make build, bash -n customize.sh, and make install DESTDIR=/tmp/banger-install PREFIX=/usr. An out-of-repo installed-binary smoke test was attempted, but this sandbox blocked bangerd from binding its Unix socket (setsockopt: operation not permitted).
This commit is contained in:
parent
375900cf65
commit
ce1be52047
13 changed files with 437 additions and 107 deletions
23
customize.sh
23
customize.sh
|
|
@ -29,19 +29,20 @@ parse_size() {
|
|||
return 1
|
||||
}
|
||||
|
||||
DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
source "$DIR/dns.sh"
|
||||
source "$DIR/packages.sh"
|
||||
STATE="$DIR/state"
|
||||
RUNTIME_DIR="${BANGER_RUNTIME_DIR:-$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)}"
|
||||
source "$RUNTIME_DIR/dns.sh"
|
||||
source "$RUNTIME_DIR/packages.sh"
|
||||
STATE="${BANGER_STATE_DIR:-${XDG_STATE_HOME:-$HOME/.local/state}/banger/image-build}"
|
||||
VM_ROOT="$STATE/vms"
|
||||
mkdir -p "$VM_ROOT"
|
||||
|
||||
BASE_ROOTFS="$DIR/rootfs.ext4"
|
||||
FC_BIN="$DIR/firecracker"
|
||||
BASE_ROOTFS="$RUNTIME_DIR/rootfs.ext4"
|
||||
FC_BIN="$RUNTIME_DIR/firecracker"
|
||||
|
||||
KERNEL="$DIR/wtf/root/boot/vmlinux-6.8.0-94-generic"
|
||||
INITRD="$DIR/wtf/root/boot/initrd.img-6.8.0-94-generic"
|
||||
SSH_KEY="$DIR/id_ed25519"
|
||||
KERNEL="$RUNTIME_DIR/wtf/root/boot/vmlinux-6.8.0-94-generic"
|
||||
INITRD="$RUNTIME_DIR/wtf/root/boot/initrd.img-6.8.0-94-generic"
|
||||
SSH_KEY="$RUNTIME_DIR/id_ed25519"
|
||||
NAT_SCRIPT="$RUNTIME_DIR/nat.sh"
|
||||
|
||||
BR_DEV="br-fc"
|
||||
BR_IP="172.16.0.1"
|
||||
|
|
@ -52,7 +53,7 @@ BASE_ROOTFS=""
|
|||
OUT_ROOTFS=""
|
||||
SIZE_SPEC=""
|
||||
INSTALL_DOCKER=0
|
||||
MODULES_DIR="$DIR/wtf/root/lib/modules/6.8.0-94-generic"
|
||||
MODULES_DIR="$RUNTIME_DIR/wtf/root/lib/modules/6.8.0-94-generic"
|
||||
PACKAGES_FILE="$(banger_packages_file)"
|
||||
while [[ $# -gt 0 ]]; do
|
||||
case "$1" in
|
||||
|
|
@ -304,7 +305,7 @@ jq -n \
|
|||
> "$VM_DIR/vm.json"
|
||||
|
||||
log "enabling NAT for customization"
|
||||
sudo -E ./nat.sh up "$VM_TAG" >/dev/null
|
||||
sudo -E "$NAT_SCRIPT" up "$VM_TAG" >/dev/null
|
||||
|
||||
log "waiting for SSH"
|
||||
SSH_READY=0
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue