diff options
author | Pavel Raiskup <praiskup@redhat.com> | 2015-02-10 10:49:36 +0100 |
---|---|---|
committer | Pavel Raiskup <praiskup@redhat.com> | 2015-02-10 10:49:36 +0100 |
commit | 84219fefff0b9d00c94c72cf0cd903611b1cf05f (patch) | |
tree | 264b76025c5b9536123def9a3990bc7922cc3213 /postgresql.init.in | |
parent | 82b9bab207ea3cc351581bab89abce48cff2ad12 (diff) | |
download | postgresql-setup-84219fefff0b9d00c94c72cf0cd903611b1cf05f.tar.gz postgresql-setup-84219fefff0b9d00c94c72cf0cd903611b1cf05f.tar.xz postgresql-setup-84219fefff0b9d00c94c72cf0cd903611b1cf05f.zip |
configury: use one single variable SU_POSTGRES
We use 'su' only for 'postgres' user purposes. So have one,
configure-time-proven command. Also, in the previous commit I
forgot to fix sysvinit file.
* configure.ac (SU_POSTGRES): New variable.
* postgresql-setup.in ($SU_POSTGRES): Use detected @SU_POSTGRES@.
($SU, $SU_L_POSTGRES): Avoid usage of those.
* postgresql.init.in: Likewise.
* .gitignore: Remove typoed ignore.
Diffstat (limited to 'postgresql.init.in')
-rw-r--r-- | postgresql.init.in | 19 |
1 files changed, 6 insertions, 13 deletions
diff --git a/postgresql.init.in b/postgresql.init.in index f3e21c8..b183486 100644 --- a/postgresql.init.in +++ b/postgresql.init.in @@ -46,14 +46,7 @@ then NAME=${NAME:3} fi -# For SELinux we need to use 'runuser' not 'su' -if [ -x /sbin/runuser ] -then - SU=runuser -else - SU=su -fi - +SU_POSTGRES="@SU_POSTGRES@" # Set defaults for configuration variables PGENGINE=/usr/bin @@ -120,7 +113,7 @@ start(){ echo -n "$PSQL_START" test x"$PG_OOM_ADJ" != x && echo "$PG_OOM_ADJ" > /proc/self/oom_adj - $SU -l postgres -c "$PGENGINE/postmaster -p '$PGPORT' -D '$PGDATA' ${PGOPTS} &" >> "$PGLOG" 2>&1 < /dev/null + $SU_POSTGRES -c "$PGENGINE/postmaster -p '$PGPORT' -D '$PGDATA' ${PGOPTS} &" >> "$PGLOG" 2>&1 < /dev/null sleep 2 pid=`head -n 1 "$PGDATA/postmaster.pid" 2>/dev/null` if [ "x$pid" != x ] @@ -140,7 +133,7 @@ stop(){ echo -n $"Stopping ${NAME} service: " if [ -e "$lockfile" ] then - $SU -l postgres -c "$PGENGINE/pg_ctl stop -D '$PGDATA' -s -m fast" > /dev/null 2>&1 < /dev/null + $SU_POSTGRES -c "$PGENGINE/pg_ctl stop -D '$PGDATA' -s -m fast" > /dev/null 2>&1 < /dev/null ret=$? if [ $ret -eq 0 ] then @@ -168,7 +161,7 @@ condrestart(){ } reload(){ - $SU -l postgres -c "$PGENGINE/pg_ctl reload -D '$PGDATA' -s" > /dev/null 2>&1 < /dev/null + $SU_POSTGRES -c "$PGENGINE/pg_ctl reload -D '$PGDATA' -s" > /dev/null 2>&1 < /dev/null } # code shared between initdb and upgrade actions @@ -192,7 +185,7 @@ perform_initdb(){ fi # Initialize the database - $SU -l postgres -c "$PGENGINE/initdb --pgdata='$PGDATA' --auth='ident'" >> "$PGLOG" 2>&1 < /dev/null + $SU_POSTGRES -c "$PGENGINE/initdb --pgdata='$PGDATA' --auth='ident'" >> "$PGLOG" 2>&1 < /dev/null # Create directory for postmaster log mkdir "$PGDATA/pg_log" @@ -267,7 +260,7 @@ upgrade(){ if perform_initdb then # Do the upgrade - $SU -l postgres -c "$PGENGINE/pg_upgrade \ + $SU_POSTGRES -c "$PGENGINE/pg_upgrade \ '--old-bindir=$PREVPGENGINE' \ '--new-bindir=$PGENGINE' \ '--old-datadir=$PGDATAOLD' \ |