Update cloud-init scripts and documentation for enhanced DNS management and provisioning steps</message>

<message>Modify the first-boot.sh script to include an additional step for managing screen brightness during the provisioning process. Update user-data.bootstrap to improve DNS configuration by ensuring NetworkManager manages /etc/resolv.conf correctly, and remove obsolete scripts related to systemd-resolved. Enhance documentation to reflect these changes and clarify the setup process for users, improving overall network boot functionality and user experience.
This commit is contained in:
nearxos
2026-03-06 14:45:23 +02:00
parent 8233304ee2
commit 0844adbcbe
22 changed files with 2021 additions and 86 deletions

View File

@@ -12,11 +12,15 @@
# ├── 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
# ── screen-brightness.pymanual deploy: .../files/screen-brightness.py
# ├── screen-brightness.service
# ├── screen-brightness.conf
# └── first-boot/ ← FILE_SERVER points here (first-boot + step 14)
# ├── steps/
# │ ├── 01-hostname.sh … 13-reboot.sh
# │ ├── 01-hostname.sh … 14-screen_brightness.sh
# ├── start-chromium.sh
# ├── splash.png
# ├── screen-brightness.py (and .service, .conf)
# └── ...
#
# Usage: ./sync-portal-files-to-lxc.sh [user@lxc_ip]
@@ -34,6 +38,10 @@ 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 bootstrap.sh)
# Files from fileserver/ that we also copy to portal root so /files/<name> works
# (e.g. manual deploy: sudo ./deploy-screen-brightness-to-device.sh "http://HOST:5000/files")
FILESERVER_FILES_AT_PORTAL_ROOT=(screen-brightness.py screen-brightness.service screen-brightness.conf)
# ── Validate local files ────────────────────────────────────────────────
if [[ ! -d "$FILESERVER_DIR" ]]; then
echo "Error: fileserver dir not found: $FILESERVER_DIR"
@@ -67,6 +75,13 @@ for f in "${PORTAL_ROOT_FILES[@]}"; do
echo "$f (not found locally, will skip)"
fi
done
for f in "${FILESERVER_FILES_AT_PORTAL_ROOT[@]}"; do
if [[ -f "$FILESERVER_DIR/$f" ]]; then
echo "$f (from fileserver/)"
else
echo "$f (not in fileserver/, will skip portal root copy)"
fi
done
echo ""
echo "first-boot/ assets ($REMOTE_FIRST_BOOT/):"
CHANGES=$(rsync -avzn --delete "$FILESERVER_DIR/" "$LXC:$REMOTE_FIRST_BOOT/" 2>&1 | grep -v '^\(sending\|sent\|total\|$\|building\|\.d\.\.\.\.\.\.\.\.\.\)' | head -40)
@@ -98,12 +113,23 @@ echo ""
echo "── Syncing fileserver/ → first-boot/ ──────────────────────────"
rsync -avz --delete "$FILESERVER_DIR/" "$LXC:$REMOTE_FIRST_BOOT/"
# ── Copy screen-brightness (and similar) from fileserver to portal root ───
# So http://HOST:5000/files/screen-brightness.py works for manual deploy
echo ""
echo "── Copying fileserver files to portal root ───────────────────"
for f in "${FILESERVER_FILES_AT_PORTAL_ROOT[@]}"; do
if [[ -f "$FILESERVER_DIR/$f" ]]; then
rsync -avz "$FILESERVER_DIR/$f" "$LXC:$REMOTE_PORTAL/"
echo "$f"
fi
done
# ── Check for extra files in portal root ────────────────────────────────
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 -u)
EXPECTED_FILES=$(printf '%s\n' "${PORTAL_ROOT_FILES[@]}" "${FILESERVER_FILES_AT_PORTAL_ROOT[@]}" "first-boot" | sort -u)
EXTRA_FILES=$(comm -23 <(echo "$REMOTE_FILES") <(echo "$EXPECTED_FILES"))
if [[ -z "$EXTRA_FILES" ]]; then