diff --git a/CHANGELOG b/CHANGELOG index efec0e3..c8d6d66 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,3 +1,11 @@ +0.8.2 (01 November 2012) +======================== + * Handle --time option for restoration and file-listing + * Fix "check_variables" not to throw errors if no encryption is desired + * Added mail option [philcryer] + * Fix issue #18: `which s3cmd` only called when dest is s3 + * Added hint in the comments of the config file to use --s3-european-buckets option for european buckets + 0.8.1 (15 August 2012) ====================== * Added support for using separate signature and encryption keys [puredoze] diff --git a/README b/README index da54be2..685bc60 100644 --- a/README +++ b/README @@ -50,6 +50,7 @@ REQUIREMENTS * duplicity * gpg +* which * Amazon S3 (optional) * s3cmd (optional) * mailx (optional) @@ -97,6 +98,8 @@ USAGE -l, --list-current-files lists the files currently backed up in the archive -s, --collection-status show all the backup sets in the archive + -t, --time TIME specify the time from which to restore or list + files (duplicity time format) --backup-script automatically backup the script and secret key to the current working directory -n, --dry-run perform a trial run with no changes made @@ -159,7 +162,5 @@ NEXT VERSION WISH LIST ====================== * --restore-dir option -* restore files from a specific time period -* support multiple MTAs for the email alert feature Thanks to Mario Santagiuliana and Razvan for their help. diff --git a/duplicity-backup.sh b/duplicity-backup.sh index 15ae4c6..3f130b8 100755 --- a/duplicity-backup.sh +++ b/duplicity-backup.sh @@ -55,6 +55,7 @@ echo "USAGE: -s, --collection-status show all the backup sets in the archive --backup-script automatically backup the script and secret key to the current working directory + -t, --time TIME specify the time from which to restore or list files -n, --dry-run perform a trial run with no changes made CURRENT SCRIPT VARIABLES: @@ -70,7 +71,7 @@ echo "USAGE: # Some expensive argument parsing that allows the script to # be insensitive to the order of appearance of the options # and to handle correctly option parameters that are optional -while getopts ":c:bfvlsn-:" opt; do +while getopts ":c:t:bfvlsn-:" opt; do case $opt in # parse long options (a bit tricky because builtin getopts does not # manage long options and i don't want to impose GNU getopt dependancy) @@ -108,6 +109,13 @@ while getopts ":c:bfvlsn-:" opt; do OPTIND=$(( $OPTIND + 1 )) # we found it, move forward in arg parsing fi ;; + time) # set the restore time from the command line + # We try to find the restore time + if [ ! -z "${!OPTIND:0:1}" -a ! "${!OPTIND:0:1}" = "-" ]; then + TIME=${!OPTIND} + OPTIND=$(( $OPTIND + 1 )) # we found it, move forward in arg parsing + fi + ;; dry-run) ECHO=$(which echo) ;; @@ -118,6 +126,7 @@ while getopts ":c:bfvlsn-:" opt; do ;; # here are parsed the short options c) CONFIG=$OPTARG;; # set the config file from the command line + t) TIME=$OPTARG;; # set the restore time from the command line b) COMMAND="backup";; f) COMMAND="full";; v) COMMAND="verify";; @@ -495,6 +504,9 @@ case "$COMMAND" in "restore") ROOT=$DEST OPTION="restore" + if [ ! -z "$TIME" ]; then + STATIC_OPTIONS="$STATIC_OPTIONS --time $TIME" + fi if [[ ! "$RESTORE_DEST" ]]; then echo "Please provide a destination path (eg, /home/user/dir):" @@ -524,6 +536,10 @@ case "$COMMAND" in EXLUDEROOT= OPTION= + if [ ! -z "$TIME" ]; then + STATIC_OPTIONS="$STATIC_OPTIONS --time $TIME" + fi + if [[ ! "$FILE_TO_RESTORE" ]]; then echo "Which file do you want to restore (eg, mail/letter.txt):" read -e FILE_TO_RESTORE @@ -559,6 +575,11 @@ case "$COMMAND" in "list-current-files") OPTION="list-current-files" + + if [ ! -z "$TIME" ]; then + STATIC_OPTIONS="$STATIC_OPTIONS --time $TIME" + fi + ${DUPLICITY} ${OPTION} ${VERBOSITY} ${STATIC_OPTIONS} \ $ENCRYPT \ ${DEST}