diff options
author | Daniil Baturin <daniil@vyos.io> | 2024-01-16 22:54:20 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-01-16 22:54:20 +0000 |
commit | bf08f0f2538b5068ff1a41b51dac832b04a7d4be (patch) | |
tree | c8b8babd8e5d812a0f323dd40c1b1689c4530dde /src | |
parent | 0249dc59b5adf095d9833cde42d8649ad299d717 (diff) | |
parent | 5ceaff2ef970cb9c567ac317bafbffca5b073f4a (diff) | |
download | vyos-1x-bf08f0f2538b5068ff1a41b51dac832b04a7d4be.tar.gz vyos-1x-bf08f0f2538b5068ff1a41b51dac832b04a7d4be.zip |
Merge pull request #2818 from jestabro/serial-console-config-mode
image-tools: T5923: update system_console.py for new GRUB file structure
Diffstat (limited to 'src')
-rwxr-xr-x | src/conf_mode/system_console.py | 26 | ||||
-rw-r--r-- | src/system/grub_update.py | 2 |
2 files changed, 3 insertions, 25 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 diff --git a/src/system/grub_update.py b/src/system/grub_update.py index 4d5e0b6ae..5a7d8eb72 100644 --- a/src/system/grub_update.py +++ b/src/system/grub_update.py @@ -69,7 +69,7 @@ if __name__ == '__main__': 'bootmode': default_entry['bootmode'], 'console_type': default_entry['console_type'], 'console_num': default_entry['console_num'], - 'console_speed': '115200' + 'console_speed': default_entry['console_speed'] } vars.update(default_settings) |