Commit c396d831 authored by Marco Mariani's avatar Marco Mariani

Added --always-snapshot; version bump

The --always-snapshot path/to/file parameter can be repeated
any number of times, and must specify the relative path to each file
(not directory) that results corrupted after running --verify.
These files will be completely transferred again, even if they have
not changed since the last backup.

For instance:

CORRUPTED_MSG="Warning:\ Computed\ SHA1\ digest\ of\ "
CORRUPTED_ARGS=$(./rdiff-backup --verify user@host::/path/to/backup 2>&1 >/dev/null | grep "^$CORRUPTED_MSG" | sed "s/$CORRUPTED_MSG/--always-snapshot\ /g")
echo $CORRUPTED_ARGS
parent d6aa8e1f
......@@ -58,6 +58,9 @@ except AttributeError:
process_gid = 0
process_groups = [0]
# These files will always be transferred completely (i.e. in case of backup corruption).
always_snapshot = []
# If true, when copying attributes, also change target's uid/gid
change_ownership = None
......
......@@ -60,6 +60,7 @@ def parse_cmdlineoptions(arglist):
try: optlist, args = getopt.getopt(arglist, "blr:sv:V",
["backup-mode", "calculate-average", "carbonfile",
"always-snapshot=", "always-snapshot-fromfile=",
"check-destination-dir",
"compare", "compare-at-time=", "compare-hash",
"compare-hash-at-time=", "compare-full", "compare-full-at-time=",
......@@ -130,6 +131,11 @@ def parse_cmdlineoptions(arglist):
select_files.append(sys.stdin)
elif opt == "--force": force = 1
elif opt == "--group-mapping-file": group_mapping_filename = arg
elif opt == "--always-snapshot":
Globals.always_snapshot.append(tuple(arg.split('/')))
elif opt == "--always-snapshot-fromfile":
with open(arg, 'rb') as fin:
Globals.always_snapshot.extend(tuple(line.strip('\n').split('/')) for line in fin.xreadlines())
elif (opt == "--include" or
opt == "--include-special-files" or
opt == "--include-symbolic-links"):
......
......@@ -230,8 +230,10 @@ def BackupInitConnections(reading_conn, writing_conn):
"""Backup specific connection initialization"""
reading_conn.Globals.set("isbackup_reader", 1)
writing_conn.Globals.set("isbackup_writer", 1)
writing_conn.Globals.set("always_snapshot", Globals.always_snapshot)
UpdateGlobal("backup_reader", reading_conn)
UpdateGlobal("backup_writer", writing_conn)
UpdateGlobal("always_snapshot", Globals.always_snapshot)
def CloseConnections():
"""Close all connections. Run by client"""
......
# -*- coding: utf-8 -*-
# vim: set nolist noet ts=4:
version = "1.3.4nxd1"
version = "1.3.4nxd2"
......@@ -333,6 +333,8 @@ class CacheCollatedPostProcess:
self.cache_indicies.append(index)
if len(self.cache_indicies) > self.cache_size: self.shorten_cache()
if source_rorp and source_rorp.index in Globals.always_snapshot:
dest_rorp = None
return source_rorp, dest_rorp
def pre_process(self, source_rorp, dest_rorp):
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment