#!/bin/sh # setup-builder.sh — prepare Debian 12 host/VM as bee ISO builder # # Run once on a fresh Debian 12 (Bookworm) host/VM as root. # After this script completes, the machine can build bee ISO images directly. # Container alternative: use `iso/builder/build-in-container.sh`. # # Usage (on Debian VM): # wget -O- https://git.mchus.pro/mchus/bee/raw/branch/main/iso/builder/setup-builder.sh | sh # or: sh setup-builder.sh set -e . "$(dirname "$0")/VERSIONS" 2>/dev/null || true GO_VERSION="${GO_VERSION:-1.24.0}" DEBIAN_VERSION="${DEBIAN_VERSION:-12}" DEBIAN_KERNEL_ABI="${DEBIAN_KERNEL_ABI:-6.1.0-28}" echo "=== bee builder setup ===" echo "Debian: $(cat /etc/debian_version)" echo "Go target: ${GO_VERSION}" echo "Kernel ABI: ${DEBIAN_KERNEL_ABI}" echo "" # --- system packages --- export DEBIAN_FRONTEND=noninteractive apt-get update -qq apt-get install -y \ live-build \ debootstrap \ squashfs-tools \ xorriso \ grub-pc-bin \ grub-efi-amd64-bin \ mtools \ git \ wget \ curl \ tar \ xz-utils \ screen \ rsync \ build-essential \ gcc \ make \ perl \ "linux-headers-${DEBIAN_KERNEL_ABI}-amd64" echo "linux-headers installed: $(dpkg -l "linux-headers-${DEBIAN_KERNEL_ABI}-amd64" | awk '/^ii/{print $3}')" # --- Go toolchain --- echo "" echo "=== installing Go ${GO_VERSION} ===" if [ -d /usr/local/go ] && /usr/local/go/bin/go version 2>/dev/null | grep -q "${GO_VERSION}"; then echo "Go ${GO_VERSION} already installed" else ARCH=$(uname -m) case "$ARCH" in x86_64) GOARCH=amd64 ;; aarch64) GOARCH=arm64 ;; *) echo "unsupported arch: $ARCH"; exit 1 ;; esac wget -O /tmp/go.tar.gz \ "https://go.dev/dl/go${GO_VERSION}.linux-${GOARCH}.tar.gz" rm -rf /usr/local/go tar -C /usr/local -xzf /tmp/go.tar.gz rm /tmp/go.tar.gz fi export PATH="$PATH:/usr/local/go/bin" echo "Go: $(go version)" echo "" echo "=== builder setup complete ===" echo "Next: sh iso/builder/build.sh"