Refactor golden image handling in backup upload process</message>
<message>Update the _set_golden_from_path function to improve the handling of existing golden image files. Replace the existing unlink logic with a more robust method that safely removes files or broken symlinks using the missing_ok parameter. This change enhances the reliability of the backup upload process by ensuring that stale references are properly cleared before setting a new golden image path.
This commit is contained in:
35
emmc-provisioning/cloud-init/user-data.bootstrap
Normal file
35
emmc-provisioning/cloud-init/user-data.bootstrap
Normal file
@@ -0,0 +1,35 @@
|
||||
#cloud-config
|
||||
# Minimal user-data: download bootstrap.sh from your file server and run it at first boot.
|
||||
#
|
||||
# 1. Host bootstrap.sh at a URL reachable from the device on first boot (e.g. your
|
||||
# provisioning portal or file server). Example: http://10.20.50.1:5000/files/bootstrap.sh
|
||||
# 2. Copy this file to the boot partition as "user-data" (with meta-data and optional network-config).
|
||||
# 3. Edit BOOTSTRAP_URL below to match your server (or set it once in the runcmd section).
|
||||
|
||||
package_update: true
|
||||
package_upgrade: false
|
||||
|
||||
packages:
|
||||
- curl
|
||||
|
||||
# Ensure SSH is enabled and password auth allowed so you can log in after first boot
|
||||
write_files:
|
||||
- path: /etc/ssh/sshd_config.d/99-cloud-init.conf
|
||||
content: |
|
||||
PasswordAuthentication yes
|
||||
PermitRootLogin no
|
||||
|
||||
runcmd:
|
||||
- systemctl enable ssh
|
||||
- systemctl start ssh
|
||||
# Download and run bootstrap script (edit URL to match your file server)
|
||||
- |
|
||||
BOOTSTRAP_URL="http://10.20.50.1:5000/files/bootstrap.sh"
|
||||
LOG="/var/log/cloud-init-bootstrap.log"
|
||||
if ! curl -fsSL "$BOOTSTRAP_URL" -o /tmp/bootstrap.sh 2>>"$LOG" || [ ! -s /tmp/bootstrap.sh ]; then
|
||||
echo "$(date -Iseconds) ERROR: Failed to download bootstrap.sh from $BOOTSTRAP_URL (file missing or empty)" >> "$LOG"
|
||||
exit 0
|
||||
fi
|
||||
chmod +x /tmp/bootstrap.sh
|
||||
/tmp/bootstrap.sh
|
||||
- cloud-init single --name cc_final_message
|
||||
Reference in New Issue
Block a user