backup2me.sh: fix arch rsync bug where --backup flag is needed to save archives

This commit is contained in:
Alice Gaudon 2019-05-22 08:36:52 +02:00
parent fe1b5584c4
commit e73cecf0ef

View File

@ -41,20 +41,19 @@ BACKUP_ARCHIVE=$7
BACKUP_ROOT_PATH="$(cat /etc/hostname)" BACKUP_ROOT_PATH="$(cat /etc/hostname)"
BACKUP_BASE_PATH="$BACKUP_ROOT_PATH/$BACKUP_ROOT" BACKUP_BASE_PATH="$BACKUP_ROOT_PATH/$BACKUP_ROOT"
BACKUP_CONTENTS_PATH="$BACKUP_BASE_PATH/_backup/" BACKUP_CONTENTS_PATH="$BACKUP_BASE_PATH/_backup/"
BACKUP_ARCHIVE_PATH="$BACKUP_BASE_PATH/$BACKUP_ARCHIVE"
echo "Starting backup" echo "Starting backup. Target: $BACKUP_BASE_PATH. Archive: $BACKUP_ARCHIVE"
### Before Script ### ### Before Script ###
eval "$BEFORE_SCRIPT" eval "$BEFORE_SCRIPT"
### Create local model of the remote's backup directory tree and send it ### ### Create local model of the remote's backup directory tree and send it ###
mkdir -p "$BACKUP_CONTENTS_PATH" mkdir -p "$BACKUP_CONTENTS_PATH"
rsync --timeout=30 -avzhP --relative "$BACKUP_CONTENTS_PATH" "$BACKUP_TARGET" rsync --timeout=30 -avzhP --relative $BACKUP_CONTENTS_PATH $BACKUP_TARGET
### Backup home directory except some unwanted files ### ### Backup home directory except some unwanted files ###
rsync --timeout=30 -avzhP --delete --inplace $BACKUP_EXCLUSIONS --backup-dir="../$BACKUP_ARCHIVE_PATH" "$BACKUP_DIRECTORY" "$BACKUP_TARGET/$BACKUP_CONTENTS_PATH" rsync --timeout=30 -avzhP --delete --inplace $BACKUP_EXCLUSIONS --backup --backup-dir=../$BACKUP_ARCHIVE $BACKUP_DIRECTORY $BACKUP_TARGET/$BACKUP_CONTENTS_PATH
### Remove local model of the backup directory tree ### ### Remove local model of the backup directory tree ###
rm -R "$BACKUP_ROOT_PATH" rm -R "$BACKUP_ROOT_PATH"