feat: make RPi4 bootstrap fully orchestrated

This commit is contained in:
juvenal.diaz 2026-10-24 09:06:56 -06:00
parent 7d8ed45707
commit fbf4060946
1 changed files with 13 additions and 12 deletions

View File

@ -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
;;