diff options
author | Erich Eckner <git@eckner.net> | 2016-11-22 13:19:13 +0100 |
---|---|---|
committer | Erich Eckner <git@eckner.net> | 2016-11-22 13:19:13 +0100 |
commit | 59b634d1e7d4894fe1b47be07454badde8a18ad0 (patch) | |
tree | e5967693cae9d76ae834d94303a3de7ffae53234 | |
parent | 243ac8f4ac3c73cdf2f756ca239218fd0f3ab2bd (diff) | |
download | hardlinkedBackups-59b634d1e7d4894fe1b47be07454badde8a18ad0.tar.xz |
use --may-modify-others for rsync, if available
-rwxr-xr-x | backup.in | 21 |
1 files changed, 6 insertions, 15 deletions
@@ -1,9 +1,9 @@ #!/bin/bash -rsyncOptions=( # common to both runs: verbose, stay-on-device, use checksums - '-vxcrlDH' # only in first run: recurse and preserve soft links, devices, hard links - '-vxcaHAX' # only in second run: "archive" and preseve hardlinks, ACLs, xattr -) +rsyncOptions='-vxcaHAX' +rsync --may-modify-others 2>&1 | \ + grep -q 'unknown option' || + rsyncOptions="${rsyncOptions} --may-modify-others" [ -r "#ETCDIR#/backup.conf" ] && \ . "#ETCDIR#/backup.conf" @@ -116,28 +116,19 @@ chmod 750 ${neues} chown erich:root ${neues} if [ -z "${rsyncShell}" ] then - rsync ${rsyncOptions[0]} \ + rsync ${rsyncOptions} \ ${linkdests} \ ${excludeArgs} \ ${Quelle} ${neues}/ sleep 1 - rsync ${rsyncOptions[1]} \ - ${excludeArgs} \ - ${Quelle} ${neues}/ - sleep 1 rsync ${Quelle} else rsync "${rsyncShell}" \ - ${rsyncOptions[0]} \ + ${rsyncOptions} \ ${linkdests} \ ${excludeArgs} \ ${Quelle} ${neues}/ sleep 1 - rsync "${rsyncShell}" \ - ${rsyncOptions[1]} \ - ${excludeArgs} \ - ${Quelle} ${neues}/ - sleep 1 rsync "${rsyncShell}" ${Quelle} fi erg=$? |