32a241c2a6aca584e1bd4ede38ccc89e2b3d46d4

Author
Zertrin <zertrin@gmail.com>
Committer
Zertrin <zertrin@gmail.com>
Date

Message

Rework of the script to include some github patches that were brought to the original script in order to make the script more generic than only Amazon S3 oriented and fix a few issues.

Diff

This diff is truncated to protect this page.

  1diff --git a/dt-s3-backup.sh b/dt-s3-backup.sh
  2index 4ec9af5307c66d7861dfd5454949f51a261008b4..0b92f4146c18e8b4922b60ab96914a754f7a3425 100755
  3--- a/dt-s3-backup.sh
  4+++ b/dt-s3-backup.sh
  5@@ -2,6 +2,7 @@
  6 #
  7 # Copyright (c) 2008-2010 Damon Timm.
  8 # Copyright (c) 2010 Mario Santagiuliana.
  9+# Copyright (c) 2012 Marc Gallet.
 10 #
 11 # This program is free software: you can redistribute it and/or modify it under
 12 # the terms of the GNU General Public License as published by the Free Software
 13@@ -18,19 +19,24 @@
 14 #
 15 # MORE ABOUT THIS SCRIPT AVAILABLE IN THE README AND AT:
 16 #
 17-# http://damontimm.com/code/dt-s3-backup
 18+# http://zertrin.org/duplicity-backup.html (for this version)
 19+# http://damontimm.com/code/dt-s3-backup (for the original programi by Damon Timm)
 20+#
 21+# Latest code available at:
 22+# http://github.com/zertrin/duplicity-backup
 23 #
 24 # ---------------------------------------------------------------------------- #
 25 
 26 # AMAZON S3 INFORMATION
 27 # Comment out this lines if you're not using S3
 28-export AWS_ACCESS_KEY_ID="foobar_aws_key_id"
 29-export AWS_SECRET_ACCESS_KEY="foobar_aws_access_key"
 30+AWS_ACCESS_KEY_ID="foobar_aws_key_id"
 31+AWS_SECRET_ACCESS_KEY="foobar_aws_access_key"
 32 
 33+# ENCRYPTION INFORMATION
 34 # If you aren't running this from a cron, comment this line out
 35 # and duplicity should prompt you for your password.
 36 # Comment out if you're not using encryption
 37-export PASSPHRASE="foobar_gpg_passphrase"
 38+PASSPHRASE="foobar_gpg_passphrase"
 39 
 40 # Specify which GPG key you would like to use (even if you have only one).
 41 # Comment out if you're not using encryption
 42@@ -39,6 +45,7 @@ GPG_KEY="foobar_gpg_key"
 43 # Do you want your backup to be encrypted? yes/no
 44 ENCRYPTION='yes'
 45 
 46+# BACKUP SOURCE INFORMATION
 47 # The ROOT of your backup (where you want the backup to start);
 48 # This can be / or somwhere else -- I use /home/ because all the
 49 # directories start with /home/ that I want to backup.
 50@@ -52,13 +59,12 @@ ROOT="/home"
 51 #
 52 # NOTE: You do need to keep the "s3+http://<your location>/" format
 53 # even though duplicity supports "s3://<your location>/".
 54-#DEST="s3+http://backup-bucket/backup-folder/"
 55-
 56+DEST="s3+http://backup-bucket/backup-folder/"
 57 # Other possible locations
 58 #DEST="ftp://user[:password]@other.host[:port]/some_dir"
 59 #DEST="rsync://user@host.com[:port]//absolute_path"
 60 #DEST="ssh://user[:password]@other.host[:port]/[/]some_dir"
 61-DEST="file:///home/foobar_user_name/new-backup-test/"
 62+#DEST="file:///home/foobar_user_name/new-backup-test/"
 63 
 64 # INCLUDE LIST OF DIRECTORIES
 65 # Here is a list of directories to include; if you want to include
 66@@ -137,6 +143,34 @@ EMAIL_SUBJECT=
 67 ##############################################################
 68 # Script Happens Below This Line - Shouldn't Require Editing #
 69 ##############################################################
 70+
 71+# Read config file
 72+CONFIG=
 73+while :
 74+do
 75+    case $1 in
 76+        -c | --config)
 77+            CONFIG=$2
 78+            shift 2
 79+            ;;
 80+        *)
 81+            break
 82+            ;;
 83+    esac
 84+done
 85+
 86+if [ ! -z "$CONFIG" -a -f "$CONFIG" ];
 87+then
 88+  . $CONFIG
 89+elif [ ! -z "$CONFIG" -a ! -f "$CONFIG" ];
 90+then
 91+  echo "ERROR: can't find config file!" >&2
 92+fi
 93+
 94+export AWS_ACCESS_KEY_ID
 95+export AWS_SECRET_ACCESS_KEY
 96+export PASSPHRASE
 97+
 98 LOGFILE="${LOGDIR}${LOG_FILE}"
 99 DUPLICITY="$(which duplicity)"
100 S3CMD="$(which s3cmd)"
101@@ -153,7 +187,7 @@ size information unavailable."
102 NO_S3CMD_CFG="WARNING: s3cmd is not configured, run 's3cmd --configure' \
103 in order to retrieve remote file size information. Remote file \
104 size information unavailable."