fix: add interfaces file so networking starts, enable dropbear default

This commit is contained in:
2026-03-05 14:47:21 +03:00
parent aa051266bb
commit 569bbf8909

View File

@@ -1,42 +1,28 @@
#!/bin/sh -e
# genapkovl-bee_debug.sh — generate apkovl for bee debug LiveCD
# Called by mkimage.sh: receives hostname as , must create .apkovl.tar.gz
HOSTNAME="$1"
if [ -z "$HOSTNAME" ]; then
echo "usage: $0 hostname"
exit 1
fi
[ -n "$HOSTNAME" ] || { echo "usage: $0 hostname"; exit 1; }
OVERLAY="${BEE_OVERLAY_DIR}"
if [ -z "$OVERLAY" ]; then
echo "ERROR: BEE_OVERLAY_DIR not set"
exit 1
fi
[ -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"
}
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"; }
rc_add() {
mkdir -p "$tmp/etc/runlevels/$2"
ln -sf /etc/init.d/"$1" "$tmp/etc/runlevels/$2/$1"
}
# --- hostname ---
mkdir -p "$tmp/etc"
makefile root:root 0644 "$tmp/etc/hostname" <<EOF
$HOSTNAME
EOF
# --- packages to install at boot ---
# Empty interfaces file — prevents ifupdown from erroring, bee-network handles DHCP
mkdir -p "$tmp/etc/network"
makefile root:root 0644 "$tmp/etc/network/interfaces" <<EOF
auto lo
iface lo inet loopback
EOF
mkdir -p "$tmp/etc/apk"
makefile root:root 0644 "$tmp/etc/apk/world" <<EOF
alpine-base
@@ -61,7 +47,6 @@ less
vim
EOF
# --- standard sysinit/boot/shutdown services ---
rc_add devfs sysinit
rc_add dmesg sysinit
rc_add mdev sysinit
@@ -79,23 +64,16 @@ rc_add mount-ro shutdown
rc_add killprocs shutdown
rc_add savecache shutdown
# --- bee services ---
for svc in bee-sshsetup bee-network dropbear bee-audit-debug; do
rc_add "$svc" default
done
rc_add bee-sshsetup default
rc_add bee-network default
rc_add dropbear default
rc_add bee-audit-debug default
# --- copy overlay etc/ (init.d scripts, motd, etc.) ---
if [ -d "$OVERLAY/etc" ]; then
cp -r "$OVERLAY/etc/." "$tmp/etc/"
fi
if [ -d "$OVERLAY/etc" ]; then cp -r "$OVERLAY/etc/." "$tmp/etc/"; fi
# --- copy overlay usr/ (bee-network.sh, audit binary) ---
if [ -d "$OVERLAY/usr" ]; then
mkdir -p "$tmp/usr"
cp -r "$OVERLAY/usr/." "$tmp/usr/"
fi
mkdir -p "$tmp/usr"
if [ -d "$OVERLAY/usr" ]; then cp -r "$OVERLAY/usr/." "$tmp/usr/"; fi
# --- copy root/.ssh/authorized_keys if present ---
if [ -d "$OVERLAY/root" ]; then
mkdir -p "$tmp/root"
cp -r "$OVERLAY/root/." "$tmp/root/"
@@ -103,7 +81,6 @@ if [ -d "$OVERLAY/root" ]; then
chmod 600 "$tmp/root/.ssh/authorized_keys" 2>/dev/null || true
fi
# --- dropbear: enable root login ---
mkdir -p "$tmp/etc/dropbear" "$tmp/etc/conf.d"
makefile root:root 0644 "$tmp/etc/conf.d/dropbear" <<EOF
DROPBEAR_OPTS="-R"