summaryrefslogtreecommitdiff
path: root/src/migration-scripts/system
diff options
context:
space:
mode:
authorChristian Breunig <christian@breunig.cc>2026-04-14 14:24:09 +0000
committerGitHub <noreply@github.com>2026-04-14 14:24:09 +0000
commit96573c5c3fa4a619819e808c4f8e7a8996cf7fe6 (patch)
treebfb63f8c4d25632a90cb3b58b69c137511656eea /src/migration-scripts/system
parent73f743d176f96affceab004c92d19b561f71a24e (diff)
parent35db941bcf30f3fac5b1358aa1124f34f9808950 (diff)
downloadvyos-1x-96573c5c3fa4a619819e808c4f8e7a8996cf7fe6.tar.gz
vyos-1x-96573c5c3fa4a619819e808c4f8e7a8996cf7fe6.zip
Merge pull request #5092 from c-po/kernel-serial-activation
serial: T8375: use boot activation script to define a serial console on the CLI
Diffstat (limited to 'src/migration-scripts/system')
-rw-r--r--src/migration-scripts/system/31-to-3238
1 files changed, 38 insertions, 0 deletions
diff --git a/src/migration-scripts/system/31-to-32 b/src/migration-scripts/system/31-to-32
new file mode 100644
index 000000000..1688b44ed
--- /dev/null
+++ b/src/migration-scripts/system/31-to-32
@@ -0,0 +1,38 @@
+# Copyright (C) VyOS Inc.
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License, or (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public License
+# along with this library. If not, see <http://www.gnu.org/licenses/>.
+
+# Serial
+
+from vyos.configtree import ConfigTree
+from vyos.system import disk
+from vyos.system.grub import CFG_VYOS_VARS
+from vyos.system.grub import vars_read
+
+serial_console = 'ttyS0'
+base = ['system', 'console']
+
+def migrate(config: ConfigTree) -> None:
+ if not base:
+ return
+
+ root_dir = disk.find_persistence()
+ vars_file: str = f'{root_dir}/{CFG_VYOS_VARS}'
+ vars_current: dict[str, str] = vars_read(vars_file)
+ # Check if VyOS installation uses serial boot console
+ if vars_current['console_type'] == 'ttyS':
+ # In the past we only supported ttyS0 as boot console, that's why we
+ # can hardcode it ...
+ if config.exists(base + ['device', serial_console]):
+ config.set(base + ['device', serial_console, 'kernel'])