diff options
author | Pavel Raiskup <praiskup@redhat.com> | 2014-09-16 09:23:11 +0200 |
---|---|---|
committer | Pavel Raiskup <praiskup@redhat.com> | 2014-09-16 13:46:48 +0200 |
commit | 9f51b237a5cda60597e0fb43de24612223cc60d6 (patch) | |
tree | 87051e1e12f18b6ba924ac0cc3af264b156f62db | |
parent | c9bdc25b4d117b63c7bae4a1400e0ade3cd7a41b (diff) | |
download | postgresql-setup-9f51b237a5cda60597e0fb43de24612223cc60d6.tar.gz postgresql-setup-9f51b237a5cda60597e0fb43de24612223cc60d6.tar.xz postgresql-setup-9f51b237a5cda60597e0fb43de24612223cc60d6.zip |
postgresql.service: un-link with postgresql@.service
We need to create both files separately as (a) the
'postgresql.service' can not .include 'postgresql@.service' for
some reason, /usr/lib/ drop-in breaks things (rhbz#1141824) and
we want to have PGDATA unset for postgresql@.service, unlike the
postgresql.service file.
-rw-r--r-- | Makefile.am | 30 | ||||
-rw-r--r-- | postgresql.service.in | 2 |
2 files changed, 24 insertions, 8 deletions
diff --git a/Makefile.am b/Makefile.am index f932651..809980f 100644 --- a/Makefile.am +++ b/Makefile.am @@ -8,15 +8,17 @@ libexec_SCRIPTS = postgresql$(DISTSUFF)-ctl \ pkgsysconfdir = $(PKGCONFIG_DIR) pkgsysconf_DATA = conf/postgresql$(DISTSUFF) +userunitsdir = /etc/systemd/system + systemdunitsdir = $(prefix)/lib/systemd/system -nodist_systemdunits_DATA = postgresql$(DISTSUFF).service +nodist_systemdunits_DATA = postgresql$(DISTSUFF).service postgresql$(DISTSUFF)@.service nodist_pgdoc_DATA = README.rpm-dist # 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) \ +SED_RULES = \ -e 's|@DISTSUFF[@]|$(DISTSUFF)|g' \ -e 's|@libdir[@]|$(libdir)|g' \ -e 's|@libexecdir[@]|$(libexecdir)|g' \ @@ -32,8 +34,13 @@ edit = $(SED) \ -e 's|@PREVPGENGINE[@]|$(PREVPGENGINE)|g' \ -e 's|@README_DIST[@]|$(README_DIST)|g' \ -e 's|@SU[@]|$(SU)|g' \ + -e 's|@systemdunitsdir[@]|$(systemdunitsdir)|' \ -e 's|@VERSION[@]|$(VERSION)|g' \ - $< > $@ + -e 's|@__FILE__[@]|$@|g' + +SED_CALL = $(SED) $(SED_RULES) + +edit = $(SED_CALL) $< > $@ c_s = $(top_srcdir)/config.status @@ -53,8 +60,19 @@ postgresql$(DISTSUFF)-check-db-dir: postgresql-check-db-dir.in $(c_s) conf/postgresql$(DISTSUFF): conf/postgresql.in $(c_s) $(c_s_gen) +# In ideal world, postgresql@.service would be hardlink to postgresql.service. +# That would require, however, the rhbz#1141824 resolved so we could install +# system-default drop-in file. Make a "almost" duplicate files now. + +postgresql$(DISTSUFF)@.service: postgresql.service.in $(c_s) + $(AM_V_GEN)$(SED_CALL) \ + -e '/@PGDATA_ENVIRONMENT[@]/d' \ + $< > $@ + postgresql$(DISTSUFF).service: postgresql.service.in $(c_s) - $(c_s_gen) + $(AM_V_GEN)$(SED_CALL) \ + -e 's|@PGDATA_ENVIRONMENT[@]|Environment=PGDATA=$(PGDATADIR)|' \ + $< > $@ README.rpm-dist: README.rpm-dist.in $(c_s) $(c_s_gen) @@ -68,6 +86,4 @@ CLEANFILES = $(bin_SCRIPTS) \ $(nodist_systemdunits_DATA) install-data-hook: - rm -rf $(DESTDIR)$(systemdunitsdir)/postgresql$(DISTSUFF)@.service - ln $(DESTDIR)$(systemdunitsdir)/postgresql$(DISTSUFF).service \ - $(DESTDIR)$(systemdunitsdir)/postgresql$(DISTSUFF)@.service + test `id -u` -eq 0 && systemctl daemon-reload diff --git a/postgresql.service.in b/postgresql.service.in index ace3ebb..116675d 100644 --- a/postgresql.service.in +++ b/postgresql.service.in @@ -26,7 +26,7 @@ OOMScoreAdjust=-1000 Environment=PG_OOM_ADJUST_FILE=/proc/self/oom_score_adj Environment=PG_OOM_ADJUST_VALUE=0 -Environment=PGDATA=@PGDATADIR@ +@PGDATA_ENVIRONMENT@ ExecStartPre=@libexecdir@/postgresql-check-db-dir %N |