Add DHCP network boot management to API and UI
Enhance the dashboard API with new endpoints for managing DHCP network boot options, allowing devices to enable or disable network boot via POST requests. Update the device action handling to include a 'reboot' action, specifically for network devices. Modify the home.html template to display the current state of network boot and provide a button for disabling it. Update provisioning scripts to disable network boot after deployment or backup completion, ensuring devices boot from eMMC on the next startup. Improve user feedback and error handling throughout the changes.
This commit is contained in:
5
emmc-provisioning/lxc/dnsmasq-network-boot-pxe.conf
Normal file
5
emmc-provisioning/lxc/dnsmasq-network-boot-pxe.conf
Normal file
@@ -0,0 +1,5 @@
|
||||
# PXE/network-boot DHCP options (option 66 = next-server, 67 = boot file).
|
||||
# When this file is present, dnsmasq advertises network boot; when removed, devices get DHCP only and boot from local storage.
|
||||
# Toggle with: /opt/cm4-provisioning/toggle-network-boot-dhcp.sh enable|disable
|
||||
dhcp-option=66,10.20.50.1
|
||||
dhcp-option=67,start4cd.elf
|
||||
@@ -12,11 +12,7 @@ dhcp-range=10.20.50.100,10.20.50.200,12h
|
||||
# TFTP for Raspberry Pi / CM4 network boot
|
||||
enable-tftp
|
||||
tftp-root=/srv/tftpboot
|
||||
|
||||
# RPi 4 netboot: next-server is this host; boot filename (Pi firmware uses this)
|
||||
# Option 66 = next-server (TFTP), 67 = boot filename
|
||||
dhcp-option=66,10.20.50.1
|
||||
dhcp-option=67,start4cd.elf
|
||||
# PXE options (66/67) are in network-boot-pxe.conf; remove that file to disable netboot advertising
|
||||
|
||||
# Logging (optional; disable in production if too noisy)
|
||||
log-dhcp
|
||||
|
||||
36
emmc-provisioning/lxc/toggle-network-boot-dhcp.sh
Normal file
36
emmc-provisioning/lxc/toggle-network-boot-dhcp.sh
Normal file
@@ -0,0 +1,36 @@
|
||||
#!/usr/bin/env bash
|
||||
# Enable or disable DHCP network-boot options (option 66/67) on the provisioning LXC.
|
||||
# Does not stop the DHCP server or TFTP; only stops advertising netboot so devices boot from local storage.
|
||||
# Usage: toggle-network-boot-dhcp.sh enable | disable
|
||||
# Run as root (or with sudo). Install to /opt/cm4-provisioning/toggle-network-boot-dhcp.sh
|
||||
|
||||
set -e
|
||||
PXE_CONF="/etc/dnsmasq.d/network-boot-pxe.conf"
|
||||
SNIPPET_CONTENT="# PXE options - do not edit; managed by toggle-network-boot-dhcp.sh
|
||||
dhcp-option=66,10.20.50.1
|
||||
dhcp-option=67,start4cd.elf
|
||||
"
|
||||
|
||||
case "${1:-}" in
|
||||
enable)
|
||||
echo "$SNIPPET_CONTENT" > "$PXE_CONF"
|
||||
systemctl reload dnsmasq 2>/dev/null || service dnsmasq reload 2>/dev/null || true
|
||||
echo "Network boot (DHCP options) enabled."
|
||||
;;
|
||||
disable)
|
||||
rm -f "$PXE_CONF"
|
||||
systemctl reload dnsmasq 2>/dev/null || service dnsmasq reload 2>/dev/null || true
|
||||
echo "Network boot (DHCP options) disabled. Devices will get DHCP but boot from local storage."
|
||||
;;
|
||||
status)
|
||||
if [ -f "$PXE_CONF" ]; then
|
||||
echo "enabled"
|
||||
else
|
||||
echo "disabled"
|
||||
fi
|
||||
;;
|
||||
*)
|
||||
echo "Usage: $0 enable | disable | status" >&2
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
Reference in New Issue
Block a user