From bea99d7e37e57d209a146505313280c38c8548f1 Mon Sep 17 00:00:00 2001 From: Pavel Raiskup Date: Tue, 10 Feb 2015 13:24:16 +0100 Subject: legacy-scripts: generate them from single template As we do not consider the postgresql@ unit variants (that would require libexec/initscripts/legacy-actions/postgresql@CONCRETE symlink to the default legacy-scripts directory), there is no need to do run-time checks. * Makefile.am (upgrade): Create from legacy-sysv-script.in template. (initdb): Likewise. (systemdlegacyscripts_DATA): Substitute with .. (systemdlegacyscripts_SCRIPTS): .. this to have execute bit after installation. (GENERATED_FILES): Add _SCRIPTS variant for systemdlegacyscripts. * legacy-sysv-script.in: New unified template for legacy scripts. * initdb.in: Remove. * upgrade.in: Likewise. * NEWS: Document. --- Makefile.am | 10 +++------- NEWS | 3 +++ initdb.in | 16 ---------------- legacy-sysv-script.in | 6 ++++++ upgrade.in | 16 ---------------- 5 files changed, 12 insertions(+), 39 deletions(-) delete mode 100644 initdb.in create mode 100644 legacy-sysv-script.in delete mode 100644 upgrade.in diff --git a/Makefile.am b/Makefile.am index 32d2749..d303110 100644 --- a/Makefile.am +++ b/Makefile.am @@ -18,7 +18,7 @@ systemdunitsdir = $(prefix)/lib/systemd/system systemdunits_DATA = postgresql$(DISTSUFF).service postgresql$(DISTSUFF)@.service systemdlegacyscriptsdir = $(prefix)/libexec/initscripts/legacy-actions/postgresql$(DISTSUFF) -systemdlegacyscripts_DATA = initdb upgrade +systemdlegacyscripts_SCRIPTS = initdb upgrade endif doc_DATA = $(README_DIST_BASENAME) @@ -37,12 +37,8 @@ postgresql$(DISTSUFF)-check-db-dir: postgresql-check-db-dir.in $(c_s) postgresql$(DISTSUFF): postgresql.init.in $(c_s) $(INSTANTIATE) -initdb: initdb.in $(c_s) +initdb upgrade: legacy-sysv-script.in $(c_s) $(INSTANTIATE_SCRIPT) -upgrade: upgrade.in $(c_s) - $(INSTANTIATE_SCRIPT) - - # In ideal world, postgresql@.service would be hardlink to postgresql.service. # That would require, however, the rhbz#1141824 resolved so we could install @@ -69,7 +65,7 @@ GENERATED_FILES = $(bin_SCRIPTS) \ $(pkgsysconf_DATA) \ $(systemdunits_DATA) \ $(initscripts_DATA) \ - $(systemdlegacyscripts_DATA) + $(systemdlegacyscripts_SCRIPTS) CLEANFILES = $(GENERATED_FILES) $(TEST_GEN_FILES_LIST) diff --git a/NEWS b/NEWS index dae256a..adbfef8 100644 --- a/NEWS +++ b/NEWS @@ -7,6 +7,9 @@ New in 3.0 version * postgresql-setup now works if postgres user is /bin/nologin +* Legacy scripts are now generated from single template file, also are + simplified a bit. + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ New in 2.0 version diff --git a/initdb.in b/initdb.in deleted file mode 100644 index c238574..0000000 --- a/initdb.in +++ /dev/null @@ -1,16 +0,0 @@ -#!/bin/sh -# -# Legacy action script for "service postgresql initdb" - -# Find the name of the service -SERVICE_NAME=$(basename $(dirname "$0")) -if [ x"$SERVICE_NAME" = x. ] -then - SERVICE_NAME=postgresql -fi - -echo Hint: the preferred way to do this is now '"postgresql-setup initdb"' >&2 - -/usr/bin/postgresql-setup initdb "$SERVICE_NAME" - -exit $? diff --git a/legacy-sysv-script.in b/legacy-sysv-script.in new file mode 100644 index 0000000..fb26a49 --- /dev/null +++ b/legacy-sysv-script.in @@ -0,0 +1,6 @@ +#!/bin/sh + +# Legacy action script for "service postgresql --@__FILE__@" +cmd="@bindir@/postgresql-setup --@__FILE__@ postgresql@DISTSUFF@" +echo "Hint: the preferred way to do this is now \"$cmd\"" >&2 +$cmd diff --git a/upgrade.in b/upgrade.in deleted file mode 100644 index c542494..0000000 --- a/upgrade.in +++ /dev/null @@ -1,16 +0,0 @@ -#!/bin/sh -# -# Legacy action script for "service postgresql upgrade" - -# Find the name of the service -SERVICE_NAME=$(basename $(dirname "$0")) -if [ x"$SERVICE_NAME" = x. ] -then - SERVICE_NAME=postgresql -fi - -echo Hint: the preferred way to do this is now '"postgresql-setup upgrade"' >&2 - -/usr/bin/postgresql-setup upgrade "$SERVICE_NAME" - -exit $? -- cgit