From 4074d0a6adbdef0591578f477d9068a07ba5fd94 Mon Sep 17 00:00:00 2001 From: Sébastien Dailly Date: Thu, 18 Nov 2021 15:14:25 +0100 Subject: Sauvegardes avec duplicity --- content/resources/backup/gen_config.sh | 88 ++++++++++++++++++++++++++++ content/resources/backup/gen_config_local.sh | 58 ++++++++++++++++++ 2 files changed, 146 insertions(+) create mode 100755 content/resources/backup/gen_config.sh create mode 100755 content/resources/backup/gen_config_local.sh (limited to 'content/resources/backup') diff --git a/content/resources/backup/gen_config.sh b/content/resources/backup/gen_config.sh new file mode 100755 index 0000000..8091bed --- /dev/null +++ b/content/resources/backup/gen_config.sh @@ -0,0 +1,88 @@ +#!/bin/bash + +. ./$1 +OUTFILE=$2 +BACKUP_NAME=$3 + +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 > "${OUTFILE}" << EOF +[ + { + "description": "Cold storage", + "url": "pca://${BACKUP_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://${BACKUP_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 diff --git a/content/resources/backup/gen_config_local.sh b/content/resources/backup/gen_config_local.sh new file mode 100755 index 0000000..4e6c0dc --- /dev/null +++ b/content/resources/backup/gen_config_local.sh @@ -0,0 +1,58 @@ +#!/bin/bash + +. ./$1 +OUTFILE=$2 +BACKUP_NAME=$3 + +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 > "${OUTFILE}" << EOF +[ + { + "description": "Cold storage", + "url": "file://${BACKUP_NAME}", + "prefixes": ["cold_"] + }, + { + "description": "Hot storage", + "url": "swift://${BACKUP_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 -- cgit v1.2.3