summaryrefslogtreecommitdiff
path: root/src/op_mode
diff options
context:
space:
mode:
authorJohn Estabrook <jestabro@vyos.io>2023-10-29 19:13:31 -0500
committerJohn Estabrook <jestabro@vyos.io>2023-11-16 12:19:15 -0600
commitaae1247da61206d7a1b0b4d6ee20d36d194dbaba (patch)
treee1d61b40e2af8991e693a89c65a01433e6490acc /src/op_mode
parent424c9b19fd54598081e965c3364b082c5ef984de (diff)
downloadvyos-1x-aae1247da61206d7a1b0b4d6ee20d36d194dbaba.tar.gz
vyos-1x-aae1247da61206d7a1b0b4d6ee20d36d194dbaba.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.
Diffstat (limited to 'src/op_mode')
-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.')