Fix backup script for remote repositories.

This commit is contained in:
Andreas B. Mundt 2020-03-04 18:23:13 +01:00
parent 4d70971359
commit 3eae7e731a

View file

@ -15,8 +15,8 @@ if grep -q "$MNT" /etc/fstab ; then
[ -d "$BORG_REPO" ] || mount -v "$MNT" && MOUNTED="TRUE"
fi
if [ ! -d "$BORG_REPO" ] ; then
mkdir -vp --mode=0750 "$BORG_REPO"
if [ ! -e "$KEY_BACKUP" ] ; then
[[ "$BORG_REPO" =~ @ ]] || mkdir -vp --mode=0750 "$BORG_REPO"
borg init --encryption=repokey
borg key export "$BORG_REPO" "$KEY_BACKUP"
fi