diff options
| -rw-r--r-- | data/live-build-config/hooks/live/95-serial.chroot | 24 |
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 |
