deploy.sh: warn on netplan drift between repo and /etc/netplan

The 07-12 IPv6 fix sat in ap/50-van-wan.yaml for a day without ever being
copied to /etc/netplan/ or applied — deploy.sh deliberately skips netplan
(applying it flaps the uplinks) so nothing caught the gap. Now it diffs
the two and prints the manual deploy commands when they disagree.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
Andreas Wrede
2026-07-13 11:04:19 -04:00
co-authored by Claude Sonnet 5
parent 4aae62372e
commit daa545f15c
+19 -2
View File
@@ -2,12 +2,29 @@
# Deploy vanlink configs/scripts (Pi 4 "wan" port) to their system locations. # Deploy vanlink configs/scripts (Pi 4 "wan" port) to their system locations.
# Usage: cd ~/vanlink && sudo ./deploy.sh # Usage: cd ~/vanlink && sudo ./deploy.sh
# Idempotent. Netplan (wlan0 + Starlink NIC = NM-managed WANs; eth0 is a LAN # Idempotent. Netplan (wlan0 + Starlink NIC = NM-managed WANs; eth0 is a LAN
# port on br0) is NOT touched here — reference copy in ap/50-van-wan.yaml, # port on br0) is NOT deployed here — reference copy in ap/50-van-wan.yaml,
# applied once manually (apply flaps uplinks). # applied once manually (apply flaps uplinks). We do check it for drift below.
set -euo pipefail set -euo pipefail
cd "$(dirname "$(readlink -f "$0")")" cd "$(dirname "$(readlink -f "$0")")"
[ "$(id -u)" = 0 ] || { echo "Run with sudo (writes to /etc, /usr)."; exit 1; } [ "$(id -u)" = 0 ] || { echo "Run with sudo (writes to /etc, /usr)."; exit 1; }
echo "== netplan drift check =="
# Netplan is never installed by this script (applying it flaps the uplinks —
# see note below), so it's easy to edit ap/50-van-wan.yaml and forget the
# manual `netplan apply` step. Warn loudly rather than silently drifting.
if [ ! -f /etc/netplan/50-van-wan.yaml ]; then
echo " -> WARNING: /etc/netplan/50-van-wan.yaml is missing. Repo config"
echo " was never deployed to this system. Run manually:"
echo " sudo cp ap/50-van-wan.yaml /etc/netplan/50-van-wan.yaml"
echo " sudo netplan generate && sudo netplan apply"
elif ! diff -q ap/50-van-wan.yaml /etc/netplan/50-van-wan.yaml >/dev/null 2>&1; then
echo " -> WARNING: /etc/netplan/50-van-wan.yaml differs from ap/50-van-wan.yaml."
diff -u /etc/netplan/50-van-wan.yaml ap/50-van-wan.yaml || true
echo " Deploy the change manually:"
echo " sudo cp ap/50-van-wan.yaml /etc/netplan/50-van-wan.yaml"
echo " sudo netplan generate && sudo netplan apply"
fi
echo "== access point ==" echo "== access point =="
install -D -m0644 ap/hostapd.conf /etc/hostapd/hostapd.conf install -D -m0644 ap/hostapd.conf /etc/hostapd/hostapd.conf
install -D -m0644 ap/hostapd-restart.conf /etc/systemd/system/hostapd.service.d/restart.conf install -D -m0644 ap/hostapd-restart.conf /etc/systemd/system/hostapd.service.d/restart.conf