summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMaxim Devaev <[email protected]>2021-11-08 04:25:29 +0300
committerMaxim Devaev <[email protected]>2021-11-08 04:25:29 +0300
commitfde4539e36f332cc208d4201b02f00eb4a3d8089 (patch)
treed592e0823f2e0f9ff30733ca225924e3336b6225
parent6f56c40436ee2fc032069a6618c4d3cad7920665 (diff)
pikvm/pikvm#73: run custom bootconfig scripts from /etc/kvmd/bootconfig.d
-rw-r--r--PKGBUILD2
-rwxr-xr-xscripts/kvmd-bootconfig13
2 files changed, 11 insertions, 4 deletions
diff --git a/PKGBUILD b/PKGBUILD
index 54025cc3..5bc2c2a6 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -154,7 +154,7 @@ package_kvmd() {
install -Dm644 -t "$pkgdir/etc/kvmd" "$_cfg_default/kvmd"/*.yaml
install -Dm600 -t "$pkgdir/etc/kvmd" "$_cfg_default/kvmd"/*passwd
install -Dm644 -t "$pkgdir/etc/kvmd" "$_cfg_default/kvmd"/web.css
- mkdir -p "$pkgdir/etc/kvmd/override.d"
+ mkdir -p "$pkgdir/etc/kvmd/"{override.d,bootconfig.d}
mkdir -p "$pkgdir/var/lib/kvmd/msd"
diff --git a/scripts/kvmd-bootconfig b/scripts/kvmd-bootconfig
index d22d1845..98bcb4a4 100755
--- a/scripts/kvmd-bootconfig
+++ b/scripts/kvmd-bootconfig
@@ -92,7 +92,7 @@ TTYVHangup=no
TTYVTDisallocate=no
end_of_file
systemctl enable [email protected]
- REBOOT=1
+ touch /boot/pikvm-reboot.txt
fi
@@ -130,16 +130,23 @@ ClientIdentifier=mac
end_of_file
wpa_passphrase "$WIFI_ESSID" "$WIFI_PASSWD" > "/etc/wpa_supplicant/wpa_supplicant-$WIFI_IFACE.conf"
systemctl enable "wpa_supplicant@$WIFI_IFACE.service" || true
- REBOOT=1
+ touch /boot/pikvm-reboot.txt
fi
+# ========== Custom scripts ==========
+for script in `ls /etc/kvmd/bootconfig.d | sort`; do
+ /etc/kvmd/bootconfig.d/"$script" || true
+done
+
+
# ========== Finish ==========
rm -f /boot/pikvm.txt
ro
-if [ -n "$REBOOT" ]; then
+if [ -f /boot/pikvm-reboot.txt ]; then
+ rm -f /boot/pikvm-reboot.txt
echo "kvmd-bootconfig: Reboot after 5 seconds" | tee /dev/kmsg
sleep 2
reboot