updated verify_wim_backup()

This commit is contained in:
Alan Mason 2017-11-30 20:31:37 -08:00
parent 7133089d31
commit b96e5f3be6

View file

@ -137,26 +137,16 @@ def select_backup_destination(auto_select=True):
else: else:
return destinations[int(selection)-1] return destinations[int(selection)-1]
def verify_wim_backup(bin=None, par=None): def verify_wim_backup(partition):
# Bail early if not os.path.exists(partition['Image Path']):
if bin is None: raise PathNotFoundError
raise Exception('bin path not specified.') cmd = [
if par is None: global_vars['Tools']['wimlib-imagex'],
raise Exception('Partition not specified.') 'verify',
partition['Image Path'],
# Verify hiding all output for quicker verification ' --nocheck',
print(' Partition {Number} Image...\t\t'.format(**par), end='', flush=True) ]
cmd = '{bin}\\wimlib\\wimlib-imagex verify "{Image Path}" --nocheck'.format(bin=bin, **par) run_program(cmd)
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
if __name__ == '__main__': if __name__ == '__main__':
print("This file is not meant to be called directly.") print("This file is not meant to be called directly.")