summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorErich Eckner <git@eckner.net>2016-11-22 13:19:13 +0100
committerErich Eckner <git@eckner.net>2016-11-22 13:19:13 +0100
commit59b634d1e7d4894fe1b47be07454badde8a18ad0 (patch)
treee5967693cae9d76ae834d94303a3de7ffae53234
parent243ac8f4ac3c73cdf2f756ca239218fd0f3ab2bd (diff)
downloadhardlinkedBackups-59b634d1e7d4894fe1b47be07454badde8a18ad0.tar.xz
use --may-modify-others for rsync, if available
-rwxr-xr-xbackup.in21
1 files changed, 6 insertions, 15 deletions
diff --git a/backup.in b/backup.in
index 012618c..8d9942e 100755
--- a/backup.in
+++ b/backup.in
@@ -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=$?