summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Breunig <christian@breunig.cc>2026-04-26 19:45:12 +0200
committerChristian Breunig <christian@breunig.cc>2026-04-26 21:04:47 +0200
commitcbdd40320a10f6020f9d4a265fbffcf8e60c307d (patch)
tree9ce2e4ff5fc8bdc69a9fc2d84bdd051c0af08897
parent8d13ffae3898c4b28d56fbfbf6c0b3afc137daac (diff)
downloadvyos-build-cbdd40320a10f6020f9d4a265fbffcf8e60c307d.tar.gz
vyos-build-cbdd40320a10f6020f9d4a265fbffcf8e60c307d.zip
hooks: T8541: inject flavor serial console settings once into config.boot.default
We do have different default console configurations per flavor used. We will set the serial console to the default configuration for the flavor once during ISO image assembly.
-rw-r--r--data/live-build-config/hooks/live/95-serial.chroot24
1 files changed, 24 insertions, 0 deletions
diff --git a/data/live-build-config/hooks/live/95-serial.chroot b/data/live-build-config/hooks/live/95-serial.chroot
new file mode 100644
index 00000000..1bcaa963
--- /dev/null
+++ b/data/live-build-config/hooks/live/95-serial.chroot
@@ -0,0 +1,24 @@
+#!/bin/sh
+
+# We do have different default console configurations per flavor used. We will
+# set the serial console to the default configuration for the flavor.
+WRITE_CONFIG="/usr/libexec/vyos/write-config-file-value.py"
+if ! test -x $WRITE_CONFIG; then
+ echo "E: missing script to implant serial config settings"
+ exit 1
+fi
+
+default_config_file=$(python3 -c 'from vyos.defaults import config_default; print(config_default)')
+device=$(jq -r '"\(.console_type)\(.console_num)"' /usr/share/vyos/flavor.json)
+speed=$(jq -r '.console_speed' /usr/share/vyos/flavor.json)
+
+if [ -n "$device" ] && [ -n "$speed" ] && [ -f $default_config_file ]; then
+ $WRITE_CONFIG --path "system console device $device speed" \
+ --value "$speed" \
+ --config-file $default_config_file
+ $WRITE_CONFIG --path "system console device $device kernel" \
+ --config-file $default_config_file
+else
+ echo "E: Could not implant serial console settings in: $default_config_file"
+ exit 1
+fi