From f4c9ad15aff0395a2e64c1c8e72efd63d6b0c16c Mon Sep 17 00:00:00 2001 From: Silvio Rhatto Date: Tue, 24 Mar 2015 10:44:45 -0300 Subject: Rename duplicity template --- templates/dup.conf.erb | 52 -------------------------------------------- templates/duplicity.conf.erb | 52 ++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 52 insertions(+), 52 deletions(-) delete mode 100644 templates/dup.conf.erb create mode 100644 templates/duplicity.conf.erb diff --git a/templates/dup.conf.erb b/templates/dup.conf.erb deleted file mode 100644 index 03c9342..0000000 --- a/templates/dup.conf.erb +++ /dev/null @@ -1,52 +0,0 @@ -#!/bin/bash -# -# This configuration file was auto-generated by the Puppet configuration -# management system. Any changes you make to this file will be overwritten -# the next time Puppet runs. Please make configuration changes to this -# service in Puppet. -# -# TODO: custom log file - -BACKUP_FOLDER="<%= directory %>" -FULL_IF_OLDER_THAN="<%= full_if_older_than %>" -REMOVE_OLDER_THAN="<%= remove_older_than %>" -REMOVE_ALL_BUT_N_FULL="<%= remove_all_but_n_full %>" -ENCRYPT_KEY="<%= encryptkey %>" -SIGN_KEY="<%= encryptkey %>" -<% exclude_unencrypted.each do |del| -%> -EXCLUDE="$EXCLUDE --exclude <%= del %>" -<% end -%> -<% include_unencrypted.each do |add| -%> -INCLUDE="$INCLUDE --include <%= add %>" -<% end -%> - -# some systems have a limited /tmp folder -TMP="/var/tmp" -mkdir -p $TMP - -export PASSPHRASE='<%= password %>' -mkdir -p $BACKUP_FOLDER - -# adds support for checking the existing backup -if [ "$1" == "--check" ]; then - duplicity collection-status file:///$BACKUP_FOLDER -else - # cleanup any previous broken backups - duplicity cleanup file:///$BACKUP_FOLDER --force - # it's important to let $EXCLUDE come before $INCLUDE to - # have greater precedence; see duplicity(1) for more info - duplicity -v6 --full-if-older-than $FULL_IF_OLDER_THAN \ - --tempdir $TMP --encrypt-key $ENCRYPT_KEY --sign-key $SIGN_KEY \ - --exclude $TMP $EXCLUDE $INCLUDE --exclude '**' / file:///$BACKUP_FOLDER - - if [ "$?" != "0" ]; then - fatal "Duplicity backup failed." - fi - - duplicity remove-older-than $REMOVE_OLDER_THAN file:///$BACKUP_FOLDER --force || exit 1 - duplicity remove-all-but-n-full $REMOVE_ALL_BUT_N_FULL file:///$BACKUP_FOLDER --force || exit 1 - - if [ "$?" != "0" ]; then - fatal "Removal of old backups failed." - fi -fi diff --git a/templates/duplicity.conf.erb b/templates/duplicity.conf.erb new file mode 100644 index 0000000..03c9342 --- /dev/null +++ b/templates/duplicity.conf.erb @@ -0,0 +1,52 @@ +#!/bin/bash +# +# This configuration file was auto-generated by the Puppet configuration +# management system. Any changes you make to this file will be overwritten +# the next time Puppet runs. Please make configuration changes to this +# service in Puppet. +# +# TODO: custom log file + +BACKUP_FOLDER="<%= directory %>" +FULL_IF_OLDER_THAN="<%= full_if_older_than %>" +REMOVE_OLDER_THAN="<%= remove_older_than %>" +REMOVE_ALL_BUT_N_FULL="<%= remove_all_but_n_full %>" +ENCRYPT_KEY="<%= encryptkey %>" +SIGN_KEY="<%= encryptkey %>" +<% exclude_unencrypted.each do |del| -%> +EXCLUDE="$EXCLUDE --exclude <%= del %>" +<% end -%> +<% include_unencrypted.each do |add| -%> +INCLUDE="$INCLUDE --include <%= add %>" +<% end -%> + +# some systems have a limited /tmp folder +TMP="/var/tmp" +mkdir -p $TMP + +export PASSPHRASE='<%= password %>' +mkdir -p $BACKUP_FOLDER + +# adds support for checking the existing backup +if [ "$1" == "--check" ]; then + duplicity collection-status file:///$BACKUP_FOLDER +else + # cleanup any previous broken backups + duplicity cleanup file:///$BACKUP_FOLDER --force + # it's important to let $EXCLUDE come before $INCLUDE to + # have greater precedence; see duplicity(1) for more info + duplicity -v6 --full-if-older-than $FULL_IF_OLDER_THAN \ + --tempdir $TMP --encrypt-key $ENCRYPT_KEY --sign-key $SIGN_KEY \ + --exclude $TMP $EXCLUDE $INCLUDE --exclude '**' / file:///$BACKUP_FOLDER + + if [ "$?" != "0" ]; then + fatal "Duplicity backup failed." + fi + + duplicity remove-older-than $REMOVE_OLDER_THAN file:///$BACKUP_FOLDER --force || exit 1 + duplicity remove-all-but-n-full $REMOVE_ALL_BUT_N_FULL file:///$BACKUP_FOLDER --force || exit 1 + + if [ "$?" != "0" ]; then + fatal "Removal of old backups failed." + fi +fi -- cgit v1.2.3