From 59b634d1e7d4894fe1b47be07454badde8a18ad0 Mon Sep 17 00:00:00 2001 From: Erich Eckner Date: Tue, 22 Nov 2016 13:19:13 +0100 Subject: use --may-modify-others for rsync, if available --- backup.in | 21 ++++++--------------- 1 file 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=$? -- cgit v1.2.3-54-g00ecf