summaryrefslogtreecommitdiff
path: root/src/op_mode/image_installer.py
diff options
context:
space:
mode:
authorJohn Estabrook <jestabro@vyos.io>2023-10-29 19:13:31 -0500
committerJohn Estabrook <jestabro@vyos.io>2023-12-16 20:37:10 -0600
commitc212421abf52c3f9dc7ce03cdacbaaa49a7c2d39 (patch)
tree409520715c7ffebe4d2251696baeb0ddded97ca8 /src/op_mode/image_installer.py
parent041cdcff990418ff25a424808299e1a5663a046c (diff)
downloadvyos-1x-c212421abf52c3f9dc7ce03cdacbaaa49a7c2d39.tar.gz
vyos-1x-c212421abf52c3f9dc7ce03cdacbaaa49a7c2d39.zip
image: T4516: add clearer error msg on attempt to upgrade to 1.2.x
An attempt to upgrade to 1.2.x is caught, but error is of failed checksum verification; add check and message. (cherry picked from commit aae1247da61206d7a1b0b4d6ee20d36d194dbaba)
Diffstat (limited to 'src/op_mode/image_installer.py')
-rwxr-xr-xsrc/op_mode/image_installer.py4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/op_mode/image_installer.py b/src/op_mode/image_installer.py
index 2d998f5e1..894eb6ee9 100755
--- a/src/op_mode/image_installer.py
+++ b/src/op_mode/image_installer.py
@@ -38,6 +38,7 @@ from vyos.utils.process import run
MSG_ERR_NOT_LIVE: str = 'The system is already installed. Please use "add system image" instead.'
MSG_ERR_LIVE: str = 'The system is in live-boot mode. Please use "install image" instead.'
MSG_ERR_NO_DISK: str = 'No suitable disk was found. There must be at least one disk of 2GB or greater size.'
+MSG_ERR_IMPROPER_IMAGE: str = 'Missing sha256sum.txt.\nEither this image is corrupted, or of era 1.2.x (md5sum) and would downgrade image tools;\ndisallowed in either case.'
MSG_INFO_INSTALL_WELCOME: str = 'Welcome to VyOS installation!\nThis command will install the VyOS to your permanent storage.'
MSG_INFO_INSTALL_EXIT: str = 'Exitting from VyOS installation'
MSG_INFO_INSTALL_SUCCESS: str = 'The image installed successfully; please reboot now.'
@@ -481,6 +482,9 @@ def add_image(image_path: str) -> None:
# check sums
print('Validating image checksums')
+ if not Path(DIR_ISO_MOUNT).joinpath('sha256sum.txt').exists():
+ cleanup()
+ exit(MSG_ERR_IMPROPER_IMAGE)
if run(f'cd {DIR_ISO_MOUNT} && sha256sum --status -c sha256sum.txt'):
cleanup()
exit('Image checksum verification failed.')