summaryrefslogtreecommitdiff
path: root/fastRepair.in
diff options
context:
space:
mode:
authorErich Eckner <git@eckner.net>2019-02-10 22:36:04 +0100
committerErich Eckner <git@eckner.net>2019-02-10 22:36:04 +0100
commit314ad8d94c5ff33fd2eadb1027748550be0e7e4f (patch)
treeb94d525ac5758380cbc8cbcc8bce8e5b68823697 /fastRepair.in
parent080efe8cbf8e5bc69a17f8af8f5feffd01dd67fe (diff)
downloadhardlinkedBackups-314ad8d94c5ff33fd2eadb1027748550be0e7e4f.tar.xz
camelCase -> no-camel-case, backup-progress new
Diffstat (limited to 'fastRepair.in')
-rw-r--r--fastRepair.in88
1 files changed, 0 insertions, 88 deletions
diff --git a/fastRepair.in b/fastRepair.in
deleted file mode 100644
index fb89956..0000000
--- a/fastRepair.in
+++ /dev/null
@@ -1,88 +0,0 @@
-#!/bin/bash
-
-# fastRepair version #VERSION#
-
-[ -r "/etc/backup.conf" ] && \
- . "/etc/backup.conf"
-
-dummy=false
-if [ $# -eq 1 ] \
- && [ "$1" == "-d" ]
-then
- shift
- dummy=true
-fi
-
-if [ $# -ne 0 ]
-then
- >&2 echo "too many arguments: '$@'"
- exit 1
-fi
-
-for backupID in "${!backups[@]}"
-do
- backupDir="${backups["${backupID}"]%% *}"
- lastDate="$(
- ls -1 "${backupDir}" | \
- sort -r | \
- grep -m1 '^[0-9]\{4\}\(_[0-9]\{2\}\)\{2\}$'
- )"
-
- dateList=$(
- ls -1 "${backupDir}" | \
- sort -r | \
- grep '^[0-9]\{4\}\(_[0-9]\{2\}\)\{2\}$' | \
- grep -v "^${lastDate}"
- )
-
- [ -z "${dateList}" ] \
- && continue
-
- set -e
-
- echo -n "${backupID}: "
-
- find "${backupDir}${lastDate}" -type f -links 1 | \
- wc -l
-
- find "${backupDir}${lastDate}" -type f -links 1 | \
- sed "s|^${backupDir}${lastDate}/||" | \
- while read -r datei
- do
- for date in ${dateList}
- do
- [ -f "${backupDir}${date}/${datei}" ] \
- || break
- diff -q "${backupDir}${lastDate}/${datei}" "${backupDir}${date}/${datei}" > /dev/null \
- || break
- nlinks=$(
- stat -c'%h' "${backupDir}${date}/${datei}"
- )
- [ ${nlinks} -eq 65000 ] \
- && continue
- rights=$(stat -c'%a' "${backupDir}${lastDate}/${datei}")
- uid=$(stat -c'%u' "${backupDir}${lastDate}/${datei}")
- gid=$(stat -c'%g' "${backupDir}${lastDate}/${datei}")
- timeModification=$(stat -c'%y' "${backupDir}${lastDate}/${datei}")
-
- echo rm \"${backupDir}${lastDate}/${datei}\"
- echo ln \"${backupDir}${date}/${datei}\" \"${backupDir}${lastDate}/${datei}\"
- echo chown ${uid}:${gid} \"${backupDir}${lastDate}/${datei}\"
- echo chmod ${rights} \"${backupDir}${lastDate}/${datei}\"
- echo touch -m -d \"${timeModification}\" \"${backupDir}${lastDate}/${datei}\"
-
- if ! ${dummy}
- then
- rm "${backupDir}${lastDate}/${datei}"
- ln "${backupDir}${date}/${datei}" "${backupDir}${lastDate}/${datei}"
- chown ${uid}:${gid} "${backupDir}${lastDate}/${datei}"
- chmod ${rights} "${backupDir}${lastDate}/${datei}"
- touch -m -d "${timeModification}" "${backupDir}${lastDate}/${datei}"
- fi
- break
- done
- done
-
- set +e
-
-done