diff options
author | Erich Eckner <git@eckner.net> | 2016-10-25 13:24:53 +0200 |
---|---|---|
committer | Erich Eckner <git@eckner.net> | 2016-11-03 22:47:41 +0100 |
commit | 22168377cb68fbb5c460a686fdf0efe672d04c39 (patch) | |
tree | 9840e9cf74890e4177dd70f14b21849227425461 /backupStatistics.in | |
parent | 72d226aa86d0665e4072239add0b225844dc1e92 (diff) | |
download | hardlinkedBackups-22168377cb68fbb5c460a686fdf0efe672d04c39.tar.xz |
backupStatistics kann jetzt auch ein unterbrochenes relinken resumen.
Diffstat (limited to 'backupStatistics.in')
-rw-r--r-- | backupStatistics.in | 76 |
1 files changed, 50 insertions, 26 deletions
diff --git a/backupStatistics.in b/backupStatistics.in index 38bee6b..1f3c8f7 100644 --- a/backupStatistics.in +++ b/backupStatistics.in @@ -91,37 +91,61 @@ do_stage() echo 'remove inodes with duplicate hashes' return 0 fi - while read line - do - original="$( - grep -m1 "^${line%% *} " "${cacheDir}/${backupID}.inodes.sorted" | \ - sed 's|^\S\+ ||' - )" - for kopieInode in ${line#* } + if [ -r "${cacheDir}/next.action" ] + then + startInode="$(cat "${cacheDir}/next.action")" + sed " + :vor; + / ${startInode}\( \|$\)/{ + s@^\(\S\+ \)\(.* \)\?${startInode}\( \|$\)@\1${startInode}\3@; + bnach + }; + d; + bvor; + :nach; + n; + bnach + " "${cacheDir}/${backupID}.duplicates" + else + cat "${cacheDir}/${backupID}.duplicates" + fi | \ + while read line do - OIFS="${IFS}" - IFS="$(printf '\n\t')" - for kopie in $( - grep "^${kopieInode} " "${cacheDir}/${backupID}.inodes.sorted" | \ + original="$( + grep -m1 "^${line%% *} " "${cacheDir}/${backupID}.inodes.sorted" | \ sed 's|^\S\+ ||' - ) + )" + for kopieInode in ${line#* } do - IFS="${OIFS}" - if ${paranoid} - then - diff "${original}" "${kopie}" - fi - echo "rm \"${kopie}\"" - echo "ln \"${original}\" \"${kopie}\"" - if ! ${dummy} - then - rm "${kopie}" - ln "${original}" "${kopie}" - fi + echo "${kopieInode}" > "${cacheDir}/next.action2" + mv "${cacheDir}/next.action2" "${cacheDir}/next.action" + OIFS="${IFS}" + IFS="$(printf '\n\t')" + for kopie in $( + grep "^${kopieInode} " "${cacheDir}/${backupID}.inodes.sorted" | \ + sed 's|^\S\+ ||' + ) + do + IFS="${OIFS}" + if ${paranoid} + then + diff "${original}" "${kopie}" + fi + echo "rm \"${kopie}\"" + echo "ln \"${original}\" \"${kopie}\"" + if ! ${dummy} + then + rm "${kopie}" + ln "${original}" "${kopie}" + fi + done done done - done < \ - "${cacheDir}/${backupID}.duplicates" + if [ -r "${cacheDir}/next.action" ] && \ + grep -q " $(cat "${cacheDir}/next.action")\( \|$\)" "${cacheDir}/${backupID}.duplicates" + then + rm -f "${cacheDir}/next.action" "${cacheDir}/next.action2" + fi ;; esac } |