diff options
author | Pavel Raiskup <praiskup@redhat.com> | 2014-07-01 14:18:39 +0200 |
---|---|---|
committer | Pavel Raiskup <praiskup@redhat.com> | 2014-07-01 14:18:39 +0200 |
commit | bbb9575cc6af844496386afe17603319ceccf1d9 (patch) | |
tree | 88a784def7340ed397e5588c1e5a3fdf3ea7951f | |
parent | 7b1bb4fd5a05b9c35ae23734f12b2a92fe5f0a57 (diff) | |
download | postgresql-setup-bbb9575cc6af844496386afe17603319ceccf1d9.tar.gz postgresql-setup-bbb9575cc6af844496386afe17603319ceccf1d9.tar.xz postgresql-setup-bbb9575cc6af844496386afe17603319ceccf1d9.zip |
postgresql-ctl: use detected PG_CTL_BIN
-rw-r--r-- | Makefile.am | 1 | ||||
-rw-r--r-- | configure.ac | 33 | ||||
-rw-r--r-- | postgresql-ctl.in | 4 |
3 files changed, 32 insertions, 6 deletions
diff --git a/Makefile.am b/Makefile.am index ddd8b78..48cf2d7 100644 --- a/Makefile.am +++ b/Makefile.am @@ -20,6 +20,7 @@ edit = $(SED) \ -e 's|@DISTSUFF[@]|$(DISTSUFF)|g' \ -e 's|@INITDB_LOG[@]|$(INITDB_LOG)|g' \ -e 's|@libexecdir[@]|$(libexecdir)|g' \ + -e 's|@PG_CTL_BIN[@]|$(PG_CTL_BIN)|g' \ -e 's|@PGDATADIR[@]|$(PGDATADIR)|g' \ -e 's|@pgdocdir[@]|$(pgdocdir)|g' \ -e 's|@PGENGINE[@]|$(PGENGINE)|g' \ diff --git a/configure.ac b/configure.ac index 33bb4ef..29e083e 100644 --- a/configure.ac +++ b/configure.ac @@ -42,10 +42,27 @@ m4_define([subst_required_var], [ AC_MSG_ERROR([the \$$1 variable is not set]) ]) -# Check for main PostgreSQL binary -# -------------------------------- -AC_ARG_VAR([POSTGRES_BIN], [full path to postgres binary]) +# Check for main PostgreSQL binaries +# ---------------------------------- + +AC_ARG_VAR([POSTGRES_BIN], [Full path to postgres binary. Note that based on + package ownership of this file the package names (like + postgresql-server, postgresql, ..) are detected.]) +AC_PATH_PROG([POSTGRES_BIN], [postgres]) + + +# Check for main PostgreSQL packages +# ---------------------------------- + +case "$distro_family" in +redhat) + rpm_pkgname_server=$(rpm -qf $POSTGRES_BIN --qf '%{NAME}') + rpm_pkgname=${rpm_pkgname_server%%-*} + ;; +esac + + AC_PATH_PROG([POSTGRES_BIN], [postgres]) @@ -75,6 +92,16 @@ if test -z "$PGENGINE"; then PGENGINE=`AS_DIRNAME($POSTGRES_BIN)` fi +# Detect pg_ctl binary +# -------------------- +if test -z "$PG_CTL_BIN"; then + PG_CTL_BIN=$PGENGINE/pg_ctl +fi +test ! -e "$PG_CTL_BIN" && + AC_MSG_ERROR([pg_ctl binary not found]) +AC_SUBST([PG_CTL_BIN]) + + # pg_upgrade binary # ----------------- diff --git a/postgresql-ctl.in b/postgresql-ctl.in index 1fe9838..1327b41 100644 --- a/postgresql-ctl.in +++ b/postgresql-ctl.in @@ -4,6 +4,4 @@ # postgresql.service. There is not possible to do conditional step in service # file based on (non)existence of PGPORT variable. -PG_CTL=/usr/bin/pg_ctl - -$PG_CTL "$@" ${PGPORT+-o "-p $PGPORT"} +@PG_CTL_BIN@ "$@" ${PGPORT+-o "-p $PGPORT"} |