Files
reterminal-dm4/emmc-provisioning/cloud-init/user-data.bootstrap
nearxos 16bfc1e0e1 Enhance cloud-init scripts and dashboard for improved USB boot functionality</message>
<message>Update the bootstrap script to ensure hostname resolution by adding entries to /etc/hosts, preventing "sudo: unable to resolve host" errors. Modify user-data.bootstrap to include the same hostname resolution logic. Revise dashboard templates to reflect the new project name "GNSS Guard Provisioning" and improve user interface elements related to USB boot operations, including clearer instructions and status messages. These changes enhance the overall user experience and streamline the provisioning process.
2026-02-24 08:50:32 +02:00

40 lines
1.5 KiB
Plaintext

#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:
# Ensure hostname resolves (avoids "sudo: unable to resolve host" when meta-data sets hostname)
- |
H="$(hostname)"
grep -q "127.0.1.1.*$H" /etc/hosts || echo "127.0.1.1 $H" >> /etc/hosts
- 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