diff options
author | John Estabrook <jestabro@vyos.io> | 2024-01-16 23:52:13 -0600 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-01-16 23:52:13 -0600 |
commit | 31d3d7263ee3082bb7f7dd722086e2ce5c892a03 (patch) | |
tree | 62c525749ed7beb7e89a59a265893edfcb055a11 /src/conf_mode | |
parent | 6c39a9cb6df6bb56c02583f82d68edc8ef17241d (diff) | |
parent | 2afd5e5575a42bee4483e093e9611fa3363c8adc (diff) | |
download | vyos-1x-31d3d7263ee3082bb7f7dd722086e2ce5c892a03.tar.gz vyos-1x-31d3d7263ee3082bb7f7dd722086e2ce5c892a03.zip |
Merge pull request #2840 from vyos/mergify/bp/sagitta/pr-2818
image-tools: T5923: update system_console.py for new GRUB file structure (backport #2818)
Diffstat (limited to 'src/conf_mode')
-rwxr-xr-x | src/conf_mode/system_console.py | 26 |
1 files changed, 2 insertions, 24 deletions
diff --git a/src/conf_mode/system_console.py b/src/conf_mode/system_console.py index ebf9a113b..a888b125e 100755 --- a/src/conf_mode/system_console.py +++ b/src/conf_mode/system_console.py @@ -22,6 +22,7 @@ from vyos.config import Config from vyos.utils.process import call from vyos.utils.file import read_file from vyos.utils.file import write_file +from vyos.system import grub_util from vyos.template import render from vyos import ConfigError from vyos import airbag @@ -114,30 +115,7 @@ def generate(console): return None speed = console['device']['ttyS0']['speed'] - grub_config = '/boot/grub/grub.cfg' - if not os.path.isfile(grub_config): - return None - - lines = read_file(grub_config).split('\n') - p = re.compile(r'^(.* console=ttyS0),[0-9]+(.*)$') - write = False - newlines = [] - for line in lines: - if line.startswith('serial --unit'): - newline = f'serial --unit=0 --speed={speed}' - elif p.match(line): - newline = '{},{}{}'.format(p.search(line)[1], speed, p.search(line)[2]) - else: - newline = line - - if newline != line: - write = True - - newlines.append(newline) - newlines.append('') - - if write: - write_file(grub_config, '\n'.join(newlines)) + grub_util.update_console_speed(speed) return None |