aboutsummaryrefslogtreecommitdiffstats
path: root/bin
diff options
context:
space:
mode:
authorAaron LI <aaronly.me@outlook.com>2017-05-13 17:04:39 +0800
committerAaron LI <aaronly.me@outlook.com>2017-05-13 17:04:39 +0800
commitbd6eb2f4400babee3dd540bf6986686f383ea380 (patch)
tree8addfb03c4805c4234082014473dd0627da1ecea /bin
parent52d582ab452a1f8aca61bcd903e91eb61ce66e2d (diff)
downloadatoolbox-bd6eb2f4400babee3dd540bf6986686f383ea380.tar.bz2
bin/backup.py: rsync only support acls & xattrs on Linux
Diffstat (limited to 'bin')
-rwxr-xr-xbin/backup.py8
1 files changed, 6 insertions, 2 deletions
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]