From 59f8ebe61dedccd04d7474afe92cb7c43319534d Mon Sep 17 00:00:00 2001 From: nearxos Date: Tue, 24 Feb 2026 00:26:55 +0200 Subject: [PATCH] Remove obsolete bootstrap script and update example script for clarity Delete the existing bootstrap.sh script used for cloud-init first boot, as it is no longer needed. Update the bootstrap.sh.example script to provide clearer instructions for users on how to customize and deploy their own bootstrap script, ensuring better guidance for cloud-init integration. These changes streamline the provisioning process and enhance user experience. --- emmc-provisioning/cloud-init/{fileserver => }/bootstrap.sh | 0 emmc-provisioning/cloud-init/fileserver/bootstrap.sh.example | 4 ++-- emmc-provisioning/scripts/sync-portal-files-to-lxc.sh | 5 +++-- 3 files changed, 5 insertions(+), 4 deletions(-) rename emmc-provisioning/cloud-init/{fileserver => }/bootstrap.sh (100%) diff --git a/emmc-provisioning/cloud-init/fileserver/bootstrap.sh b/emmc-provisioning/cloud-init/bootstrap.sh similarity index 100% rename from emmc-provisioning/cloud-init/fileserver/bootstrap.sh rename to emmc-provisioning/cloud-init/bootstrap.sh diff --git a/emmc-provisioning/cloud-init/fileserver/bootstrap.sh.example b/emmc-provisioning/cloud-init/fileserver/bootstrap.sh.example index d76ff21..962cff1 100644 --- a/emmc-provisioning/cloud-init/fileserver/bootstrap.sh.example +++ b/emmc-provisioning/cloud-init/fileserver/bootstrap.sh.example @@ -1,7 +1,7 @@ #!/bin/bash # Example bootstrap script run by cloud-init at first boot. -# Copy to bootstrap.sh, edit as needed, and place in your portal files (e.g. first-boot/) -# so it is served at http://YOUR_SERVER:5000/files/bootstrap.sh +# Copy to cloud-init/bootstrap.sh; sync-portal-files-to-lxc.sh deploys it to the portal root, +# served at http://YOUR_SERVER:5000/files/bootstrap.sh (not under first-boot/). # # Cloud-init downloads this and runs it as root. Add your first-boot logic here: # - Install packages, apply config, run first-boot.sh from this repo, etc. diff --git a/emmc-provisioning/scripts/sync-portal-files-to-lxc.sh b/emmc-provisioning/scripts/sync-portal-files-to-lxc.sh index 6924aec..526cf23 100755 --- a/emmc-provisioning/scripts/sync-portal-files-to-lxc.sh +++ b/emmc-provisioning/scripts/sync-portal-files-to-lxc.sh @@ -11,6 +11,7 @@ # ├── first-boot.sh ← cloud-init runcmd downloads this # ├── first-boot.conf ← cloud-init runcmd downloads this (required) # ├── first-boot.conf.example ← reference +# ├── bootstrap.sh ← user-data.bootstrap downloads this (main path) # └── first-boot/ ← FILE_SERVER points here # ├── steps/ # │ ├── 01-hostname.sh … 13-reboot.sh @@ -31,7 +32,7 @@ REMOTE_PORTAL="/var/lib/cm4-provisioning/portal-files" REMOTE_FIRST_BOOT="${REMOTE_PORTAL}/first-boot" # Files we sync to the portal root (outside first-boot/) -PORTAL_ROOT_FILES=(first-boot.sh first-boot.conf first-boot.conf.example) +PORTAL_ROOT_FILES=(first-boot.sh first-boot.conf first-boot.conf.example bootstrap.sh) # ── Validate local files ──────────────────────────────────────────────── if [[ ! -d "$FILESERVER_DIR" ]]; then @@ -102,7 +103,7 @@ echo "" echo "── Checking for extra files in portal root ────────────────────" REMOTE_FILES=$(ssh "$LXC" "find $REMOTE_PORTAL -maxdepth 1 -not -path $REMOTE_PORTAL -printf '%f\n' 2>/dev/null" | sort) -EXPECTED_FILES=$(printf '%s\n' "${PORTAL_ROOT_FILES[@]}" "first-boot" | sort) +EXPECTED_FILES=$(printf '%s\n' "${PORTAL_ROOT_FILES[@]}" "first-boot" | sort -u) EXTRA_FILES=$(comm -23 <(echo "$REMOTE_FILES") <(echo "$EXPECTED_FILES")) if [[ -z "$EXTRA_FILES" ]]; then