summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPavel Raiskup <praiskup@redhat.com>2015-02-10 08:18:11 +0100
committerPavel Raiskup <praiskup@redhat.com>2015-02-10 10:02:56 +0100
commit82b9bab207ea3cc351581bab89abce48cff2ad12 (patch)
treed2286023e1cdf502dda0854d2f479d63d17115f0
parent5ffd9429a89422b6e15f8d05c8ce3ad504e958de (diff)
downloadpostgresql-setup-82b9bab207ea3cc351581bab89abce48cff2ad12.tar.gz
postgresql-setup-82b9bab207ea3cc351581bab89abce48cff2ad12.tar.xz
postgresql-setup-82b9bab207ea3cc351581bab89abce48cff2ad12.zip
postgresql-setup: mention login shell explicitly
The setup script was reported to not work if user 'postgres' has /sbin/nologin in /etc/passwd (explicitly set by administrator). This configuration does not seem to be terribly useful but there is no need to fail at all. Resolves: rhbz#1122143 * postgresql-setup.in ($SU_L_POSTGRES): New wrapping variable, using '-s /bin/sh' to bypass /sbin/nologin. This option should be supported both by 'su' and 'runuser'. * NEWS: Document.
-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' \