summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPavel Raiskup <praiskup@redhat.com>2014-05-14 13:33:10 +0200
committerPavel Raiskup <praiskup@redhat.com>2014-05-14 13:34:35 +0200
commitdb86644b121cb6c73c67a7d622b11666992496d2 (patch)
tree8d1b6ac0f580c63ade5c0b620fc5e0f433afadeb
parent0e8ad70f11c648dfa6f62a9f64dedacbd08b111e (diff)
downloadpostgresql-setup-db86644b121cb6c73c67a7d622b11666992496d2.tar.gz
postgresql-setup-db86644b121cb6c73c67a7d622b11666992496d2.tar.xz
postgresql-setup-db86644b121cb6c73c67a7d622b11666992496d2.zip
postgresql-setup: work even if $PATH is unset or empty
.. by setting $PATH to default value. Also check for command existence by 'command' built-in instead of checking for file existence. Version: 9.3.4-2 Resolves: #1097317
-rwxr-xr-xpostgresql-setup4
1 files changed, 3 insertions, 1 deletions
diff --git a/postgresql-setup b/postgresql-setup
index acf07f7..7ce7b9f 100755
--- a/postgresql-setup
+++ b/postgresql-setup
@@ -2,6 +2,8 @@
#
# postgresql-setup - Initialization and upgrade operations for PostgreSQL
+test -z "$PATH" && export PATH="/sbin:/usr/sbin:/bin:/usr/bin"
+
test x"$PGSETUP_DEBUG" != x && set -x
# PGVERSION is the full package version, e.g., 9.0.2
@@ -100,7 +102,7 @@ export PGDATA
export PGPORT
# For SELinux we need to use 'runuser' not 'su'
-if [ -x /sbin/runuser ]; then
+if command -v runuser &>/dev/null; then
SU=runuser
else
SU=su