diff options
author | Aaron LI <aaronly.me@outlook.com> | 2017-05-13 17:04:39 +0800 |
---|---|---|
committer | Aaron LI <aaronly.me@outlook.com> | 2017-05-13 17:04:39 +0800 |
commit | bd6eb2f4400babee3dd540bf6986686f383ea380 (patch) | |
tree | 8addfb03c4805c4234082014473dd0627da1ecea | |
parent | 52d582ab452a1f8aca61bcd903e91eb61ce66e2d (diff) | |
download | atoolbox-bd6eb2f4400babee3dd540bf6986686f383ea380.tar.bz2 |
bin/backup.py: rsync only support acls & xattrs on Linux
-rwxr-xr-x | bin/backup.py | 8 |
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] |