From bd6eb2f4400babee3dd540bf6986686f383ea380 Mon Sep 17 00:00:00 2001 From: Aaron LI Date: Sat, 13 May 2017 17:04:39 +0800 Subject: bin/backup.py: rsync only support acls & xattrs on Linux --- bin/backup.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'bin') diff --git a/bin/backup.py b/bin/backup.py index 48650ae..f204f13 100755 --- a/bin/backup.py +++ b/bin/backup.py @@ -130,13 +130,17 @@ class Backup: """ Copy file/directory using `rsync` with metadata preserved, and to keep directory contents in sync. + + Use `rsync --version` to check the available capabilities. """ if os.path.isdir(src): src = src.rstrip("/") + "/" dest = dest.rstrip("/") + "/" - logger.info("Copy: %s -> %s" % (src, dest)) - args = ["--archive", "--acls", "--xattrs", "--hard-links", + logger.info("Copy & sync: %s -> %s" % (src, dest)) + args = ["--archive", "--hard-links", "--numeric-ids", "--delete", "--delete-after"] + if os.uname().sysname == "Linux": + args += ["--acls", "--xattrs"] if debug: args += ["--verbose"] cmd = ["rsync"] + args + [src, dest] -- cgit v1.2.2