aboutsummaryrefslogtreecommitdiff
path: root/duply/scripts
diff options
context:
space:
mode:
authorSébastien Dailly <sebastien@chimrod.com>2020-09-05 12:04:56 +0200
committerSébastien Dailly <sebastien@chimrod.com>2020-09-05 12:10:13 +0200
commitb9852c7d93fdd9aa2eea4787688afb5cebc71fcf (patch)
tree9e382e6d2dad73ed17e987729663b9ba853f804a /duply/scripts
parent8ef9678d0a0f7b30a3c6afca6af70aa505f1a51f (diff)
Added duply configuration
Diffstat (limited to 'duply/scripts')
-rw-r--r--duply/scripts/duplicity/duply_common.sh25
-rwxr-xr-xduply/scripts/duplicity/gen_config_remote.sh84
2 files changed, 109 insertions, 0 deletions
diff --git a/duply/scripts/duplicity/duply_common.sh b/duply/scripts/duplicity/duply_common.sh
new file mode 100644
index 0000000..0a55b64
--- /dev/null
+++ b/duply/scripts/duplicity/duply_common.sh
@@ -0,0 +1,25 @@
+JSON_CONF=$(mktemp)
+cleanup() {
+ rm -f "${JSON_CONF}"
+}
+trap cleanup INT TERM EXIT
+
+function gpg_export_if_needed {
+ echo "Prevent GPG keys for beeing exported"
+}
+
+# Override the read command with zenity
+read() {
+ if command -v zenity &> /dev/null
+ then
+ eval $2=$(zenity --password)
+ else
+ command read $*
+ fi
+}
+. ~/.config/ovh/duplicity-$(whoami).sh
+
+#Generate the configuration
+~/scripts/duplicity/gen_config_remote.sh "${JSON_CONF}"
+
+TARGET="multi:${JSON_CONF}?mode=mirror&onfail=continue"
diff --git a/duply/scripts/duplicity/gen_config_remote.sh b/duply/scripts/duplicity/gen_config_remote.sh
new file mode 100755
index 0000000..55f5a34
--- /dev/null
+++ b/duply/scripts/duplicity/gen_config_remote.sh
@@ -0,0 +1,84 @@
+#!/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": "pca://${STORAGE_NAME}",
+ "env": [
+ {
+ "name": "PCA_AUTHURL",
+ "value": "${OS_AUTH_URL}"
+ },
+ {
+ "name": "PCA_AUTHVERSION",
+ "value": "${OS_IDENTITY_API_VERSION}"
+ },
+ {
+ "name": "PCA_PROJECT_DOMAIN_NAME",
+ "value": "Default"
+ },
+ {
+ "name": "PCA_TENANTID",
+ "value": "${OS_TENANT_ID}"
+ },
+ {
+ "name": "PCA_USERNAME",
+ "value": "${OS_USERNAME}"
+ },
+ {
+ "name": "PCA_PASSWORD",
+ "value": "${OS_PASSWORD}"
+ },
+ {
+ "name": "PCA_REGIONNAME",
+ "value": "${PCA_OS_REGION_NAME}"
+ }
+ ],
+ "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