Browse Source

Improvements.

dev
Franco Masotti 3 years ago
parent
commit
0b0e9267bd
Signed by: frnmst
GPG Key ID: 24116ED85666780A
  1. 13
      _posts/2019-02-23-my-backup-system.md

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

@ -136,7 +136,10 @@ following code is licensed under the [GNU Free Documentation License
# Free Documentation License".
declare -A BACKUP_ALIAS
. ./backup.conf
# Get correct path before loading the configuration file.
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
. ""${DIR}"/backup.conf"
SRC="${1}"
DST="${2}"
@ -151,7 +154,7 @@ DST="${2}"
START=$(date +%s)
if [ "${SRC}" = '/*' ]; then
# Use the exclude option to avoid infinite loops due to symlinks and to
# avoid backing up the /data mountpoint.
# avoid backing up the /data mountpoint itself.
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-links --delete /data/* "${DST}"
@ -247,7 +250,9 @@ page.
declare -A BACKUP_ALIAS_ROOT
declare -A BACKUP_ALIAS_DATA
. ./backup_enc.conf
# Get correct path before loading the configuration file.
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
. ""${DIR}"/backup_enc.conf"
WHAT="${1}"
@ -275,7 +280,7 @@ dev="/dev/"$(lsblk -x name -i -o name,uuid | grep "${UUID}" | awk '{print $1}')"
[ -z "${dev}" ] && exit 1
cryptsetup open "${dev}" "${NAME}" && mount /dev/mapper/"${NAME}" "${DST}" \
&& ./backup.sh "${SRC}" "${DST}"
&& ""${DIR}"/backup.sh" "${SRC}" "${DST}"
umount "${DST}" && cryptsetup close "${NAME}"
```

Loading…
Cancel
Save