Update first-boot.sh to set hostname and configure /etc/hosts for improved system identification; add fix-reterminal-display.sh for post-boot adjustments to splash screen and Plymouth theme; modify meta-data for instance identification; update app.py to reflect new local hostname.
This commit is contained in:
@@ -8,6 +8,7 @@ export DEBIAN_FRONTEND=noninteractive
|
||||
# --- Constants ---
|
||||
# All first-boot assets live in portal-files/first-boot/ on the file server.
|
||||
FILE_SERVER="http://10.130.60.141:5000/files/first-boot"
|
||||
HOSTNAME="gnss.guard"
|
||||
PI_USER="pi"
|
||||
PI_HOME="/home/$PI_USER"
|
||||
AUTOSTART="$PI_HOME/.config/autostart"
|
||||
@@ -21,6 +22,17 @@ exec > >(tee -a "$LOGFILE") 2>&1
|
||||
log "=== first-boot.sh started ==="
|
||||
log "FILE_SERVER=$FILE_SERVER PI_USER=$PI_USER LOGFILE=$LOGFILE"
|
||||
|
||||
# --- 0. Hostname and /etc/hosts (avoids "unable to resolve host" with sudo) ---
|
||||
log "--- Hostname: $HOSTNAME ---"
|
||||
echo "$HOSTNAME" > /etc/hostname
|
||||
hostnamectl set-hostname "$HOSTNAME" 2>/dev/null || true
|
||||
# Ensure hostname resolves so sudo and other tools don't warn
|
||||
if ! grep -q "127.0.1.1[[:space:]]*$HOSTNAME" /etc/hosts 2>/dev/null; then
|
||||
sed -i "/127.0.1.1[[:space:]].*$/d" /etc/hosts
|
||||
echo "127.0.1.1 $HOSTNAME" >> /etc/hosts
|
||||
fi
|
||||
log "Hostname set to $HOSTNAME; /etc/hosts updated"
|
||||
|
||||
# --- Helpers ---
|
||||
# Download script + .desktop from FILE_SERVER and install as one-shot autostart (runs once at pi's first login, then deletes itself).
|
||||
install_oneshot() {
|
||||
@@ -120,6 +132,26 @@ fi
|
||||
log "Removing $REPO_DIR"
|
||||
rm -rf "$REPO_DIR"
|
||||
|
||||
# --- 6b. Re-apply splash and display (Seeed script sets disable_splash=1 and can duplicate Plymouth theme) ---
|
||||
log "--- Re-applying boot splash and Plymouth theme ---"
|
||||
CFG_PATH="/boot/firmware/config.txt"
|
||||
[[ -f /boot/firmware/config.txt ]] || CFG_PATH="/boot/config.txt"
|
||||
if [[ -f "$CFG_PATH" ]]; then
|
||||
if grep -q '^disable_splash=1' "$CFG_PATH"; then
|
||||
sed -i 's/^disable_splash=1$/disable_splash=0/' "$CFG_PATH"
|
||||
log "Set disable_splash=0 so Plymouth splash is shown"
|
||||
fi
|
||||
fi
|
||||
# Ensure Plymouth uses our custom theme only (remove Theme=pix, set Theme=custom)
|
||||
if [[ -f /etc/plymouth/plymouthd.conf ]]; then
|
||||
sed -i '/^Theme=/d' /etc/plymouth/plymouthd.conf
|
||||
grep -q '^\[Daemon\]' /etc/plymouth/plymouthd.conf || echo '[Daemon]' >> /etc/plymouth/plymouthd.conf
|
||||
echo 'Theme=custom' >> /etc/plymouth/plymouthd.conf
|
||||
log "Plymouth theme set to custom only"
|
||||
fi
|
||||
log "Running update-initramfs to apply Plymouth theme ..."
|
||||
update-initramfs -u -k all 2>/dev/null || true
|
||||
|
||||
# --- 7. One-shots (rotation + wallpaper at first login) ---
|
||||
log "--- One-shot scripts (run at pi first login) ---"
|
||||
install_oneshot set-rotation-once || true
|
||||
|
||||
Reference in New Issue
Block a user