Description: Make possible to configure the permissions of backup files
Author: Emmanuel Bouthenot <kolter@debian.org>
Forwarded: no
Last-Update: 2014-11-04
---
This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
--- a/autopostgresqlbackup
+++ b/autopostgresqlbackup
@@ -99,6 +99,9 @@
 # Backup files extension
 EXT="sql"
 
+# Backup files permissions
+PERM=600
+
 # Encyrption settings
 # (inspired by http://blog.altudov.com/2010/09/27/using-openssl-for-asymmetric-encryption-of-backups/)
 #
@@ -353,7 +356,7 @@
 dbdump () {
 	rm -f $2
 	touch $2
-	chmod 600 $2
+	chmod $PERM $2
 	for db in $1 ; do
 		if [ -n "$SU_USERNAME" ]; then
 			if [ "$db" = "$GLOBALS_OBJECTS" ]; then
@@ -385,6 +388,7 @@
 			-out "$ENCRYPTED_FILE" \
 			-in "$1" "$ENCRYPTION_PUBLIC_KEY" ; then
 			echo "	and remove $1"
+			chmod $PERM "$ENCRYPTED_FILE"
 			rm -f "$1"
 		fi
 	fi
