summaryrefslogtreecommitdiff
path: root/python/vyos/system/grub.py
diff options
context:
space:
mode:
authorJohn Estabrook <jestabro@vyos.io>2023-10-21 13:33:37 -0500
committerJohn Estabrook <jestabro@vyos.io>2023-12-16 20:37:10 -0600
commitbb1c98ae64667fdc4fba7a316671d16964fb024f (patch)
tree43ce153d3d211d973034e806b331ac7309517d87 /python/vyos/system/grub.py
parent06832e3cc962eb4f94afe5319e7416d68756dba9 (diff)
downloadvyos-1x-bb1c98ae64667fdc4fba7a316671d16964fb024f.tar.gz
vyos-1x-bb1c98ae64667fdc4fba7a316671d16964fb024f.zip
image: T4516: support for interoperability of legacy/new image tools
This commit allows management of system images with either new or legacy tools: 'add/delete/rename system image' and 'set default' are translated appropriately on booting between images with the old and new tools. Consequently, the warning of the initial commit of T4516 is dropped. (cherry picked from commit 96b65e90fbfa1fe63d97929ac86fc910abb0caa9)
Diffstat (limited to 'python/vyos/system/grub.py')
-rw-r--r--python/vyos/system/grub.py7
1 files changed, 4 insertions, 3 deletions
diff --git a/python/vyos/system/grub.py b/python/vyos/system/grub.py
index 47c674de8..9ac205c03 100644
--- a/python/vyos/system/grub.py
+++ b/python/vyos/system/grub.py
@@ -1,4 +1,4 @@
-# Copyright 2022 VyOS maintainers and contributors <maintainers@vyos.io>
+# Copyright 2023 VyOS maintainers and contributors <maintainers@vyos.io>
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
@@ -24,6 +24,7 @@ from vyos.system import disk
# Define variables
GRUB_DIR_MAIN: str = '/boot/grub'
+GRUB_CFG_MAIN: str = f'{GRUB_DIR_MAIN}/grub.cfg'
GRUB_DIR_VYOS: str = f'{GRUB_DIR_MAIN}/grub.cfg.d'
CFG_VYOS_HEADER: str = f'{GRUB_DIR_VYOS}/00-vyos-header.cfg'
CFG_VYOS_MODULES: str = f'{GRUB_DIR_VYOS}/10-vyos-modules-autoload.cfg'
@@ -181,8 +182,8 @@ def get_cfg_ver(root_dir: str = '') -> int:
if not root_dir:
root_dir = disk.find_persistence()
- cfg_ver: Union[str, None] = vars_read(f'{root_dir}/{CFG_VYOS_HEADER}').get(
- 'VYOS_CFG_VER')
+ cfg_ver: str = vars_read(f'{root_dir}/{CFG_VYOS_HEADER}').get(
+ 'VYOS_CFG_VER')
if cfg_ver:
cfg_ver_int: int = int(cfg_ver)
else: