From 01c921fc99670f3facfb741019d2403581af96ba Mon Sep 17 00:00:00 2001 From: MegaBrutal Date: Mon, 15 Feb 2016 23:10:00 +0100 Subject: [PATCH] backup_diff.sh, backup_full.sh: Updated for new dar versions, added FreeBSD compatibility - In dar invocations, changed the "-y9" switch to "-zbzip2:9", as recent versions of dar don't recognize the former argument. Both arguments mean the same, though: bzip2 compression on level 9 (best). - FreeBSD doesn't have the md5sum utility to calculate checksums, thus FreeBSD's md5 utility is used instead. modified: fs/backup_diff.sh modified: fs/backup_full.sh --- fs/backup_diff.sh | 8 ++++++-- fs/backup_full.sh | 8 ++++++-- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/fs/backup_diff.sh b/fs/backup_diff.sh index 56cc4ac..c2b788e 100755 --- a/fs/backup_diff.sh +++ b/fs/backup_diff.sh @@ -2,8 +2,12 @@ . $1 FILENAME=${DIFFNAME}${APPEND} cd ${STORAGE} -dar --verbose --alter=atime --empty-dir --fs-root / --noconf --create ${STORAGE}${FILENAME} --ref $(ls --sort=t ${STORAGE}*.dar | head -n 1 | cut -d. -f1) -y9 -an --exclude-from-file ${EXCLUDE} -md5sum -b ${FILENAME}*.dar >> $(ls --sort=t ${FULLNAME}*.md5 | head -n 1) +dar --verbose --alter=atime --empty-dir --fs-root / --noconf --create ${STORAGE}${FILENAME} --ref $(ls --sort=t ${STORAGE}*.dar | head -n 1 | cut -d. -f1) -zbzip2:9 -an --exclude-from-file ${EXCLUDE} + +case $(uname) in + Linux) md5sum -b ${FILENAME}*.dar >> $(ls --sort=t ${FULLNAME}*.md5 | head -n 1);; + *BSD) md5 -r ${FILENAME}*.dar >> $(ls --sort=t ${FULLNAME}*.md5 | head -n 1);; +esac case "${XFER_METHOD}" in scp) diff --git a/fs/backup_full.sh b/fs/backup_full.sh index 4e828e6..18e5f3a 100755 --- a/fs/backup_full.sh +++ b/fs/backup_full.sh @@ -3,8 +3,12 @@ FILENAME=${FULLNAME}${APPEND} cd ${STORAGE} if [ "${CLEAN_DIR}" = "true" ]; then rm *; fi -dar --verbose --alter=atime --empty-dir --fs-root / --noconf --create ${STORAGE}${FILENAME} -y9 -an --exclude-from-file ${EXCLUDE} -md5sum -b ${FILENAME}* > ${FILENAME}.md5 +dar --verbose --alter=atime --empty-dir --fs-root / --noconf --create ${STORAGE}${FILENAME} -zbzip2:9 -an --exclude-from-file ${EXCLUDE} + +case $(uname) in + Linux) md5sum -b ${FILENAME}* > ${FILENAME}.md5;; + *BSD) md5 -r ${FILENAME}* > ${FILENAME}.md5;; +esac chown ${XFER_USER} ${FILENAME}.md5 case "${XFER_METHOD}" in -- 2.34.1