summaryrefslogtreecommitdiffstats
path: root/postgresql-setup
diff options
context:
space:
mode:
authorJozef Mlich <jmlich@redhat.com>2013-12-13 09:12:08 +0100
committerPavel Raiskup <praiskup@redhat.com>2013-12-16 14:39:50 +0100
commit4626974b788cd71a08d0f800ec4dc07069034435 (patch)
treeede9f6562f2157b42c47a08d8b2c40320436b720 /postgresql-setup
parenta442d5c7accfed9683564381eed623bcd501c606 (diff)
downloadpostgresql-setup-4626974b788cd71a08d0f800ec4dc07069034435.tar.gz
postgresql-setup-4626974b788cd71a08d0f800ec4dc07069034435.tar.xz
postgresql-setup-4626974b788cd71a08d0f800ec4dc07069034435.zip
postgresql-setup: ignore misconfigure pg_hba.conf when upgrading
Resolves: #1040364 Version: 9.3.2-2
Diffstat (limited to 'postgresql-setup')
-rw-r--r--postgresql-setup25
1 files changed, 24 insertions, 1 deletions
diff --git a/postgresql-setup b/postgresql-setup
index a755e11..7400890 100644
--- a/postgresql-setup
+++ b/postgresql-setup
@@ -153,6 +153,20 @@ upgrade(){
rm -rf "$PGDATAOLD"
mv "$PGDATA" "$PGDATAOLD" || exit 1
+ # Create configuration file for upgrade process
+ HBA_CONF_BACKUP="$PGDATAOLD/pg_hba.conf.postgresql-setup.`date +%s`"
+ HBA_CONF_BACKUP_EXISTS=0
+
+ if [ ! -f $HBA_CONF_BACKUP ]; then
+ mv "$PGDATAOLD/pg_hba.conf" "$HBA_CONF_BACKUP"
+ HBA_CONF_BACKUP_EXISTS=1
+
+ # For fluent upgrade 'postgres' user should be able to connect
+ # to any database without password. Temporarily, no other type
+ # of connection is needed.
+ /usr/bin/echo -e "local all postgres ident" > "$PGDATAOLD/pg_hba.conf"
+ fi
+
echo -n $"Upgrading database: "
# Create empty new-format database
@@ -177,9 +191,18 @@ upgrade(){
script_result=1
fi
+ if [ x$HBA_CONF_BACKUP_EXISTS = x1 ]; then
+ mv -f "$HBA_CONF_BACKUP" "$PGDATAOLD/pg_hba.conf"
+ fi
+
+
if [ $script_result -eq 0 ]
then
- echo $"OK"
+ echo $"OK"
+ echo
+ echo $"The configuration files was replaced by default configuration."
+ echo $"The previous configuration and data are stored in folder"
+ echo $PGDATAOLD.
else
# Clean up after failure
rm -rf "$PGDATA"