From fbf4060946363f590119ccdba10e617b010a005d Mon Sep 17 00:00:00 2001 From: "juvenal.diaz" Date: Sat, 24 Oct 2026 09:06:56 -0600 Subject: [PATCH] feat: make RPi4 bootstrap fully orchestrated --- lib/jeannie/commands.sh | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/lib/jeannie/commands.sh b/lib/jeannie/commands.sh index 812acc4..ff5a7a2 100644 --- a/lib/jeannie/commands.sh +++ b/lib/jeannie/commands.sh @@ -97,24 +97,25 @@ EOF echo "Refusing RPi4 OS/bootstrap changes without --yes." >&2 return 2 fi - if [[ -z "${LAB_RPI4_OS_PROVISIONER_COMMAND:-}" ]]; then - echo "LAB_RPI4_OS_PROVISIONER_COMMAND is required for RPi4 OS installation; refusing to guess a disk or boot target." >&2 - return 2 - fi if [[ "${LAB_RPI4_INSTALL_DEVICE:-/dev/mmcblk0}" != "/dev/mmcblk0" ]]; then echo "RPi4 installs are fixed to /dev/mmcblk0; refusing a different target." >&2 return 2 fi - if ssh -i "${rpi_key}" -o BatchMode=yes -o ConnectTimeout=10 -o StrictHostKeyChecking=accept-new \ - "${rpi_user}@${rpi_host}" "test \"\$(findmnt -no SOURCE /)\" != \"${LAB_RPI4_INSTALL_DEVICE}\""; then - : + if [[ -n "${LAB_RPI4_OS_PROVISIONER_COMMAND:-}" ]]; then + if ssh -i "${rpi_key}" -o BatchMode=yes -o ConnectTimeout=10 -o StrictHostKeyChecking=accept-new \ + "${rpi_user}@${rpi_host}" "test \"\$(findmnt -no SOURCE /)\" != \"${LAB_RPI4_INSTALL_DEVICE}\""; then + : + else + echo "Refusing to image ${LAB_RPI4_INSTALL_DEVICE}: it is still the RPi4 root filesystem. Boot the Pi from the Debian NFS staging root first." >&2 + return 2 + fi + echo "Running the configured RPi4 OS provisioner..." + export LAB_RPI4_OS_IMAGE_NAME="${rpi_os_image}" LAB_RPI4_OS_IMAGE_URL="${rpi_os_url}" + bash -lc "${LAB_RPI4_OS_PROVISIONER_COMMAND}" else - echo "Refusing to image ${LAB_RPI4_INSTALL_DEVICE}: it is still the RPi4 root filesystem. Boot the Pi from the Debian NFS staging root first." >&2 - return 2 + "${REPO_ROOT}/scripts/rpi4-nfs-stage" apply --yes + "${REPO_ROOT}/scripts/rpi4-image-install" apply --yes fi - echo "Running the configured RPi4 OS provisioner..." - export LAB_RPI4_OS_IMAGE_NAME="${rpi_os_image}" LAB_RPI4_OS_IMAGE_URL="${rpi_os_url}" - bash -lc "${LAB_RPI4_OS_PROVISIONER_COMMAND}" check_rpi_ssh deploy_rpi_services ;;