diff options
| author | Pavel Raiskup <praiskup@redhat.com> | 2015-03-17 11:34:21 +0100 |
|---|---|---|
| committer | Pavel Raiskup <praiskup@redhat.com> | 2015-03-17 13:52:47 +0100 |
| commit | 81e523c0957a9bee557bf2cca25607989209ac2c (patch) | |
| tree | 5789b6030b105b18b8820f07dae5b3947f7a7844 /Makefile.am | |
| parent | f7a46224bd60e177871a46ffd99f0492cb6e8b6f (diff) | |
| download | postgresql-setup-81e523c0957a9bee557bf2cca25607989209ac2c.tar.gz postgresql-setup-81e523c0957a9bee557bf2cca25607989209ac2c.tar.xz postgresql-setup-81e523c0957a9bee557bf2cca25607989209ac2c.zip | |
sysvinit: transform for SCL & RHEL6 usage
This is mostly about simplification of intiscript and postgresql-setup
script reuse. Still WIP, however (some options are not applicable for
sysvinit system).
* share/postgresql-setup/library.sh.in (parse_upgrade_setup): Parse new
variable "pghost_override".
(run_cmd_as_dbadmin): New wrapper function to run something under
"postgres" user. Cut from postgresql-setup.
* postgresql-setup.in: Optionally source software collections. Call new
check_daemon_reload instead of in-place checking.
(upgrade): Use new library function run_cmd_as_dbadmin. Add new hack
for $PGHOST overriding via $pghost_override. Add more verbose output to
make clear what tool failed.
(check_daemon_reload): New function to make the systemd daemon reload
conditionally on one dedicated place.
(handle_envfile): New function to abstract environment file parsing,
works both for systemd & sysvinit env-files.
(handle_service_envfiles): Use handle_envfile instead of in-place
parsing.
(service_configuration): For sysvinit supported configuration, we
support only one env file per service - take this into account and don't
try to detect many from systemctl output.
* postgresql.init.in: Switch to bash script. Parametrize metadata by
configure results. Source software collections when needed. Source
project library. Don't set PGDATA if admin uses non-default service
naem. Do not define PGPORT as PGPORT should be defined in
postgresql.conf. Allow passing parameters into initdb/upgrade targets.
($PREVMAJORVERSION, $PREVPGENGINE): Remove unused variables.
($PGENGINE): This is @bindir@ equivalent.
($PGLOG): Spell it so it will not clash with system default PostgreSQL
installation.
($pidfile): Use $NAME instead of $PID to distinguish multiple postmaster
scenarios (mainly because we do not know the PGPORT yet).
(start): Drop the checking logic and use postgresql-check-db-dir
instead. Reuse run_cmd_as_dbadmin instead of $SU_POSTGRES.
(stop): Use run_cmd_as_dbadmin instead of $SU_POSTGRES.
(reload): Just coding style fix.
(perform_initdb): Drop unused function, done in postgresql-setup.
(__single_comand): Mostly postgresql-setup wrapper with success/failure
sugar around the call itself.
(initdb): Substitute the function body with postgresql-setup call.
(upgrade): Likewise.
* postgresql-check-db-dir.in: Fix the hint for admin about where the
service should be initialized. Do not warn about systemd-only
unsupported configuration. Add @bindir@ into "you need --initdb" hint.
Re-style the warning a bit.
* etc/postgresql-setup/upgrade/postgresql.conf: Mention new
configuration option pghost_override.
* configure.ac (initscriptsconfdir): New configuration directory.
(PGMAJORVERSION): Use sed and regexp for MAJOR version mining. It
failed for micro versions of length >= 2.
(SCL_SOURCE): Define to be empty by default.
* README: Document what's needed to bootstrap from git source. WIP.
* Makefile.am (initscripts_DATA): Use noinst_DATA. Firstly, having
initscripts_DATA installs only non-executable files. So we needed
something with _SCRIPTS primary. But initscripts_SCRIPTS would face the
automake's limitation that it must be "static" list of files. So make
the installation of initscript (of dynamically generated name) via
automake's install/uninstall.
($(initscript)): Use $(INSTANTIATE_SCRIPT) instead of $(INSTANTIATE).
(install-data-hook): Call 'systemctl daemon-reload' only for
non-sysvinit systems.
* .gitignore: Ignore 'initscript' filename.
Diffstat (limited to 'Makefile.am')
| -rw-r--r-- | Makefile.am | 24 |
1 files changed, 19 insertions, 5 deletions
diff --git a/Makefile.am b/Makefile.am index bad62ec..123f2b4 100644 --- a/Makefile.am +++ b/Makefile.am @@ -12,7 +12,7 @@ service_in = postgresql.service.in serviceat = $(NAME_SERVICE)@.service serviceat_in = postgresql.service.in -initscript = $(NAME_SERVICE) +initscript = initscript initscript_in = postgresql.init.in readme_dist = README.rpm-dist @@ -35,9 +35,12 @@ libexec_SCRIPTS = $(ctl) $(checkdb) legacyscriptsdir = $(systemdlegacyscriptsdir)/$(NAME_SERVICE) +noinst_DATA = + # TODO: Ideally, 'make distcheck' should check every file we generate. if WANT_SYSVINIT -initscripts_DATA = $(initscript) +noinst_DATA += $(initscript) +GENERATED_FILES += $(initscript) else systemdunits_DATA = $(service) $(serviceat) legacyscripts_SCRIPTS = initdb upgrade @@ -45,7 +48,7 @@ endif pgdoc_DATA = $(readme_dist) -noinst_DATA = $(TEST_GEN_FILES_LIST) +noinst_DATA += $(TEST_GEN_FILES_LIST) $(ctl): $(ctl_in) $(c_s) $(INSTANTIATE_SCRIPT) @@ -57,7 +60,7 @@ $(checkdb): $(check) $(checkdb_in) $(c_s) $(INSTANTIATE_SCRIPT) $(initscript): $(initscript_in) $(c_s) - $(INSTANTIATE) + $(INSTANTIATE_SCRIPT) initdb upgrade: legacy-sysv-script.in $(c_s) $(INSTANTIATE_SCRIPT) @@ -105,7 +108,6 @@ GENERATED_FILES += \ $(pgdoc_DATA) \ $(pkgsysconf_DATA) \ $(systemdunits_DATA) \ - $(initscripts_DATA) \ $(legacyscripts_SCRIPTS) INTERMEDIATE_FILES += \ @@ -122,9 +124,21 @@ $(TEST_GEN_FILES_LIST): $(GENERATED_FILES) done install-data-hook: +if WANT_SYSVINIT +else test `id -u` -ne 0 || systemctl daemon-reload +endif $(MKDIR_P) $(DESTDIR)/$(sysconfdir)/$(NAME_BINARYBASE)-setup/upgrade +install-exec-hook: +if WANT_SYSVINIT + $(MKDIR_P) $(DESTDIR)/$(initscriptsdir) + $(install_sh_SCRIPT) $(initscript) $(DESTDIR)/$(initscriptsdir)/$(NAME_SERVICE) +endif + +uninstall-hook: + rm -rf $(DESTDIR)/$(initscriptsdir)/$(NAME_SERVICE) + GL_GEN_BIN = gitlog-to-changelog GL_GEN = if test -d .git; then \ $(SHELL) $(top_srcdir)/$(config_aux_dir)/missing --run \ |
