v0.8.2 : Fix issue #5 "Handle --time option for restoration"

This commit is contained in:
Zertrin 2012-11-01 13:43:22 +01:00
parent eb0e70bf82
commit 22aad26fda
3 changed files with 33 additions and 3 deletions

View file

@ -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) 0.8.1 (15 August 2012)
====================== ======================
* Added support for using separate signature and encryption keys [puredoze] * Added support for using separate signature and encryption keys [puredoze]

5
README
View file

@ -50,6 +50,7 @@ REQUIREMENTS
* duplicity * duplicity
* gpg * gpg
* which
* Amazon S3 (optional) * Amazon S3 (optional)
* s3cmd (optional) * s3cmd (optional)
* mailx (optional) * mailx (optional)
@ -97,6 +98,8 @@ USAGE
-l, --list-current-files lists the files currently backed up in the archive -l, --list-current-files lists the files currently backed up in the archive
-s, --collection-status show all the backup sets 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 --backup-script automatically backup the script and secret key to
the current working directory the current working directory
-n, --dry-run perform a trial run with no changes made -n, --dry-run perform a trial run with no changes made
@ -159,7 +162,5 @@ NEXT VERSION WISH LIST
====================== ======================
* --restore-dir option * --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. Thanks to Mario Santagiuliana and Razvan for their help.

View file

@ -55,6 +55,7 @@ echo "USAGE:
-s, --collection-status show all the backup sets in the archive -s, --collection-status show all the backup sets in the archive
--backup-script automatically backup the script and secret key to --backup-script automatically backup the script and secret key to
the current working directory 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 -n, --dry-run perform a trial run with no changes made
CURRENT SCRIPT VARIABLES: CURRENT SCRIPT VARIABLES:
@ -70,7 +71,7 @@ echo "USAGE:
# Some expensive argument parsing that allows the script to # Some expensive argument parsing that allows the script to
# be insensitive to the order of appearance of the options # be insensitive to the order of appearance of the options
# and to handle correctly option parameters that are optional # 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 case $opt in
# parse long options (a bit tricky because builtin getopts does not # parse long options (a bit tricky because builtin getopts does not
# manage long options and i don't want to impose GNU getopt dependancy) # 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 OPTIND=$(( $OPTIND + 1 )) # we found it, move forward in arg parsing
fi 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) dry-run)
ECHO=$(which echo) ECHO=$(which echo)
;; ;;
@ -118,6 +126,7 @@ while getopts ":c:bfvlsn-:" opt; do
;; ;;
# here are parsed the short options # here are parsed the short options
c) CONFIG=$OPTARG;; # set the config file from the command line 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";; b) COMMAND="backup";;
f) COMMAND="full";; f) COMMAND="full";;
v) COMMAND="verify";; v) COMMAND="verify";;
@ -495,6 +504,9 @@ case "$COMMAND" in
"restore") "restore")
ROOT=$DEST ROOT=$DEST
OPTION="restore" OPTION="restore"
if [ ! -z "$TIME" ]; then
STATIC_OPTIONS="$STATIC_OPTIONS --time $TIME"
fi
if [[ ! "$RESTORE_DEST" ]]; then if [[ ! "$RESTORE_DEST" ]]; then
echo "Please provide a destination path (eg, /home/user/dir):" echo "Please provide a destination path (eg, /home/user/dir):"
@ -524,6 +536,10 @@ case "$COMMAND" in
EXLUDEROOT= EXLUDEROOT=
OPTION= OPTION=
if [ ! -z "$TIME" ]; then
STATIC_OPTIONS="$STATIC_OPTIONS --time $TIME"
fi
if [[ ! "$FILE_TO_RESTORE" ]]; then if [[ ! "$FILE_TO_RESTORE" ]]; then
echo "Which file do you want to restore (eg, mail/letter.txt):" echo "Which file do you want to restore (eg, mail/letter.txt):"
read -e FILE_TO_RESTORE read -e FILE_TO_RESTORE
@ -559,6 +575,11 @@ case "$COMMAND" in
"list-current-files") "list-current-files")
OPTION="list-current-files" OPTION="list-current-files"
if [ ! -z "$TIME" ]; then
STATIC_OPTIONS="$STATIC_OPTIONS --time $TIME"
fi
${DUPLICITY} ${OPTION} ${VERBOSITY} ${STATIC_OPTIONS} \ ${DUPLICITY} ${OPTION} ${VERBOSITY} ${STATIC_OPTIONS} \
$ENCRYPT \ $ENCRYPT \
${DEST} ${DEST}