summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJohn Estabrook <jestabro@vyos.io>2026-02-11 19:04:25 -0600
committerJohn Estabrook <jestabro@vyos.io>2026-02-12 11:17:19 -0600
commitd9064df5374a80473e0809fe6df2d59f2758bb45 (patch)
treea5659b0845033888629985d904a13b879980c803 /src
parentd6fdf9db8497164921afb28abc22f1c7bcd18f52 (diff)
downloadvyos-1x-d9064df5374a80473e0809fe6df2d59f2758bb45.tar.gz
vyos-1x-d9064df5374a80473e0809fe6df2d59f2758bb45.zip
T8257: image install search previous needs to consider legacy bind mount
For those images created with the legacy bind mount, the resident config.boot at {mounted_image}/opt/vyatta/etc/config is the baseline, not the saved config (which is then restored at boot). Image install needs to search the legacy path at {mounted_image}/config as well as the normalized path.
Diffstat (limited to 'src')
-rwxr-xr-xsrc/op_mode/image_installer.py15
1 files changed, 13 insertions, 2 deletions
diff --git a/src/op_mode/image_installer.py b/src/op_mode/image_installer.py
index 9e2009a0a..a924d188e 100755
--- a/src/op_mode/image_installer.py
+++ b/src/op_mode/image_installer.py
@@ -272,12 +272,18 @@ def search_previous_installation(disks: list[str]) -> None:
print('Searching for data from previous installations')
image_data = []
encrypted_configs = []
+ legacy_bind_mount = False
for disk_name in disks:
for partition in disk.partition_list(disk_name):
if disk.partition_mount(partition, mnt_tmp):
if Path(mnt_tmp + '/boot').exists():
for path in Path(mnt_tmp + '/boot').iterdir():
- if path.joinpath('rw/opt/vyatta/etc/config/.vyatta_config').exists():
+ if path.joinpath('rw/config/.vyatta_config').exists():
+ legacy_bind_mount = True
+ image_data.append((path.name, partition))
+ elif path.joinpath(
+ 'rw/opt/vyatta/etc/config/.vyatta_config'
+ ).exists():
image_data.append((path.name, partition))
if Path(mnt_tmp + '/luks').exists():
for path in Path(mnt_tmp + '/luks').iterdir():
@@ -330,7 +336,12 @@ def search_previous_installation(disks: list[str]) -> None:
disk.partition_mount(image_drive, mnt_tmp)
if not encrypted:
- copytree(f'{mnt_tmp}/boot/{image_name}/rw/opt/vyatta/etc/config', mnt_config)
+ if legacy_bind_mount:
+ copytree(f'{mnt_tmp}/boot/{image_name}/rw/config', mnt_config)
+ else:
+ copytree(
+ f'{mnt_tmp}/boot/{image_name}/rw/opt/vyatta/etc/config', mnt_config
+ )
else:
copy(f'{mnt_tmp}/luks/{image_name}', mnt_encrypted_config)