From b8135a19df79f2a4ce71d2fcd18f8a3b408ce66f Mon Sep 17 00:00:00 2001 From: Mikhail Chusavitin Date: Sat, 7 Mar 2026 09:49:11 +0300 Subject: [PATCH] Remove leftover debug/prod split files from tracking Co-Authored-By: Claude Sonnet 4.6 --- iso/builder/build-debug.sh | 170 ----- iso/builder/genapkovl-bee_debug.sh | 106 ---- iso/builder/mkimg.bee_debug.sh | 56 -- iso/overlay-debug/etc/dropbear/dropbear.conf | 1 - iso/overlay-debug/etc/init.d/bee-audit-debug | 21 - iso/overlay-debug/etc/init.d/bee-network | 14 - iso/overlay-debug/etc/init.d/bee-nvidia | 33 - iso/overlay-debug/etc/init.d/bee-sshsetup | 28 - iso/overlay-debug/etc/init.d/dropbear | 37 -- iso/overlay-debug/etc/inittab | 13 - iso/overlay-debug/etc/motd | 16 - iso/overlay-debug/etc/profile.d/bee.sh | 21 - iso/overlay-debug/root/.ssh/.gitkeep | 0 .../usr/local/bin/bee-net-restart | 8 - .../usr/local/bin/bee-network.sh | 31 - iso/overlay-debug/usr/local/bin/bee-tui | 581 ------------------ 16 files changed, 1136 deletions(-) delete mode 100644 iso/builder/build-debug.sh delete mode 100755 iso/builder/genapkovl-bee_debug.sh delete mode 100644 iso/builder/mkimg.bee_debug.sh delete mode 100644 iso/overlay-debug/etc/dropbear/dropbear.conf delete mode 100755 iso/overlay-debug/etc/init.d/bee-audit-debug delete mode 100755 iso/overlay-debug/etc/init.d/bee-network delete mode 100755 iso/overlay-debug/etc/init.d/bee-nvidia delete mode 100755 iso/overlay-debug/etc/init.d/bee-sshsetup delete mode 100755 iso/overlay-debug/etc/init.d/dropbear delete mode 100644 iso/overlay-debug/etc/inittab delete mode 100644 iso/overlay-debug/etc/motd delete mode 100644 iso/overlay-debug/etc/profile.d/bee.sh delete mode 100644 iso/overlay-debug/root/.ssh/.gitkeep delete mode 100644 iso/overlay-debug/usr/local/bin/bee-net-restart delete mode 100644 iso/overlay-debug/usr/local/bin/bee-network.sh delete mode 100755 iso/overlay-debug/usr/local/bin/bee-tui diff --git a/iso/builder/build-debug.sh b/iso/builder/build-debug.sh deleted file mode 100644 index ae4be33..0000000 --- a/iso/builder/build-debug.sh +++ /dev/null @@ -1,170 +0,0 @@ -#!/bin/sh -# build-debug.sh — build bee debug ISO with SSH access -# -# Debug ISO purpose: test audit binary on real hardware. -# Includes dropbear SSH, all audit packages, audit binary, NVIDIA open kernel modules. -# -# Run on Alpine builder VM as root after setup-builder.sh. -# Usage: -# sh iso/builder/build-debug.sh [--authorized-keys /path/to/authorized_keys] - -set -e - -REPO_ROOT="$(cd "$(dirname "$0")/../.." && pwd)" -BUILDER_DIR="${REPO_ROOT}/iso/builder" -OVERLAY_DIR="${REPO_ROOT}/iso/overlay-debug" -DIST_DIR="${REPO_ROOT}/dist" -AUTH_KEYS="" - -# parse args -while [ $# -gt 0 ]; do - case "$1" in - --authorized-keys) AUTH_KEYS="$2"; shift 2 ;; - *) echo "unknown arg: $1"; exit 1 ;; - esac -done - -. "${BUILDER_DIR}/VERSIONS" -export PATH="$PATH:/usr/local/go/bin" - -# NOTE: lz4 compression for modloop is disabled — Alpine initramfs may not support lz4 squashfs. -# Default xz compression is used until lz4 support is confirmed. - -echo "=== bee debug ISO build ===" -echo "Alpine: ${ALPINE_VERSION}, Go: ${GO_VERSION}" -echo "" - -# --- compile audit binary (static, Linux amd64) --- -# Skip rebuild if binary is newer than all Go source files. -AUDIT_BIN="${DIST_DIR}/bee-audit-linux-amd64" -NEED_BUILD=1 -if [ -f "$AUDIT_BIN" ]; then - NEWEST_SRC=$(find "${REPO_ROOT}/audit" -name '*.go' -newer "$AUDIT_BIN" | head -1) - [ -z "$NEWEST_SRC" ] && NEED_BUILD=0 -fi - -if [ "$NEED_BUILD" = "1" ]; then - echo "=== building audit binary ===" - cd "${REPO_ROOT}/audit" - GOOS=linux GOARCH=amd64 CGO_ENABLED=0 \ - go build \ - -ldflags "-s -w -X main.Version=debug-$(date +%Y%m%d)" \ - -o "$AUDIT_BIN" \ - ./cmd/audit - echo "binary: $AUDIT_BIN" - echo "size: $(du -sh "$AUDIT_BIN" | cut -f1)" -else - echo "=== audit binary up to date, skipping build ===" -fi - -# --- inject authorized_keys for SSH access --- -# Uses the same Ed25519 keys as release signing (from git.mchus.pro/mchus/keys). -# SSH public keys are stored alongside signing keys as ~/.keys/.key.pub -AUTHORIZED_KEYS_FILE="${OVERLAY_DIR}/root/.ssh/authorized_keys" -mkdir -p "${OVERLAY_DIR}/root/.ssh" - -if [ -n "$AUTH_KEYS" ]; then - cp "$AUTH_KEYS" "$AUTHORIZED_KEYS_FILE" - chmod 600 "$AUTHORIZED_KEYS_FILE" - echo "SSH authorized_keys: installed from $AUTH_KEYS" -else - # auto-collect all developer SSH public keys from ~/.keys/*.key.pub - > "$AUTHORIZED_KEYS_FILE" - FOUND=0 - for ssh_pub in "$HOME"/.keys/*.key.pub; do - [ -f "$ssh_pub" ] || continue - cat "$ssh_pub" >> "$AUTHORIZED_KEYS_FILE" - echo "SSH: added $(basename "$ssh_pub" .key.pub)" - FOUND=$((FOUND + 1)) - done - if [ "$FOUND" -gt 0 ]; then - chmod 600 "$AUTHORIZED_KEYS_FILE" - echo "SSH authorized_keys: $FOUND key(s) from ~/.keys/*.key.pub" - else - echo "WARNING: no SSH public keys found — falling back to password auth" - echo " root password will be set to: bee / eeb" - echo " (generate a key with: sh keys/scripts/keygen.sh )" - USE_PASSWORD_FALLBACK=1 - fi -fi - -# --- password fallback: write marker file read by init script --- -if [ "${USE_PASSWORD_FALLBACK:-0}" = "1" ]; then - touch "${OVERLAY_DIR}/etc/bee-ssh-password-fallback" -fi - -# --- copy audit binary into overlay --- -mkdir -p "${OVERLAY_DIR}/usr/local/bin" -cp "${DIST_DIR}/bee-audit-linux-amd64" "${OVERLAY_DIR}/usr/local/bin/audit" -chmod +x "${OVERLAY_DIR}/usr/local/bin/audit" - -# --- build NVIDIA kernel modules and inject into overlay --- -echo "" -echo "=== building NVIDIA ${NVIDIA_DRIVER_VERSION} modules ===" -sh "${BUILDER_DIR}/build-nvidia-module.sh" "${NVIDIA_DRIVER_VERSION}" "${DIST_DIR}" - -# Determine kernel version (same as what goes into the ISO — both use linux-lts from same Alpine) -KVER=$(ls /usr/src/ 2>/dev/null | grep '^linux-headers-' | sed 's/linux-headers-//' | sort -V | tail -1) -NVIDIA_CACHE="${DIST_DIR}/nvidia-${NVIDIA_DRIVER_VERSION}-${KVER}" - -# Inject .ko files into overlay at /lib/modules//extra/nvidia/ -OVERLAY_KMOD_DIR="${OVERLAY_DIR}/lib/modules/${KVER}/extra/nvidia" -mkdir -p "${OVERLAY_KMOD_DIR}" -cp "${NVIDIA_CACHE}/modules/"*.ko "${OVERLAY_KMOD_DIR}/" - -# Inject nvidia-smi and libnvidia-ml -mkdir -p "${OVERLAY_DIR}/usr/local/bin" "${OVERLAY_DIR}/usr/lib" -cp "${NVIDIA_CACHE}/bin/nvidia-smi" "${OVERLAY_DIR}/usr/local/bin/" -chmod +x "${OVERLAY_DIR}/usr/local/bin/nvidia-smi" -cp "${NVIDIA_CACHE}/lib/"* "${OVERLAY_DIR}/usr/lib/" 2>/dev/null || true - -# --- export build info for genapkovl to inject into motd --- -BUILD_DATE=$(date +%Y-%m-%d) -GIT_COMMIT=$(git -C "${REPO_ROOT}" rev-parse --short HEAD 2>/dev/null || echo "unknown") -export BEE_BUILD_INFO="${BUILD_DATE} git:${GIT_COMMIT} alpine:${ALPINE_VERSION} nvidia:${NVIDIA_DRIVER_VERSION}" - -# --- build ISO using mkimage --- -mkdir -p "${DIST_DIR}" -echo "" -echo "=== building ISO ===" - -# Install our mkimage profile where mkimage.sh can find it. -# ~/.mkimage is the user plugin directory loaded by mkimage.sh. -mkdir -p "${HOME}/.mkimage" -cp "${BUILDER_DIR}/mkimg.bee_debug.sh" "${HOME}/.mkimage/" -cp "${BUILDER_DIR}/genapkovl-bee_debug.sh" "${HOME}/.mkimage/" - -# Export overlay dir so the profile script can find it regardless of SRCDIR. -export BEE_OVERLAY_DIR="${OVERLAY_DIR}" - -# Clean workdir selectively: remove everything except apks cache so packages aren't re-downloaded. -# mkimage stores each section in a hash-named subdir; apks_* dirs contain downloaded packages. -if [ -d /var/tmp/bee-iso-work ]; then - find /var/tmp/bee-iso-work -maxdepth 1 -mindepth 1 \ - -not -name 'apks_*' -not -name 'kernel_*' \ - -not -name 'syslinux_*' -not -name 'grub_*' \ - -exec rm -rf {} + 2>/dev/null || true -fi - -# Run from /var/tmp to avoid git repo context conflicts and to ensure enough scratch space. -# mkinitfs/update-kernel use TMPDIR for initramfs build; tmpfs /tmp is only ~1GB. -# mkimage.sh sources genapkovl-*.sh from CWD (not from ~/.mkimage), so copy it here too. -export TMPDIR=/var/tmp -cp "${BUILDER_DIR}/genapkovl-bee_debug.sh" /var/tmp/ -cd /var/tmp -sh /usr/share/aports/scripts/mkimage.sh \ - --tag "v${ALPINE_VERSION}" \ - --outdir "${DIST_DIR}" \ - --arch x86_64 \ - --repository "https://dl-cdn.alpinelinux.org/alpine/v${ALPINE_VERSION}/main" \ - --repository "https://dl-cdn.alpinelinux.org/alpine/v${ALPINE_VERSION}/community" \ - --workdir /var/tmp/bee-iso-work \ - --profile bee_debug - -ISO="${DIST_DIR}/alpine-bee_debug-${ALPINE_VERSION}-x86_64.iso" -echo "" -echo "=== done ===" -echo "ISO: $ISO" -echo "Size: $(du -sh "$ISO" 2>/dev/null | cut -f1 || echo 'not found')" -echo "" -echo "Boot via BMC virtual media and SSH to the server IP on port 22 as root." diff --git a/iso/builder/genapkovl-bee_debug.sh b/iso/builder/genapkovl-bee_debug.sh deleted file mode 100755 index adedb4c..0000000 --- a/iso/builder/genapkovl-bee_debug.sh +++ /dev/null @@ -1,106 +0,0 @@ -#!/bin/sh -e -HOSTNAME="$1" -[ -n "$HOSTNAME" ] || { echo "usage: $0 hostname"; exit 1; } -OVERLAY="${BEE_OVERLAY_DIR}" -[ -n "$OVERLAY" ] || { echo "ERROR: BEE_OVERLAY_DIR not set"; exit 1; } - -cleanup() { rm -rf "$tmp"; } -tmp="$(mktemp -d)" -trap cleanup EXIT - -makefile() { OWNER="$1" PERMS="$2" FILENAME="$3"; cat > "$FILENAME"; chown "$OWNER" "$FILENAME"; chmod "$PERMS" "$FILENAME"; } -rc_add() { mkdir -p "$tmp/etc/runlevels/$2"; ln -sf /etc/init.d/"$1" "$tmp/etc/runlevels/$2/$1"; } - -mkdir -p "$tmp/etc" -makefile root:root 0644 "$tmp/etc/hostname" </dev/null || true - [ -n "$BEE_BUILD_INFO" ] && sed -i "s/%%BUILD_INFO%%/${BEE_BUILD_INFO}/" "$tmp/etc/motd" 2>/dev/null || true -fi - -mkdir -p "$tmp/usr" -if [ -d "$OVERLAY/usr" ]; then - cp -r "$OVERLAY/usr/." "$tmp/usr/" - chmod +x "$tmp/usr/local/bin/"* 2>/dev/null || true -fi - -if [ -d "$OVERLAY/root" ]; then - mkdir -p "$tmp/root" - cp -r "$OVERLAY/root/." "$tmp/root/" - chmod 700 "$tmp/root/.ssh" 2>/dev/null || true - chmod 600 "$tmp/root/.ssh/authorized_keys" 2>/dev/null || true -fi - -if [ -d "$OVERLAY/lib" ]; then - mkdir -p "$tmp/lib" - cp -r "$OVERLAY/lib/." "$tmp/lib/" -fi - -mkdir -p "$tmp/etc/dropbear" "$tmp/etc/conf.d" -# -R: auto-generate host keys if missing -# no dependency on networking service — bee-network handles DHCP independently -makefile root:root 0644 "$tmp/etc/conf.d/dropbear" </dev/null | gzip -9n > "$HOSTNAME.apkovl.tar.gz" diff --git a/iso/builder/mkimg.bee_debug.sh b/iso/builder/mkimg.bee_debug.sh deleted file mode 100644 index 2daaba0..0000000 --- a/iso/builder/mkimg.bee_debug.sh +++ /dev/null @@ -1,56 +0,0 @@ -#!/bin/sh -# Alpine mkimage profile: bee_debug - -profile_bee_debug() { - title="Bee Hardware Audit (debug)" - desc="Hardware audit LiveCD with SSH access for testing" - arch="x86_64" - hostname="alpine-bee" - apkovl="genapkovl-bee_debug.sh" - image_ext="iso" - output_format="iso" - kernel_flavors="lts" - kernel_addons="" - initfs_cmdline="modules=loop,squashfs,sd-mod,usb-storage modloop=/boot/modloop-lts quiet" - initfs_features="ata base cdrom ext4 mmc nvme raid scsi squashfs usb virtio nfit" - grub_mod="all_video disk part_gpt part_msdos linux normal configfile search search_label efi_gop fat iso9660 cat echo ls test true help gzio multiboot2 efi_uga" - syslinux_serial="0 115200" - apks=" - alpine-base - linux-lts - linux-firmware-none - linux-firmware-rtl_nic - linux-firmware-bnx2 - linux-firmware-bnx2x - linux-firmware-tigon - linux-firmware-qlogic - linux-firmware-netronome - linux-firmware-mellanox - linux-firmware-intel - linux-firmware-other - - dmidecode - smartmontools - nvme-cli - pciutils - ipmitool - util-linux - lsblk - e2fsprogs - lshw - - dropbear - openrc - libqrencode-tools - tzdata - ca-certificates - - strace - procps - lsof - file - less - vim - dialog - " -} diff --git a/iso/overlay-debug/etc/dropbear/dropbear.conf b/iso/overlay-debug/etc/dropbear/dropbear.conf deleted file mode 100644 index b7f1ab1..0000000 --- a/iso/overlay-debug/etc/dropbear/dropbear.conf +++ /dev/null @@ -1 +0,0 @@ -DROPBEAR_OPTS="-p 22 -R -B" diff --git a/iso/overlay-debug/etc/init.d/bee-audit-debug b/iso/overlay-debug/etc/init.d/bee-audit-debug deleted file mode 100755 index aae7d73..0000000 --- a/iso/overlay-debug/etc/init.d/bee-audit-debug +++ /dev/null @@ -1,21 +0,0 @@ -#!/sbin/openrc-run - -description="Bee: run hardware audit (debug mode — SSH stays up after)" - -depend() { - need localmount - after bee-network -} - -start() { - ebegin "Running hardware audit" - /usr/local/bin/audit --output stdout > /var/log/bee-audit.json 2>/var/log/bee-audit.log - local rc=$? - if [ $rc -eq 0 ]; then - einfo "Audit complete: /var/log/bee-audit.json" - einfo "SSH in and inspect results. Dropbear is running." - else - ewarn "Audit finished with errors — check /var/log/bee-audit.log" - fi - eend 0 -} diff --git a/iso/overlay-debug/etc/init.d/bee-network b/iso/overlay-debug/etc/init.d/bee-network deleted file mode 100755 index 41ac66f..0000000 --- a/iso/overlay-debug/etc/init.d/bee-network +++ /dev/null @@ -1,14 +0,0 @@ -#!/sbin/openrc-run - -description="Bee: bring up network interfaces via DHCP" - -depend() { - need localmount - before bee-audit-debug -} - -start() { - ebegin "Bringing up network interfaces" - /usr/local/bin/bee-network.sh >> /var/log/bee-network.log 2>&1 - eend 0 -} diff --git a/iso/overlay-debug/etc/init.d/bee-nvidia b/iso/overlay-debug/etc/init.d/bee-nvidia deleted file mode 100755 index 0cc4914..0000000 --- a/iso/overlay-debug/etc/init.d/bee-nvidia +++ /dev/null @@ -1,33 +0,0 @@ -#!/sbin/openrc-run - -description="Bee: load NVIDIA kernel modules" - -depend() { - need localmount - before bee-audit-debug -} - -start() { - ebegin "Loading NVIDIA modules" - kver="$(uname -r)" - einfo "kernel: ${kver}" - if [ -d "/lib/modules/${kver}/extra/nvidia" ]; then - einfo "module dir: /lib/modules/${kver}/extra/nvidia" - ls "/lib/modules/${kver}/extra/nvidia"/*.ko 2>/dev/null | sed 's/^/ /' || true - else - ewarn "module dir missing: /lib/modules/${kver}/extra/nvidia" - fi - - # Run depmod so kernel can locate our modules in /lib/modules/.../extra/ - depmod -a 2>/dev/null || true - - for mod in nvidia nvidia-modeset nvidia-uvm; do - if modprobe "$mod" 2>/dev/null; then - einfo "loaded: $mod" - else - ewarn "failed to load: $mod" - dmesg | tail -n 5 | sed 's/^/ dmesg: /' || true - fi - done - eend 0 -} diff --git a/iso/overlay-debug/etc/init.d/bee-sshsetup b/iso/overlay-debug/etc/init.d/bee-sshsetup deleted file mode 100755 index cde283d..0000000 --- a/iso/overlay-debug/etc/init.d/bee-sshsetup +++ /dev/null @@ -1,28 +0,0 @@ -#!/sbin/openrc-run - -description="Bee: configure SSH access (keys or password fallback)" - -depend() { - need localmount - before dropbear -} - -start() { - # Always create dedicated 'bee' user for password fallback. - # If no SSH keys embedded: login with bee / eeb - if ! id bee > /dev/null 2>&1; then - adduser -D -s /bin/sh bee > /dev/null 2>&1 - fi - printf 'eeb\neeb\n' | passwd bee > /dev/null 2>&1 - - if [ -f /etc/bee-ssh-password-fallback ]; then - ebegin "SSH key auth unavailable — password fallback active" - ewarn "Login: bee / eeb" - ewarn "Generate a key: sh keys/scripts/keygen.sh " - eend 0 - else - ebegin "SSH key auth configured" - # bee user exists but password login less useful when keys work - eend 0 - fi -} diff --git a/iso/overlay-debug/etc/init.d/dropbear b/iso/overlay-debug/etc/init.d/dropbear deleted file mode 100755 index d00e07c..0000000 --- a/iso/overlay-debug/etc/init.d/dropbear +++ /dev/null @@ -1,37 +0,0 @@ -#!/sbin/openrc-run - -description="Dropbear SSH server" - -depend() { - need localmount - after bee-sshsetup - use logger -} - -check_config() { - if [ ! -e /etc/dropbear/dropbear_rsa_host_key ]; then - einfo "Generating RSA host key..." - /usr/bin/dropbearkey -t rsa -f /etc/dropbear/dropbear_rsa_host_key - fi - if [ ! -e /etc/dropbear/dropbear_ecdsa_host_key ]; then - einfo "Generating ECDSA host key..." - /usr/bin/dropbearkey -t ecdsa -f /etc/dropbear/dropbear_ecdsa_host_key - fi - if [ ! -e /etc/dropbear/dropbear_ed25519_host_key ]; then - einfo "Generating ED25519 host key..." - /usr/bin/dropbearkey -t ed25519 -f /etc/dropbear/dropbear_ed25519_host_key - fi -} - -start() { - check_config || return 1 - ebegin "Starting dropbear" - /usr/sbin/dropbear ${DROPBEAR_OPTS} - eend $? -} - -stop() { - ebegin "Stopping dropbear" - start-stop-daemon --stop --pidfile /var/run/dropbear.pid - eend $? -} diff --git a/iso/overlay-debug/etc/inittab b/iso/overlay-debug/etc/inittab deleted file mode 100644 index d6a9990..0000000 --- a/iso/overlay-debug/etc/inittab +++ /dev/null @@ -1,13 +0,0 @@ -::sysinit:/sbin/openrc sysinit -::sysinit:/sbin/openrc boot -::wait:/sbin/openrc default - -# Autologin on tty1 -tty1::respawn:/sbin/agetty --autologin root --noclear tty1 linux -tty2::respawn:/sbin/getty 38400 tty2 -tty3::respawn:/sbin/getty 38400 tty3 - -ttyS0::respawn:/sbin/getty -L 115200 ttyS0 vt100 - -::ctrlaltdel:/sbin/reboot -::shutdown:/sbin/openrc shutdown diff --git a/iso/overlay-debug/etc/motd b/iso/overlay-debug/etc/motd deleted file mode 100644 index ea04205..0000000 --- a/iso/overlay-debug/etc/motd +++ /dev/null @@ -1,16 +0,0 @@ - - ██████╗ ███████╗███████╗ ██████╗ ███████╗██████╗ ██╗ ██╗ ██████╗ - ██╔══██╗██╔════╝██╔════╝ ██╔══██╗██╔════╝██╔══██╗██║ ██║██╔════╝ - ██████╔╝█████╗ █████╗ ██║ ██║█████╗ ██████╔╝██║ ██║██║ ███╗ - ██╔══██╗██╔══╝ ██╔══╝ ██║ ██║██╔══╝ ██╔══██╗██║ ██║██║ ██║ - ██████╔╝███████╗███████╗ ██████╔╝███████╗██████╔╝╚██████╔╝╚██████╔╝ - ╚═════╝ ╚══════╝╚══════╝ ╚═════╝ ╚══════╝╚═════╝ ╚═════╝ ╚═════╝ - - Hardware Audit LiveCD — DEBUG MODE - Build: %%BUILD_INFO%% - - Logs: /var/log/bee-audit.json /var/log/bee-network.log - - Open TUI: bee-tui - - SSH access: key auth (developers) or bee/eeb (password fallback) diff --git a/iso/overlay-debug/etc/profile.d/bee.sh b/iso/overlay-debug/etc/profile.d/bee.sh deleted file mode 100644 index e50991e..0000000 --- a/iso/overlay-debug/etc/profile.d/bee.sh +++ /dev/null @@ -1,21 +0,0 @@ -export PATH="$PATH:/usr/local/bin" - -menu() { - if [ -x /usr/local/bin/bee-tui ]; then - /usr/local/bin/bee-tui "$@" - else - echo "bee-tui is not installed" - return 1 - fi -} - -# Auto-open TUI on local tty1 after boot. -# Exiting TUI returns to this shell (console prompt). -if [ -z "${BEE_TUI_AUTO_LAUNCHED:-}" ] \ - && [ -z "${SSH_CONNECTION:-}" ] \ - && [ -z "${SSH_TTY:-}" ] \ - && [ "$(tty 2>/dev/null)" = "/dev/tty1" ] \ - && [ -x /usr/local/bin/bee-tui ]; then - export BEE_TUI_AUTO_LAUNCHED=1 - /usr/local/bin/bee-tui -fi diff --git a/iso/overlay-debug/root/.ssh/.gitkeep b/iso/overlay-debug/root/.ssh/.gitkeep deleted file mode 100644 index e69de29..0000000 diff --git a/iso/overlay-debug/usr/local/bin/bee-net-restart b/iso/overlay-debug/usr/local/bin/bee-net-restart deleted file mode 100644 index 5c9147c..0000000 --- a/iso/overlay-debug/usr/local/bin/bee-net-restart +++ /dev/null @@ -1,8 +0,0 @@ -#!/bin/sh -# bee-net-restart.sh — bring up all physical interfaces via DHCP (manual re-run) - -for iface in $(ip -o link show | awk -F': ' '{print $2}' | grep -v '^lo$' | grep -vE '^(docker|virbr|veth|tun|tap|br-|bond|dummy)'); do - echo "[$iface] bringing up..." - ip link set "$iface" up 2>/dev/null - udhcpc -i "$iface" -t 5 -T 3 -done diff --git a/iso/overlay-debug/usr/local/bin/bee-network.sh b/iso/overlay-debug/usr/local/bin/bee-network.sh deleted file mode 100644 index c1baa86..0000000 --- a/iso/overlay-debug/usr/local/bin/bee-network.sh +++ /dev/null @@ -1,31 +0,0 @@ -#!/bin/sh -# bee-network.sh — bring up all physical network interfaces via DHCP -# Unattended: runs silently, logs results, never blocks. - -LOG_PREFIX="bee-network" - -log() { echo "[$LOG_PREFIX] $*"; } - -# find physical interfaces: exclude lo and virtual (docker/virbr/veth/tun/tap) -interfaces=$(ip -o link show \ - | awk -F': ' '{print $2}' \ - | grep -v '^lo$' \ - | grep -vE '^(docker|virbr|veth|tun|tap|br-|bond|dummy)' \ - | sort) - -if [ -z "$interfaces" ]; then - log "no physical interfaces found" - exit 0 -fi - -for iface in $interfaces; do - log "bringing up $iface" - ip link set "$iface" up 2>/dev/null || { log "WARN: could not bring up $iface"; continue; } - - # DHCP in background: -b forks if no immediate lease, & ensures non-blocking always. - # -t 0: unlimited retries, -T 3: 3s per attempt. No -q: stay running to renew lease. - udhcpc -i "$iface" -b -t 0 -T 3 & - log "DHCP started for $iface (pid $!)" -done - -log "done" diff --git a/iso/overlay-debug/usr/local/bin/bee-tui b/iso/overlay-debug/usr/local/bin/bee-tui deleted file mode 100755 index cd08942..0000000 --- a/iso/overlay-debug/usr/local/bin/bee-tui +++ /dev/null @@ -1,581 +0,0 @@ -#!/bin/sh -# bee-tui: interactive text menu for debug LiveCD operations. - -set -u - -if ! command -v dialog >/dev/null 2>&1; then - echo "ERROR: dialog is required but not installed" - exit 1 -fi - -pause() { - echo - printf 'Press Enter to continue... ' - read -r _ -} - -header() { - clear - echo "==============================================" - echo " bee TUI (debug)" - echo "==============================================" - echo -} - -menu_choice() { - title="$1" - prompt="$2" - shift 2 - dialog --clear --stdout --title "$title" --menu "$prompt" 20 90 12 "$@" -} - -list_ifaces() { - ip -o link show \ - | awk -F': ' '{print $2}' \ - | grep -v '^lo$' \ - | grep -vE '^(docker|virbr|veth|tun|tap|br-|bond|dummy)' \ - | sort -} - -show_network_status() { - header - echo "Network interfaces" - echo - for iface in $(list_ifaces); do - state=$(ip -o link show "$iface" | awk '{print $9}') - ipv4=$(ip -o -4 addr show dev "$iface" | awk '{print $4}' | paste -sd ',') - [ -n "$ipv4" ] || ipv4="(no IPv4)" - echo "- $iface: state=$state ip=$ipv4" - done - echo - ip route | sed 's/^/ route: /' - pause -} - -choose_interface() { - ifaces="$(list_ifaces)" - if [ -z "$ifaces" ]; then - echo "No physical interfaces found" - return 1 - fi - - set -- - for iface in $ifaces; do - set -- "$@" "$iface" "$iface" - done - iface=$(menu_choice "Network" "Select interface" "$@") || return 1 - - CHOSEN_IFACE="$iface" - return 0 -} - -network_dhcp_one() { - header - echo "DHCP on one interface" - echo - choose_interface || { pause; return; } - - iface="$CHOSEN_IFACE" - echo - echo "Starting DHCP on $iface..." - ip link set "$iface" up 2>/dev/null || true - udhcpc -i "$iface" -t 5 -T 3 - pause -} - -network_dhcp_all() { - header - echo "Restarting DHCP on all physical interfaces..." - echo - /usr/local/bin/bee-net-restart - pause -} - -network_static_one() { - header - echo "Static IPv4 setup" - echo - choose_interface || { pause; return; } - - iface="$CHOSEN_IFACE" - echo - printf 'IPv4 address (example 192.168.1.10): ' - read -r ip - if [ -z "$ip" ]; then - echo "IP address is required" - pause - return - fi - - printf 'Netmask (example 24 or 255.255.255.0): ' - read -r mask - if [ -z "$mask" ]; then - echo "Netmask is required" - pause - return - fi - prefix=$(mask_to_prefix "$mask") - if [ -z "$prefix" ]; then - echo "Invalid netmask: $mask" - pause - return - fi - cidr="$ip/$prefix" - - printf 'Default gateway: ' - read -r gw - if [ -z "$gw" ]; then - echo "Default gateway is required" - pause - return - fi - printf 'DNS server (optional): ' - read -r dns - - ip link set "$iface" up 2>/dev/null || true - ip addr flush dev "$iface" - if ! ip addr add "$cidr" dev "$iface"; then - echo "Failed to set IP" - pause - return - fi - - if [ -n "$gw" ]; then - ip route del default >/dev/null 2>&1 || true - ip route add default via "$gw" dev "$iface" - fi - - if [ -n "$dns" ]; then - printf 'nameserver %s\n' "$dns" > /etc/resolv.conf - fi - - echo - echo "Static config applied to $iface" - pause -} - -mask_to_prefix() { - mask="$(echo "$1" | tr -d '[:space:]')" - case "$mask" in - 0|1|2|3|4|5|6|7|8|9|10|11|12|13|14|15|16|17|18|19|20|21|22|23|24|25|26|27|28|29|30|31|32) - echo "$mask" - return 0 - ;; - esac - case "$mask" in - 255.0.0.0) echo 8 ;; - 255.128.0.0) echo 9 ;; - 255.192.0.0) echo 10 ;; - 255.224.0.0) echo 11 ;; - 255.240.0.0) echo 12 ;; - 255.248.0.0) echo 13 ;; - 255.252.0.0) echo 14 ;; - 255.254.0.0) echo 15 ;; - 255.255.0.0) echo 16 ;; - 255.255.128.0) echo 17 ;; - 255.255.192.0) echo 18 ;; - 255.255.224.0) echo 19 ;; - 255.255.240.0) echo 20 ;; - 255.255.248.0) echo 21 ;; - 255.255.252.0) echo 22 ;; - 255.255.254.0) echo 23 ;; - 255.255.255.0) echo 24 ;; - 255.255.255.128) echo 25 ;; - 255.255.255.192) echo 26 ;; - 255.255.255.224) echo 27 ;; - 255.255.255.240) echo 28 ;; - 255.255.255.248) echo 29 ;; - 255.255.255.252) echo 30 ;; - 255.255.255.254) echo 31 ;; - 255.255.255.255) echo 32 ;; - *) return 1 ;; - esac -} - -network_menu() { - while true; do - choice=$(menu_choice "Network" "Select action" \ - "1" "Show network status" \ - "2" "DHCP on all interfaces" \ - "3" "DHCP on one interface" \ - "4" "Set static IPv4 on one interface" \ - "5" "Back") || return - - case "$choice" in - 1) show_network_status ;; - 2) network_dhcp_all ;; - 3) network_dhcp_one ;; - 4) network_static_one ;; - 5) return ;; - *) echo "Invalid choice"; pause ;; - esac - done -} - -bee_services_list() { - for path in /etc/init.d/bee-*; do - [ -e "$path" ] || continue - basename "$path" - done -} - -services_status_all() { - header - echo "bee service status" - echo - for svc in $(bee_services_list); do - if rc-service "$svc" status >/dev/null 2>&1; then - echo "- $svc: running" - else - echo "- $svc: stopped" - fi - done - pause -} - -choose_service() { - svcs="$(bee_services_list)" - if [ -z "$svcs" ]; then - echo "No bee-* services found" - return 1 - fi - - set -- - for svc in $svcs; do - set -- "$@" "$svc" "$svc" - done - svc=$(menu_choice "bee Services" "Select service" "$@") || return 1 - - CHOSEN_SERVICE="$svc" - return 0 -} - -service_action_menu() { - header - echo "Service action" - echo - choose_service || { pause; return; } - svc="$CHOSEN_SERVICE" - - act=$(menu_choice "Service: $svc" "Select action" \ - "1" "status" \ - "2" "restart" \ - "3" "start" \ - "4" "stop" \ - "5" "toggle start/stop" \ - "6" "Back") || return - - case "$act" in - 1) rc-service "$svc" status || true ;; - 2) rc-service "$svc" restart || true ;; - 3) rc-service "$svc" start || true ;; - 4) rc-service "$svc" stop || true ;; - 5) - if rc-service "$svc" status >/dev/null 2>&1; then - rc-service "$svc" stop || true - else - rc-service "$svc" start || true - fi - ;; - 6) return ;; - *) echo "Invalid action" ;; - esac - pause -} - -services_menu() { - while true; do - choice=$(menu_choice "bee Services" "Select action" \ - "1" "Status of all bee-* services" \ - "2" "Manage one service (status/restart/start/stop/toggle)" \ - "3" "Back") || return - - case "$choice" in - 1) services_status_all ;; - 2) service_action_menu ;; - 3) return ;; - *) echo "Invalid choice"; pause ;; - esac - done -} - -confirm_phrase() { - phrase="$1" - prompt="$2" - echo - printf '%s (%s): ' "$prompt" "$phrase" - read -r value - [ "$value" = "$phrase" ] -} - -shutdown_menu() { - while true; do - choice=$(menu_choice "Shutdown/Reboot Tests" "Select action" \ - "1" "Reboot now" \ - "2" "Power off now" \ - "3" "Schedule poweroff in 60s" \ - "4" "Cancel scheduled shutdown" \ - "5" "IPMI chassis power status" \ - "6" "IPMI chassis power soft" \ - "7" "IPMI chassis power cycle" \ - "8" "Back") || return - - case "$choice" in - 1) - confirm_phrase "REBOOT" "Type confirmation" || { echo "Canceled"; pause; continue; } - reboot - ;; - 2) - confirm_phrase "POWEROFF" "Type confirmation" || { echo "Canceled"; pause; continue; } - poweroff - ;; - 3) - confirm_phrase "SCHEDULE" "Type confirmation" || { echo "Canceled"; pause; continue; } - shutdown -P +1 "bee test: scheduled poweroff in 60 seconds" - echo "Scheduled" - pause - ;; - 4) - shutdown -c || true - echo "Canceled (if any schedule existed)" - pause - ;; - 5) - ipmitool chassis power status || echo "ipmitool power status failed" - pause - ;; - 6) - confirm_phrase "IPMI-SOFT" "Type confirmation" || { echo "Canceled"; pause; continue; } - ipmitool chassis power soft || echo "ipmitool soft power failed" - pause - ;; - 7) - confirm_phrase "IPMI-CYCLE" "Type confirmation" || { echo "Canceled"; pause; continue; } - ipmitool chassis power cycle || echo "ipmitool power cycle failed" - pause - ;; - 8) - return - ;; - *) - echo "Invalid choice" - pause - ;; - esac - done -} - -gpu_burn_10m() { - header - echo "GPU Burn (10 minutes)" - echo - if ! command -v gpu_burn >/dev/null 2>&1; then - echo "gpu_burn binary not found in PATH" - echo "Expected command: gpu_burn" - pause - return - fi - if ! command -v nvidia-smi >/dev/null 2>&1 || ! nvidia-smi -L >/dev/null 2>&1; then - echo "NVIDIA driver/GPU not ready (nvidia-smi failed)" - pause - return - fi - - confirm_phrase "GPU-BURN" "Type confirmation to start benchmark" || { echo "Canceled"; pause; return; } - echo "Running: gpu_burn 600" - echo "Log: /var/log/bee-gpuburn.log" - gpu_burn 600 2>&1 | tee /var/log/bee-gpuburn.log - echo - echo "GPU Burn finished" - pause -} - -gpu_benchmarks_menu() { - while true; do - choice=$(menu_choice "Benchmarks -> GPU" "Select action" \ - "1" "GPU Burn (10 minutes)" \ - "2" "Back") || return - - case "$choice" in - 1) gpu_burn_10m ;; - 2) return ;; - *) echo "Invalid choice"; pause ;; - esac - done -} - -benchmarks_menu() { - while true; do - choice=$(menu_choice "Benchmarks" "Select category" \ - "1" "GPU" \ - "2" "Back") || return - - case "$choice" in - 1) gpu_benchmarks_menu ;; - 2) return ;; - *) echo "Invalid choice"; pause ;; - esac - done -} - -run_cmd_log() { - label="$1" - cmd="$2" - log_file="$3" - - { - echo "=== $label ===" - echo "time: $(date -u '+%Y-%m-%dT%H:%M:%SZ')" - echo "cmd: $cmd" - echo - sh -c "$cmd" - } >"$log_file" 2>&1 - return $? -} - -run_gpu_nvidia_acceptance_test() { - header - echo "System acceptance tests -> GPU NVIDIA" - echo - confirm_phrase "SAT-GPU" "Type confirmation to start tests" || { echo "Canceled"; pause; return; } - - ts="$(date -u '+%Y%m%d-%H%M%S')" - base_dir="/var/log/bee-sat" - run_dir="$base_dir/gpu-nvidia-$ts" - archive="$base_dir/gpu-nvidia-$ts.tar.gz" - mkdir -p "$run_dir" - - summary="$run_dir/summary.txt" - : >"$summary" - - echo "Running acceptance commands..." - echo "Logs directory: $run_dir" - echo "Archive target: $archive" - echo - - c1="nvidia-smi -q" - c2="dmidecode -t baseboard" - c3="dmidecode -t system" - c4="nvidia-bug-report.sh" - - run_cmd_log "nvidia_smi_q" "$c1" "$run_dir/01-nvidia-smi-q.log"; rc1=$? - run_cmd_log "dmidecode_baseboard" "$c2" "$run_dir/02-dmidecode-baseboard.log"; rc2=$? - run_cmd_log "dmidecode_system" "$c3" "$run_dir/03-dmidecode-system.log"; rc3=$? - run_cmd_log "nvidia_bug_report" "$c4" "$run_dir/04-nvidia-bug-report.log"; rc4=$? - - bug_report="$(ls -1 nvidia-bug-report.log.gz 2>/dev/null | head -n1 || true)" - if [ -n "$bug_report" ] && [ -f "$bug_report" ]; then - cp -f "$bug_report" "$run_dir/" - fi - - { - echo "run_at_utc=$(date -u '+%Y-%m-%dT%H:%M:%SZ')" - echo "cmd_nvidia_smi_q_rc=$rc1" - echo "cmd_dmidecode_baseboard_rc=$rc2" - echo "cmd_dmidecode_system_rc=$rc3" - echo "cmd_nvidia_bug_report_rc=$rc4" - } >>"$summary" - - tar -czf "$archive" -C "$base_dir" "gpu-nvidia-$ts" - tar_rc=$? - echo "archive_rc=$tar_rc" >>"$summary" - - echo - echo "Done." - echo "- Logs: $run_dir" - echo "- Archive: $archive (rc=$tar_rc)" - pause -} - -gpu_nvidia_sat_menu() { - while true; do - choice=$(menu_choice "System acceptance tests -> GPU NVIDIA" "Select action" \ - "1" "Run command pack" \ - "2" "Back") || return - - case "$choice" in - 1) run_gpu_nvidia_acceptance_test ;; - 2) return ;; - *) echo "Invalid choice"; pause ;; - esac - done -} - -system_acceptance_tests_menu() { - while true; do - choice=$(menu_choice "System acceptance tests" "Select category" \ - "1" "GPU NVIDIA" \ - "2" "Back") || return - - case "$choice" in - 1) gpu_nvidia_sat_menu ;; - 2) return ;; - *) echo "Invalid choice"; pause ;; - esac - done -} - -run_audit_now() { - header - echo "Run audit now" - echo - /usr/local/bin/audit --output stdout > /var/log/bee-audit.json 2>/var/log/bee-audit.log - rc=$? - if [ "$rc" -eq 0 ]; then - echo "Audit completed successfully" - else - echo "Audit finished with errors (rc=$rc)" - fi - echo "Logs: /var/log/bee-audit.log, /var/log/bee-audit.json" - pause -} - -check_required_tools() { - header - echo "Required tools check" - echo - for tool in dmidecode smartctl nvme ipmitool lspci audit nvidia-smi gpu_burn dialog; do - if command -v "$tool" >/dev/null 2>&1; then - echo "- $tool: OK ($(command -v "$tool"))" - else - echo "- $tool: MISSING" - fi - done - pause -} - -main_menu() { - while true; do - choice=$(menu_choice "Bee TUI (debug)" "Select action" \ - "1" "Network setup" \ - "2" "bee service management" \ - "3" "Shutdown/reboot tests" \ - "4" "Benchmarks" \ - "5" "System acceptance tests" \ - "6" "Run audit now" \ - "7" "Check required tools" \ - "8" "Show last audit log tail" \ - "9" "Exit to console") || exit 0 - - case "$choice" in - 1) network_menu ;; - 2) services_menu ;; - 3) shutdown_menu ;; - 4) benchmarks_menu ;; - 5) system_acceptance_tests_menu ;; - 6) run_audit_now ;; - 7) check_required_tools ;; - 8) - header - tail -n 40 /var/log/bee-audit.log 2>/dev/null || echo "No /var/log/bee-audit.log" - echo - tail -n 20 /var/log/bee-audit.json 2>/dev/null || true - pause - ;; - 9) exit 0 ;; - *) echo "Invalid choice"; pause ;; - esac - done -} - -main_menu