summaryrefslogtreecommitdiff
path: root/backupStatistics.in
diff options
context:
space:
mode:
authorErich Eckner <git@eckner.net>2016-10-25 13:34:04 +0200
committerErich Eckner <git@eckner.net>2016-11-03 22:52:05 +0100
commitc9784fb76a27f0a2a4c0bfb303ab25da49ed8846 (patch)
tree59341f4d01ee27f5fb45981089913120189d89e1 /backupStatistics.in
parent22168377cb68fbb5c460a686fdf0efe672d04c39 (diff)
downloadhardlinkedBackups-c9784fb76a27f0a2a4c0bfb303ab25da49ed8846.tar.xz
split stage 3 into two (generate; sort) in backupStatistics
Diffstat (limited to 'backupStatistics.in')
-rw-r--r--backupStatistics.in22
1 files changed, 15 insertions, 7 deletions
diff --git a/backupStatistics.in b/backupStatistics.in
index 1f3c8f7..f910db4 100644
--- a/backupStatistics.in
+++ b/backupStatistics.in
@@ -51,25 +51,33 @@ do_stage()
echo 'generate lists $inode -> $contentHash'
return 0
fi
- tmpDirA="$(mktemp -d)"
- tmpDirB="$(mktemp -d "${cacheDir}/tmp.XXXXXX")"
uniq -m1 "${cacheDir}/${backupID}.inodes.sorted" | \
parallel \
sha512sum {=s/^[[:digit:]]\+ //=} \| \
sed "\"s|^\([0-9a-f]\{128\}\) .*\$|\1 "{=s/^\([[:digit:]]\+\) .*/\\1/=}"|\"" \
- \; | \
- sort -T "${tmpDirA}" -T "${tmpDirB}" > \
+ \; > \
"${cacheDir}/${backupID}.content"
- rmdir "${tmpDirA}" "${tmpDirB}"
;;
4)
if [ "$2" == '##DESCRIBE##' ]
then
+ echo 'sort previous lists by $contentHash'
+ return 0
+ fi
+ tmpDirA="$(mktemp -d)"
+ tmpDirB="$(mktemp -d "${cacheDir}/tmp.XXXXXX")"
+ sort -T "${tmpDirA}" -T "${tmpDirB}" "${cacheDir}/${backupID}.content" > \
+ "${cacheDir}/${backupID}.content.sorted"
+ rmdir "${tmpDirA}" "${tmpDirB}"
+ ;;
+ 5)
+ if [ "$2" == '##DESCRIBE##' ]
+ then
echo 'find duplicate hashes'
return 0
fi
(
- uniq -m1 --all-repeated=separate "${cacheDir}/${backupID}.content"
+ uniq -m1 --all-repeated=separate "${cacheDir}/${backupID}.content.sorted"
echo ""
) | \
sed 's|^\S\+ ||' | \
@@ -85,7 +93,7 @@ do_stage()
sed 's| $||' > \
"${cacheDir}/${backupID}.duplicates"
;;
- 5)
+ 6)
if [ "$2" == '##DESCRIBE##' ]
then
echo 'remove inodes with duplicate hashes'