From de4fc74d50d536f524aa4c65e270123bfe8ef893 Mon Sep 17 00:00:00 2001 From: TheMightyV Date: Sun, 2 Jan 2022 20:12:27 +0100 Subject: added backup restoration --- backends/borg.sh | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) (limited to 'backends/borg.sh') diff --git a/backends/borg.sh b/backends/borg.sh index d3d9c63..999067f 100644 --- a/backends/borg.sh +++ b/backends/borg.sh @@ -19,7 +19,7 @@ function borg_create_backup() { echo "borg: starting backup to \"$BACKUP_DIR\"" borg create \ - "${BACKUP_DIR}::${BACKUP_NAME}_{hostname}_{now}" \ + "${BACKUP_DIR}::${BACKUP_NAME}_$(date +'%F_%H-%M-%S')" \ "$WORLD_NAME" \ --filter AME \ --compression lz4 \ @@ -56,6 +56,11 @@ function borg_create_backup() { return $RETCODE } +function borg_ls_remote() { + export BORG_PASSCOMMAND="$BACKUP_PASSCOMMAND" + borg list "$1" | cut -d' ' -f1 +} + function borg_ls() { export BORG_PASSCOMMAND="$BACKUP_PASSCOMMAND" for BACKUP_DIR in ${BACKUP_DIRS[*]} @@ -64,3 +69,12 @@ function borg_ls() { borg list "$BACKUP_DIR" done } + +function borg_restore() { + export BORG_PASSCOMMAND="$BACKUP_PASSCOMMAND" + REMOTE="$1" + SNAPSHOT="$2" + + export BORG_REPO="$REMOTE" + borg extract "${REMOTE}::${SNAPSHOT}" +} -- cgit v1.2.3