diff options
author | Daniil Baturin <daniil@baturin.org> | 2025-02-03 13:53:47 +0000 |
---|---|---|
committer | Daniil Baturin <daniil@baturin.org> | 2025-02-03 13:53:47 +0000 |
commit | d7b09bb5d33794e70baf53262c1df77a5b78fabc (patch) | |
tree | a26321516697a8f1f8a592aeff7e0ccc99756c1d | |
parent | 6912eb2e5075ec2e5e326d10c127d7c81f4fbe47 (diff) | |
download | vyos-1x-d7b09bb5d33794e70baf53262c1df77a5b78fabc.tar.gz vyos-1x-d7b09bb5d33794e70baf53262c1df77a5b78fabc.zip |
installer: T7102: download upgrade images to a random path in the root filesystem
-rwxr-xr-x | src/op_mode/image_installer.py | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/op_mode/image_installer.py b/src/op_mode/image_installer.py index 0596d4f16..609b0b347 100755 --- a/src/op_mode/image_installer.py +++ b/src/op_mode/image_installer.py @@ -99,7 +99,7 @@ DIR_ISO_MOUNT: str = f'{DIR_INSTALLATION}/iso_src' DIR_DST_ROOT: str = f'{DIR_INSTALLATION}/disk_dst' DIR_KERNEL_SRC: str = '/boot/' FILE_ROOTFS_SRC: str = '/usr/lib/live/mount/medium/live/filesystem.squashfs' -ISO_DOWNLOAD_PATH: str = '/tmp/vyos_installation.iso' +ISO_DOWNLOAD_PATH: str = '' external_download_script = '/usr/libexec/vyos/simple-download.py' external_latest_image_url_script = '/usr/libexec/vyos/latest-image-url.py' @@ -552,6 +552,11 @@ def image_fetch(image_path: str, vrf: str = None, Returns: Path: a path to a local file """ + import os.path + from uuid import uuid4 + + global ISO_DOWNLOAD_PATH + # Latest version gets url from configured "system update-check url" if image_path == 'latest': command = external_latest_image_url_script @@ -568,6 +573,7 @@ def image_fetch(image_path: str, vrf: str = None, # check a type of path if urlparse(image_path).scheme: # download an image + ISO_DOWNLOAD_PATH = os.path.join(os.path.expanduser("~"), '{0}.iso'.format(uuid4())) download_file(ISO_DOWNLOAD_PATH, image_path, vrf, username, password, progressbar=True, check_space=True) |