Created
December 3, 2021 17:41
-
-
Save kmille/7fae7547fd81ada3df9cad991b3e2ea2 to your computer and use it in GitHub Desktop.
mount last borg backup
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
set -eu | |
REPOSITORY="host:directory" | |
BACKUP_PREFIX="desktop_data" | |
MOUNTPOINT="/home/user/mnt" | |
BORG_RELOCATED_REPO_ACCESS_IS_OK=yes | |
echo -n "Encryption Password: " | |
#read -s BORG_PASSPHRASE | |
read BORG_PASSPHRASE | |
export BORG_PASSPHRASE | |
export BORG_RELOCATED_REPO_ACCESS_IS_OK | |
last_backup_json=$(borg list -P "$BACKUP_PREFIX" "$REPOSITORY" --last 1 --json) | |
last_backup_name=$(echo $last_backup_json | jq -r '.archives[0].name') | |
echo "Last backup name $last_backup_name" | |
borg mount "$REPOSITORY"::"$last_backup_name" "$MOUNTPOINT" | |
echo "last backup mounted to $MOUNTPOINT" | |
echo "done" | |
# fusermount -u /home/user/mnt |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment