diff options
author | Pavel Raiskup <praiskup@redhat.com> | 2014-07-01 13:41:43 +0200 |
---|---|---|
committer | Pavel Raiskup <praiskup@redhat.com> | 2014-07-01 13:44:30 +0200 |
commit | 7b1bb4fd5a05b9c35ae23734f12b2a92fe5f0a57 (patch) | |
tree | be4ca41ca8c8c169440fd5e4b474ff420867a791 | |
parent | 6472bbf1c6d2ad140a7502a7788ed6c4a9193a7d (diff) | |
download | postgresql-setup-7b1bb4fd5a05b9c35ae23734f12b2a92fe5f0a57.tar.gz postgresql-setup-7b1bb4fd5a05b9c35ae23734f12b2a92fe5f0a57.tar.xz postgresql-setup-7b1bb4fd5a05b9c35ae23734f12b2a92fe5f0a57.zip |
postgresql-check-db-dir generated also
Also generate files using sed as is suggested by autoconf manual
(and the autoconf project does so internally).
-rw-r--r-- | .gitignore | 3 | ||||
-rw-r--r-- | Makefile.am | 44 | ||||
-rw-r--r-- | TODO | 2 | ||||
-rw-r--r-- | configure.ac | 6 | ||||
-rw-r--r-- | postgresql-check-db-dir.in (renamed from postgresql-check-db-dir) | 22 | ||||
-rw-r--r-- | postgresql.service.in | 2 |
6 files changed, 56 insertions, 23 deletions
@@ -9,8 +9,9 @@ install-sh missing *.log INSTALL -postgresql*-setup +postgresql*-check-db-dir postgresql*-ctl +postgresql*-setup postgresql*-setup.1 *.tar.gz conf/postgresql* diff --git a/Makefile.am b/Makefile.am index d09ee3d..ddd8b78 100644 --- a/Makefile.am +++ b/Makefile.am @@ -2,34 +2,60 @@ SUBDIRS = . doc bin_SCRIPTS = postgresql$(DISTSUFF)-setup -libexec_SCRIPTS = postgresql$(DISTSUFF)-ctl +libexec_SCRIPTS = postgresql$(DISTSUFF)-ctl \ + postgresql$(DISTSUFF)-check-db-dir pkgsysconfdir = $(PKGCONFIG_DIR) pkgsysconf_DATA = conf/postgresql$(DISTSUFF) systemdunitsdir = $(prefix)/lib/systemd/system -systemdunits_DATA = postgresql$(DISTSUFF).service +nodist_systemdunits_DATA = postgresql$(DISTSUFF).service nodist_pgdoc_DATA = README.rpm-dist -c_s_gen = $(AM_V_GEN)cmd="$(top_srcdir)/config.status --file=$@:$<" ; \ - if $(AM_V_P); then $$cmd; else $$cmd &>/dev/null; fi +# Encouraged by autoconf documentation itself. When we use config.status +# directly, e.g. libexecdir may result into '${exec_prefix}/libexec' -- but we +# need fully expanded strings there. +edit = $(SED) \ + -e 's|@DISTSUFF[@]|$(DISTSUFF)|g' \ + -e 's|@INITDB_LOG[@]|$(INITDB_LOG)|g' \ + -e 's|@libexecdir[@]|$(libexecdir)|g' \ + -e 's|@PGDATADIR[@]|$(PGDATADIR)|g' \ + -e 's|@pgdocdir[@]|$(pgdocdir)|g' \ + -e 's|@PGENGINE[@]|$(PGENGINE)|g' \ + -e 's|@PGMAJORVERSION[@]|$(PGMAJORVERSION)|g' \ + -e 's|@PGVERSION[@]|$(PGVERSION)|g' \ + -e 's|@PKGCONFIG_DIR[@]|$(PKGCONFIG_DIR)|g' \ + -e 's|@PREVMAJORVERSION[@]|$(PREVMAJORVERSION)|g' \ + -e 's|@PREVPGENGINE[@]|$(PREVPGENGINE)|g' \ + -e 's|@README_DIST[@]|$(README_DIST)|g' \ + -e 's|@SU[@]|$(SU)|g' \ + -e 's|@UPGRADE_LOG[@]|$(UPGRADE_LOG)|g' \ + -e 's|@VERSION[@]|$(VERSION)|g' \ + $< > $@ + +c_s = $(top_srcdir)/config.status + +c_s_gen = $(AM_V_GEN)$(edit) c_s_script_gen = $(c_s_gen) && chmod +x $@ -postgresql$(DISTSUFF)-ctl: postgresql-ctl.in +postgresql$(DISTSUFF)-ctl: postgresql-ctl.in $(c_s) + $(c_s_script_gen) + +postgresql$(DISTSUFF)-setup: postgresql-setup.in $(c_s) $(c_s_script_gen) -postgresql$(DISTSUFF)-setup: postgresql-setup.in +postgresql$(DISTSUFF)-check-db-dir: postgresql-check-db-dir.in $(c_s) $(c_s_script_gen) -conf/postgresql$(DISTSUFF): conf/postgresql.in +conf/postgresql$(DISTSUFF): conf/postgresql.in $(c_s) $(c_s_gen) -postgresql$(DISTSUFF).service: postgresql.service.in +postgresql$(DISTSUFF).service: postgresql.service.in $(c_s) $(c_s_gen) -README.rpm-dist: README.rpm-dist.in +README.rpm-dist: README.rpm-dist.in $(c_s) $(c_s_gen) EXTRA_DIST = *.in conf/*.in @@ -0,0 +1,2 @@ +* Testsuite + - check that none of @PATTERN@ is un-expanded in generated files diff --git a/configure.ac b/configure.ac index 285b01f..33bb4ef 100644 --- a/configure.ac +++ b/configure.ac @@ -10,6 +10,10 @@ AM_SILENT_RULES([yes]) AC_ARG_VAR([DISTSUFF], [Append string suffix to all binaries]) AC_SUBST([DISTSUFF]) +AC_PATH_PROG([SED], [sed]) +test -z "$ac_cv_path_SED" && + AC_MSG_ERROR([Sed is needed but not found.]) + # For SELinux purposes use rather runuser AC_PATH_PROG([SU], [runuser]) test -z "$ac_cv_path_SU" && @@ -129,7 +133,7 @@ if test -z "$PGDATADIR" -a "$distro_family" = redhat; then fi # TODO -pgdocdir=/usr/share/postgresql/doc +pgdocdir=/usr/share/doc/postgresql AC_SUBST([pgdocdir]) # Deal with previous versions diff --git a/postgresql-check-db-dir b/postgresql-check-db-dir.in index 4266c7a..3514247 100644 --- a/postgresql-check-db-dir +++ b/postgresql-check-db-dir.in @@ -15,17 +15,17 @@ then exit 1 fi -# PGVERSION is the full package version, e.g., 9.1.2 -# Note: the specfile inserts the correct value during package build -PGVERSION=xxxx -# PGMAJORVERSION is major version, e.g., 9.1 (this should match PG_VERSION) -PGMAJORVERSION=`echo "$PGVERSION" | sed 's/^\([0-9]*\.[0-9]*\).*$/\1/'` -# PREVMAJORVERSION is the previous major version, e.g., 8.4, for upgrades -# Note: the specfile inserts the correct value during package build -PREVMAJORVERSION=xxxx -# PGDOCDIR is the directory containing the package's documentation -# Note: the specfile inserts the correct value during package build -PGDOCDIR=xxxx +# Full PostgreSQL version, e.g. 9.0.2 +PGVERSION=@PGVERSION@ + +# Major version of PostgreSQL, e.g. 9.0 +PGMAJORVERSION=@PGMAJORVERSION@ + +# Previous major version, e.g., 8.4, for upgrades +PREVMAJORVERSION=@PREVMAJORVERSION@ + +# Directory containing the postgresql package's documentation +PGDOCDIR=@pgdocdir@ # Check for the PGDATA structure if [ -f "$PGDATA/PG_VERSION" ] && [ -d "$PGDATA/base" ] diff --git a/postgresql.service.in b/postgresql.service.in index c865bcc..b67488e 100644 --- a/postgresql.service.in +++ b/postgresql.service.in @@ -27,7 +27,7 @@ OOMScoreAdjust=-1000 Environment=PG_OOM_ADJUST_FILE=/proc/self/oom_score_adj Environment=PG_OOM_ADJUST_VALUE=0 -ExecStartPre=/usr/bin/postgresql-check-db-dir ${PGDATA} +ExecStartPre=@libexecdir@/postgresql-check-db-dir ${PGDATA} # Temporarily use postgresql-ctl wrapper around pg_ctl until there will # exist clients which set PGPORT in service file. |