summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--NEWS2
-rw-r--r--postgresql-setup.in6
2 files changed, 6 insertions, 2 deletions
diff --git a/NEWS b/NEWS
index 277a7b2..dae256a 100644
--- a/NEWS
+++ b/NEWS
@@ -5,6 +5,8 @@ New in 3.0 version
* Use 'pg_upgrade --username' instead of 'pg_upgrade --user' for
PostgreSQL >= 9.4.
+* postgresql-setup now works if postgres user is /bin/nologin
+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
New in 2.0 version
diff --git a/postgresql-setup.in b/postgresql-setup.in
index 17a14f0..959ee06 100644
--- a/postgresql-setup.in
+++ b/postgresql-setup.in
@@ -29,6 +29,8 @@ POSTGRES_HOMEDIR=@POSTGRES_HOMEDIR@
SU=@SU@
+SU_L_POSTGRES="$SU -s /bin/sh -l postgres"
+
# The where PostgreSQL server listens by default
PGPORT_DEF=5432
@@ -124,7 +126,7 @@ perform_initdb()
initdbcmd="$PGENGINE/initdb --pgdata='$pgdata' --auth='ident'"
initdbcmd+=" $PGSETUP_INITDB_OPTIONS"
- $SU -l postgres -c "$initdbcmd" >> "$initdb_log" 2>&1 < /dev/null
+ $SU_L_POSTGRES -c "$initdbcmd" >> "$initdb_log" 2>&1 < /dev/null
# Create directory for postmaster log files
mkdir "$pgdata/pg_log"
@@ -221,7 +223,7 @@ upgrade()
# Create empty new-format database
if perform_initdb; then
# Do the upgrade
- $SU -l postgres -c "$PGENGINE/pg_upgrade \
+ $SU_L_POSTGRES -c "$PGENGINE/pg_upgrade \
'--old-bindir=$PREVPGENGINE' \
'--new-bindir=$PGENGINE' \
'--old-datadir=$pgdataold' \