Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- clear
- ulimit -n 1024
- # Restores Duplicity backups via Cygwin.
- #------------------------------------------------------------------------------
- # Set the source, destination, GPG key ID, the restore time and a temporary mount-point.
- BACKUP=file://$(cygpath "J:\dest")
- DUMP=$(cygpath "$SYSTEMDRIVE\dump")
- WIN_DUMP=$(cygpath -w "$DUMP")
- KEY=012EE35A
- RT=2016-02-18T20:33:53
- T_MP=/tmp/dump/
- #------------------------------------------------------------------------------
- # Is Duplicity installed?
- if !(cygcheck -cd duplicity | grep -q duplicity)
- then
- echo "Please install the 'Duplicity' package for Cygwin."
- exit 1
- fi
- #------------------------------------------------------------------------------
- # Does the destination exist?
- if [ -d "$DUMP" ]
- then
- echo "Destination already exists. I refuse to destroy your pretty data flowers."
- exit 1
- else
- mkdir "$DUMP"
- fi
- #------------------------------------------------------------------------------
- # Prepare permissions.
- setfacl -b "$DUMP"
- #------------------------------------------------------------------------------
- # Create a temporary mount-point without POSIX permissions.
- if [ -d "$T_MP" ]
- then
- rm -rf "$T_MP"
- fi
- mkdir $T_MP
- mount -o binary,posix=0,user,noacl $WIN_DUMP $T_MP
- #------------------------------------------------------------------------------
- # The passphrase you set during the GPG key creation.
- export PASSPHRASE=qZSt3rigV0wDW9t43BtpAQC066F
- export SIGN_PASSPHRASE=$PASSPHRASE
- #------------------------------------------------------------------------------
- # Restore.
- duplicity --encrypt-key=$KEY --sign-key=$KEY --restore-time "$RT" "$BACKUP" "$T_MP"
- #------------------------------------------------------------------------------
- # Clear the variables.
- unset SIGN_PASSPHRASE
- unset PASSPHRASE
- unset WIN_DUMP
- unset BACKUP
- unset DUMP
- unset KEY
- unset RT
- #------------------------------------------------------------------------------
- # End.
- echo "Finished!"
- umount $T_MP
- unset T_MP
- exit 0
- #------------------------------------------------------------------------------
- # Information.
- #duplicity collection-status "$BACKUP"
- #duplicity list-current-files "$BACKUP" | grep "test.txt"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement