summaryrefslogtreecommitdiff
path: root/python/vyos/system/compat.py
diff options
context:
space:
mode:
Diffstat (limited to 'python/vyos/system/compat.py')
-rw-r--r--python/vyos/system/compat.py7
1 files changed, 5 insertions, 2 deletions
diff --git a/python/vyos/system/compat.py b/python/vyos/system/compat.py
index 436da14e8..cc0529b91 100644
--- a/python/vyos/system/compat.py
+++ b/python/vyos/system/compat.py
@@ -170,9 +170,12 @@ def prune_vyos_versions(root_dir: str = '') -> None:
if not root_dir:
root_dir = disk.find_persistence()
- for version in grub.version_list():
+ version_files = Path(f'{root_dir}/{grub.GRUB_DIR_VYOS_VERS}').glob('*.cfg')
+
+ for file in version_files:
+ version = Path(file).stem
if not Path(f'{root_dir}/boot/{version}').is_dir():
- grub.version_del(version)
+ grub.version_del(version, root_dir)
def update_cfg_ver(root_dir:str = '') -> int: