diff options
-rw-r--r-- | duply/.duply/seb_jdr/conf | 13 | ||||
-rw-r--r-- | duply/scripts/duplicity/duply_common.sh | 10 | ||||
-rwxr-xr-x | duply/scripts/duplicity/gen_config_restore.sh | 54 |
3 files changed, 63 insertions, 14 deletions
diff --git a/duply/.duply/seb_jdr/conf b/duply/.duply/seb_jdr/conf index 5353984..eebc9e9 100644 --- a/duply/.duply/seb_jdr/conf +++ b/duply/.duply/seb_jdr/conf @@ -12,17 +12,4 @@ GPG_KEY_SIGN='F6859BC3CC712DF8' # NOTE: available since duplicity 0.6.14, translates to SIGN_PASSPHRASE #GPG_PW_SIGN='<signpass>' -# uncomment and set a file path or name force duply to use this gpg executable -# available in duplicity 0.7.04 and above (currently unreleased 06/2015) -#GPG='/usr/local/gpg-2.1/bin/gpg' - -# gpg options passed from duplicity to gpg process (default='') -# e.g. "--trust-model pgp|classic|direct|always" -# or "--compress-algo=bzip2 --bzip2-compress-level=9" -# or "--personal-cipher-preferences AES256,AES192,AES..." -# or "--homedir ~/.duply" - keep keyring and gpg settings duply specific -# or "--pinentry-mode loopback" - needed for GPG 2.1+ _and_ -# also enable allow-loopback-pinentry in your .gnupg/gpg-agent.conf -#GPG_OPTS='' - . ~/scripts/duplicity/duply_common.sh diff --git a/duply/scripts/duplicity/duply_common.sh b/duply/scripts/duplicity/duply_common.sh index a55bfd6..9e2ef66 100644 --- a/duply/scripts/duplicity/duply_common.sh +++ b/duply/scripts/duplicity/duply_common.sh @@ -30,7 +30,15 @@ read() { . ~/.config/ovh/duplicity-$(whoami).sh #Generate the configuration -~/scripts/duplicity/gen_config_remote.sh "${JSON_CONF}" +case $2 in + restore) + export COLD_PATH=$(zenity --file-selection --directory --title="Chemin des sauvegardes") + ~/scripts/duplicity/gen_config_restore.sh "${JSON_CONF}" + ;; + *) + ~/scripts/duplicity/gen_config_remote.sh "${JSON_CONF}" + ;; +esac TARGET="multi:${JSON_CONF}?mode=mirror&onfail=abort" diff --git a/duply/scripts/duplicity/gen_config_restore.sh b/duply/scripts/duplicity/gen_config_restore.sh new file mode 100755 index 0000000..19e1475 --- /dev/null +++ b/duply/scripts/duplicity/gen_config_restore.sh @@ -0,0 +1,54 @@ +#!/bin/sh + +if test "x${PCA_OS_REGION_NAME}" = x; then + PCA_OS_REGION_NAME=${OS_REGION_NAME} +fi + +if test "x${HOT_OS_REGION_NAME}" = x; then + HOT_OS_REGION_NAME=${OS_REGION_NAME} +fi + +envsubst > $1 << EOF +[ + { + "description": "Cold storage", + "url": "file://${COLD_PATH}", + "prefixes": ["cold_"] + }, + { + "description": "Hot storage", + "url": "swift://${STORAGE_NAME}_indexes", + "env": [ + { + "name": "SWIFT_AUTHURL", + "value": "${OS_AUTH_URL}" + }, + { + "name": "SWIFT_AUTHVERSION", + "value": "${OS_IDENTITY_API_VERSION}" + }, + { + "name": "SWIFT_PROJECT_DOMAIN_NAME", + "value": "${OS_PROJECT_DOMAIN_NAME}" + }, + { + "name": "SWIFT_TENANTID", + "value": "${OS_TENANT_ID}" + }, + { + "name": "SWIFT_USERNAME", + "value": "${OS_USERNAME}" + }, + { + "name": "SWIFT_PASSWORD", + "value": "${OS_PASSWORD}" + }, + { + "name": "SWIFT_REGIONNAME", + "value": "${HOT_OS_REGION_NAME}" + } + ], + "prefixes": ["hot_"] + } +] +EOF |