From 0fbb585f1f7c23fc7256b305845c83198c6992ef Mon Sep 17 00:00:00 2001 From: Jozef Mlich Date: Mon, 1 Dec 2014 15:36:28 +0100 Subject: systemd: added systemd's legacy scripts * Makefile.am: (systemdlegacyscriptsdir) (nodist_systemdlegacyscrupts_DATA): New variables. (initdb, upgrade): New targets. * initdb.in: New legacy script template. * upgrade.in: Likewise. * .gitignore: Ignore newly generated scripts. --- .gitignore | 2 ++ Makefile.am | 13 ++++++++++++- initdb.in | 16 ++++++++++++++++ upgrade.in | 16 ++++++++++++++++ 4 files changed, 46 insertions(+), 1 deletion(-) create mode 100644 initdb.in create mode 100644 upgrade.in diff --git a/.gitignore b/.gitignore index 4af9905..d96a346 100644 --- a/.gitignore +++ b/.gitignore @@ -25,3 +25,5 @@ postgresql*.init README.rpm-dist testsuite testsuite.dir/ +initdb +upgrade \ No newline at end of file diff --git a/Makefile.am b/Makefile.am index 86fc9ee..11cd490 100644 --- a/Makefile.am +++ b/Makefile.am @@ -15,6 +15,9 @@ nodist_initscripts_DATA = postgresql$(DISTSUFF) else systemdunitsdir = $(prefix)/lib/systemd/system nodist_systemdunits_DATA = postgresql$(DISTSUFF).service postgresql$(DISTSUFF)@.service + +systemdlegacyscriptsdir = $(prefix)/libexec/initscripts/legacy-actions/postgresql$(DISTSUFF) +nodist_systemdlegacyscripts_DATA = initdb upgrade endif nodist_doc_DATA = $(README_DIST_BASENAME) @@ -33,6 +36,13 @@ 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) + $(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 # system-default drop-in file. Make a "almost" duplicate files now. @@ -57,7 +67,8 @@ GENERATED_FILES = $(bin_SCRIPTS) \ $(nodist_doc_DATA) \ $(pkgsysconf_DATA) \ $(nodist_systemdunits_DATA) \ - $(nodist_initscripts_DATA) + $(nodist_initscripts_DATA) \ + $(nodist_systemdlegacyscripts_DATA) CLEANFILES = $(GENERATED_FILES) $(TEST_GEN_FILES_LIST) diff --git a/initdb.in b/initdb.in new file mode 100644 index 0000000..c238574 --- /dev/null +++ b/initdb.in @@ -0,0 +1,16 @@ +#!/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/upgrade.in b/upgrade.in new file mode 100644 index 0000000..c542494 --- /dev/null +++ b/upgrade.in @@ -0,0 +1,16 @@ +#!/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