backup: implemented use of a single tar file instead of creation of multiple file during backup
This commit is contained in:
parent
6c09189b77
commit
aea789d0a1
@ -1031,7 +1031,7 @@ def backup_do_copy(appvm, base_backup_dir, files_to_backup, progress_callback =
|
||||
raise QubesException("Strange: couldn't create backup dir: {0}?!".format(backup_dir))
|
||||
'''
|
||||
bytes_backedup = 0
|
||||
for file in files_to_backup:
|
||||
|
||||
progress = bytes_backedup * 100 / total_backup_sz
|
||||
progress_callback(progress)
|
||||
dest_dir = backup_dir + '/' + file["subdir"]
|
||||
@ -1043,17 +1043,23 @@ def backup_do_copy(appvm, base_backup_dir, files_to_backup, progress_callback =
|
||||
file["basename"] = os.path.basename(file["path"])
|
||||
vm.run("mkdir -p {0}".format(dest_dir))
|
||||
|
||||
tar_cmdline = ["tar", "-PcO",'--sparse','-C','/var/lib/qubes','--checkpoint=10000']
|
||||
|
||||
for filename in files_to_backup:
|
||||
tar_cmdline.append(filename["path"].split("/var/lib/qubes/")[1])
|
||||
print ("Will backup using command",tar_cmdline)
|
||||
|
||||
retcode = vm.run(command = "cat > {0}".format(dest_dir + file["basename"]), passio_popen = True)
|
||||
|
||||
if encrypt:
|
||||
compressor = subprocess.Popen (["tar", "-PcO",'--sparse','--checkpoint=10000', file["path"]],stdout=subprocess.PIPE)
|
||||
compressor = subprocess.Popen (tar_cmdline,stdout=subprocess.PIPE)
|
||||
encryptor = subprocess.Popen (["gpg2", "-c", "--force-mdc", "-o-"], stdin=compressor.stdout, stdout=retcode.stdin)
|
||||
encryptor.wait()
|
||||
|
||||
if encryptor.returncode != 0:
|
||||
raise QubesException("Failed to backup file {0} with error {1}".format(file["basename"]))
|
||||
else:
|
||||
compressor = subprocess.Popen (["tar", "-PcOz",'--checkpoint=10000', file["path"]],stdout=retcode.stdin)
|
||||
compressor = subprocess.Popen (tar_cmdline,stdout=retcode.stdin)
|
||||
|
||||
'''
|
||||
for checkpoint in compressor.stderr:
|
||||
|
Loading…
Reference in New Issue
Block a user