From b96e5f3be6d2bb2a7e2db8144809eda8f036df7d Mon Sep 17 00:00:00 2001 From: Alan Mason <1923621+2Shirt@users.noreply.github.com> Date: Thu, 30 Nov 2017 20:31:37 -0800 Subject: [PATCH] updated verify_wim_backup() --- Scripts/functions/backup.py | 30 ++++++++++-------------------- 1 file changed, 10 insertions(+), 20 deletions(-) diff --git a/Scripts/functions/backup.py b/Scripts/functions/backup.py index 4ab89a43..c884638a 100644 --- a/Scripts/functions/backup.py +++ b/Scripts/functions/backup.py @@ -137,26 +137,16 @@ def select_backup_destination(auto_select=True): else: return destinations[int(selection)-1] -def verify_wim_backup(bin=None, par=None): - # Bail early - if bin is None: - raise Exception('bin path not specified.') - if par is None: - raise Exception('Partition not specified.') - - # Verify hiding all output for quicker verification - print(' Partition {Number} Image...\t\t'.format(**par), end='', flush=True) - cmd = '{bin}\\wimlib\\wimlib-imagex verify "{Image Path}" --nocheck'.format(bin=bin, **par) - if not os.path.exists('{Image Path}'.format(**par)): - print_error('Missing.') - else: - try: - run_program(cmd) - print_success('OK.') - except subprocess.CalledProcessError as err: - print_error('Damaged.') - par['Error'] = par.get('Error', []) + err.stderr.decode().splitlines() - raise BackupError +def verify_wim_backup(partition): + if not os.path.exists(partition['Image Path']): + raise PathNotFoundError + cmd = [ + global_vars['Tools']['wimlib-imagex'], + 'verify', + partition['Image Path'], + ' --nocheck', + ] + run_program(cmd) if __name__ == '__main__': print("This file is not meant to be called directly.")