Browse Source

Bug fixes.

dev
Franco Masotti 3 years ago
parent
commit
3c6b9b7373
  1. 33
      _posts/2019-02-23-my-backup-system.md

33
_posts/2019-02-23-my-backup-system.md

@ -1,7 +1,7 @@
---
title: My backup system
tags: [bash, shell, backup, rsync, LUKS, cryptsetup, sync]
updated: 2019-03-02 16:00
updated: 2019-05-01 15:17
description: A detailed exaplanation of my backup system which is both encrypted and unencrypted for different purposes.
---
@ -158,18 +158,11 @@ DST="${2}"
if [ "${SRC}" = '/*' ]; then
# Use the exclude option to avoid infinite loops due to symlinks and to
# avoid backing up the /data mountpoint.
rsync \
--archive --acls --xattrs --hard-link --delete \
/* "${DST}" \
--exclude={/dev/*,/proc/*,/sys/*,/tmp/*,/run/*,/mnt/*,/media/*,/lost+found,/data}
rsync --archive --acls --xattrs --hard-links --delete /* "${DST}" --exclude={/dev/*,/proc/*,/sys/*,/tmp/*,/run/*,/mnt/*,/media/*,/lost+found,/data}
elif [ "${SRC}" = '/data/*' ]; then
rsync \
--archive --acls --xattrs --hard-link --delete \
/data/* "${DST}"
rsync --archive --acls --xattrs --hard-links --delete /data/* "${DST}"
else
rsync \
--archive --acls --xattrs --hard-link --delete \
"${SRC}" "${DST}"
rsync --archive --acls --xattrs --hard-links --delete "${SRC}" "${DST}"
fi
ret_rsync=${?}
@ -265,20 +258,20 @@ declare -A BACKUP_ALIAS_DATA
WHAT="${1}"
{ command -V cryptsetup && command -V bash && command -V printf \
command -V mount && command -V umount && command -V awk; } \
&& command -V mount && command -V umount && command -V awk; } \
|| exit 1
[ ${UID} -ne 0 ] && printf "%s\n" 'user must be root' 2>&1 && exit 1
if [ "${WHAT}" = 'root' ]; then
SRC=BACKUP_ALIAS_ROOT['SRC']
DST=BACKUP_ALIAS_ROOT['DST']
UUID=BACKUP_ALIAS_ROOT['UUID']
NAME=BACKUP_ALIAS_ROOT['DEVICE_MAPPER_NAME']
SRC="${BACKUP_ALIAS_ROOT['SRC']}"
DST="${BACKUP_ALIAS_ROOT['DST']}"
UUID="${BACKUP_ALIAS_ROOT['UUID']}"
NAME="${BACKUP_ALIAS_ROOT['DEVICE_MAPPER_NAME']}"
elif [ "${WHAT}" = 'data' ]; then
SRC=BACKUP_ALIAS_DATA['SRC']
DST=BACKUP_ALIAS_DATA['DST']
UUID=BACKUP_ALIAS_DATA['UUID']
NAME=BACKUP_ALIAS_DATA['DEVICE_MAPPER_NAME']
SRC="${BACKUP_ALIAS_DATA['SRC']}"
DST="${BACKUP_ALIAS_DATA['DST']}"
UUID="${BACKUP_ALIAS_DATA['UUID']}"
NAME="${BACKUP_ALIAS_DATA['DEVICE_MAPPER_NAME']}"
else
printf "%s\n" 'error: configuration not set' 2>&1 && exit 1
fi

Loading…
Cancel
Save