summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorErich Eckner <git@eckner.net>2016-10-22 19:53:52 +0200
committerErich Eckner <git@eckner.net>2016-10-22 19:54:37 +0200
commite8380a04516e3a47db7280561aaea7c65a9f459d (patch)
treea3bb8a2130f866f5b04746072cc85bdc04ca77df
parentf1cb876f859cb98f3debed302e24c25b09c4cbf5 (diff)
downloadhardlinkedBackups-e8380a04516e3a47db7280561aaea7c65a9f459d.tar.xz
backupStatistics sollte jetzt funktionieren
-rw-r--r--backupStatistics.in42
1 files changed, 27 insertions, 15 deletions
diff --git a/backupStatistics.in b/backupStatistics.in
index c68d071..c9123ec 100644
--- a/backupStatistics.in
+++ b/backupStatistics.in
@@ -94,26 +94,32 @@ do_stage()
while read line
do
original="$(
- grep "^${line%% *} " "${cacheDir}/${backupID}.inodes.sorted" | \
+ grep -m1 "^${line%% *} " "${cacheDir}/${backupID}.inodes.sorted" | \
sed 's|^\S\+ ||'
)"
for kopieInode in ${line#* }
do
- kopie="$(
+ OIFS="${IFS}"
+ IFS="$(printf '\n\t')"
+ for kopie in $(
grep "^${kopieInode} " "${cacheDir}/${backupID}.inodes.sorted" | \
sed 's|^\S\+ ||'
- )"
- diff "${original}" "${kopie}"
- if ${dummy}
- then
- echo "rm \"${kopie}\""
- echo "ln \"${original}\" \"${kopie}\""
- else
- exit 1
- DO NOT EXECUTE YET
- # rm "${kopie}"
- # ln "${original}" "${kopie}"
- fi
+ )
+ do
+ IFS="${OIFS}"
+ if ${paranoid}
+ then
+ diff "${original}" "${kopie}"
+ fi
+ if ${dummy}
+ then
+ echo "rm \"${kopie}\""
+ echo "ln \"${original}\" \"${kopie}\""
+ else
+ rm "${kopie}"
+ ln "${original}" "${kopie}"
+ fi
+ done
done
done < \
"${cacheDir}/${backupID}.duplicates"
@@ -132,6 +138,7 @@ With no options, tidy up all backups. THIS CAN BE VERY TIME CONSUMING.
Mandatory arguments to long options are mandatory for short options too.
-d, --dummy only generate lists, do not modify backupfiles
-m, --max=maxNum stop execution after step maxNum
+ -p, --paranoid test for file differences before relinking (test _should_ be obsolete)
-s, --skip=skipNum skip first skipNum steps
#HELPTEXT# #
@@ -148,10 +155,11 @@ the executed steps are:'
}
eval set -- "$(
- getopt -o dm:s: \
+ getopt -o dm:ps: \
--long dummy \
--long help \
--long max: \
+ --long paranoid \
--long skip: \
--long version \
-n "$(basename "$0")" -- "$@" || \
@@ -160,6 +168,7 @@ eval set -- "$(
dummy=false
maxNum=#NUMSTAGES#
+paranoid=false
skipNum=0
while true; do
@@ -174,6 +183,9 @@ while true; do
shift
maxNum=$1
;;
+ -p|--paranoid)
+ paranoid=true
+ ;;
-s|--skip)
shift
skipNum=$1