summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPavel Raiskup <praiskup@redhat.com>2015-02-25 16:09:53 +0100
committerPavel Raiskup <praiskup@redhat.com>2015-02-26 16:52:18 +0100
commit1f35a8e32e9287d84b0d46f48a94eca85b59836f (patch)
tree3660daed3d5cf2128ad9a34ad02c509b5649a76f
parent243dcab83ed93c3afd9867b3e5d014efdd0f840f (diff)
downloadpostgresql-setup-1f35a8e32e9287d84b0d46f48a94eca85b59836f.zip
postgresql-setup-1f35a8e32e9287d84b0d46f48a94eca85b59836f.tar.gz
postgresql-setup-1f35a8e32e9287d84b0d46f48a94eca85b59836f.tar.xz
configury: remove DISTSUFF variable completely
And add NAME_SERVICE, NAME_PACKAGE and NAME_BINARYBASE on its place. This allows packager fine-tune how the files are going to be generated. * Makefile.am: Better work with variables. * .gitignore: Ignore any (generated) service file. * configure.ac (DISTSUFF): Remove. (NAME_BIN_PFX, NAME_BIN_SFX, NAME_PKG_PFX, NAME_PKG_SFX) (NAME_SRV_PFX, NAME_SRV_SFX, NAME_SERVICE, NAME_PACKAGE) (NAME_BINARYBASE): New variables * doc/.gitignore: Ignore any man(1) page. * doc/Makefile.am (HELP2MAN_RUN): Fix the call to work also with various prefixes/suffixes. * README.rpm-dist.in: Use new variables. * legacy-sysv-script.in: Likewise. * postgresql-setup.in: Likewise. * m4/packaging.m4 (PGSETUP_SUBST_OPT): New macro, defines, substitutes and also fixes sed-rules.
-rw-r--r--.gitignore1
-rw-r--r--Makefile.am44
-rw-r--r--README.rpm-dist.in84
-rw-r--r--configure.ac50
-rw-r--r--doc/.gitignore1
-rw-r--r--doc/Makefile.am13
-rw-r--r--legacy-sysv-script.in2
-rw-r--r--m4/packaging.m48
-rw-r--r--postgresql-setup.in23
9 files changed, 144 insertions, 82 deletions
diff --git a/.gitignore b/.gitignore
index 40c1e13..19f4432 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,3 +1,4 @@
+*.service
*.tar.gz
*.log
.generated_files
diff --git a/Makefile.am b/Makefile.am
index bf0cb60..6dad8c7 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -1,4 +1,21 @@
-pkgname = postgresql$(DISTSUFF)
+pkgname = $(NAME_PACKAGE)
+
+setup = $(NAME_BINARYBASE)-setup
+setup_in = postgresql-setup.in
+
+ctl = $(NAME_BINARYBASE)-ctl
+ctl_in = postgresql-ctl.in
+
+checkdb = $(NAME_BINARYBASE)-check-db-dir
+checkdb_in = postgresql-check-db-dir.in
+
+service = $(NAME_SERVICE).service
+service_in = postgresql.service.in
+serviceat = $(NAME_SERVICE)@.service
+serviceat_in = postgresql.service.in
+
+initscript = $(NAME_SERVICE)
+initscript_in = postgresql.init.in
EXTRA_DIST =
@@ -6,22 +23,19 @@ include $(srcdir)/build-helpers/Makefile.inc
SUBDIRS = . doc tests
-bin_SCRIPTS = postgresql$(DISTSUFF)-setup
-
-libexec_SCRIPTS = postgresql$(DISTSUFF)-ctl \
- postgresql$(DISTSUFF)-check-db-dir
+bin_SCRIPTS = $(setup)
+libexec_SCRIPTS = $(ctl) $(checkdb)
userunitsdir = /etc/systemd/system
# TODO: Ideally, 'make distcheck' should check every file we generate.
if WANT_SYSVINIT
initscriptsdir = $(sysconfdir)/rc.d/init.d
-initscripts_DATA = postgresql$(DISTSUFF)
+initscripts_DATA = $(initscript)
else
systemdunitsdir = $(prefix)/lib/systemd/system
-systemdunits_DATA = postgresql$(DISTSUFF).service postgresql$(DISTSUFF)@.service
-
-systemdlegacyscriptsdir = $(prefix)/libexec/initscripts/legacy-actions/postgresql$(DISTSUFF)
+systemdunits_DATA = $(service) $(serviceat)
+systemdlegacyscriptsdir = $(libexecdir)/initscripts/legacy-actions/$(NAME_SERVICE)
systemdlegacyscripts_SCRIPTS = initdb upgrade
endif
@@ -29,16 +43,16 @@ doc_DATA = $(README_DIST_BASENAME)
noinst_DATA = $(TEST_GEN_FILES_LIST)
-postgresql$(DISTSUFF)-ctl: postgresql-ctl.in $(c_s)
+$(ctl): $(ctl_in) $(c_s)
$(INSTANTIATE_SCRIPT)
-postgresql$(DISTSUFF)-setup: postgresql-setup.in $(c_s)
+$(setup): $(setup_in) $(c_s)
$(INSTANTIATE_SCRIPT)
-postgresql$(DISTSUFF)-check-db-dir: postgresql-check-db-dir.in $(c_s)
+$(checkdb): $(check) $(checkdb_in) $(c_s)
$(INSTANTIATE_SCRIPT)
-postgresql$(DISTSUFF): postgresql.init.in $(c_s)
+$(initscript): $(initscript_in) $(c_s)
$(INSTANTIATE)
initdb upgrade: legacy-sysv-script.in $(c_s)
@@ -48,12 +62,12 @@ initdb upgrade: legacy-sysv-script.in $(c_s)
# 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)
+$(serviceat): $(serviceat_in) $(c_s)
$(AM_V_GEN)$(SED_CALL) \
-e '/@PGDATA_ENVIRONMENT[@]/d' \
$< > $@
-postgresql$(DISTSUFF).service: postgresql.service.in $(c_s)
+$(service): $(service_in) $(c_s)
$(AM_V_GEN)$(SED_CALL) \
-e 's|@PGDATA_ENVIRONMENT[@]|Environment=PGDATA=$(PGDATADIR)|' \
$< > $@
diff --git a/README.rpm-dist.in b/README.rpm-dist.in
index 023473a..8fabcc2 100644
--- a/README.rpm-dist.in
+++ b/README.rpm-dist.in
@@ -32,16 +32,16 @@ Enterprise Linux, CentOS and Fedora. Note that there are also "PGDG"
RPMs available directly from the upstream PostgreSQL project. Those are
slightly different.
-QUICKSTART (note that this requires @pkgname@-server installed)
+QUICKSTART (note that this requires @NAME_PACKAGE@-server installed)
-----------------------------------------------------------------------------
For a fresh installation, you will need to initialize the cluster first. Run:
- @pkgname@-setup --initdb
+ @NAME_BINARYBASE@-setup --initdb
as root, and it will prepare a new database cluster for you. Then you will
need to start PostgreSQL. Again as root, run:
- systemctl start @pkgname@.service
+ systemctl start @NAME_SERVICE@.service
This command will start a postmaster that will listen on localhost and Unix
socket 5432 only. Edit @PGDATADIR@/postgresql.conf and pg_hba.conf
@@ -50,7 +50,7 @@ Configuration.
You will probably also want to do
- systemctl enable @pkgname@.service
+ systemctl enable @NAME_SERVICE@.service
so that the postmaster is automatically started during future reboots.
@@ -85,16 +85,16 @@ In some major releases, the RPMs also support in-place upgrade from the
immediately previous major release. Currently, you can upgrade in-place
from @PREVMAJORVERSION@.x to @PGMAJORVERSION@.x. This is much faster than a dump and reload.
To do an in-place upgrade:
-* shut down the old postmaster ("systemctl stop @pkgname@.service")
+* shut down the old postmaster ("systemctl stop @NAME_SERVICE@.service")
* optionally make a backup of @PGDATADIR@ (recommended!)
* install the new version's RPMs (install all the ones you had before,
- plus @pkgname@-upgrade)
-* as root, run "@pkgname@-setup --upgrade"
+ plus @NAME_PACKAGE@-upgrade)
+* as root, run "@NAME_BINARYBASE@-setup --upgrade"
* update the configuration files @PGDATADIR@/*.conf with any
customizations you had before (your old configuration files are in
@POSTGRES_HOMEDIR@/data-old/)
-* as root, run "systemctl start @pkgname@.service"
-* the @pkgname@-upgrade package can be removed after the update is complete,
+* as root, run "systemctl start @NAME_SERVICE@.service"
+* the @NAME_PACKAGE@-upgrade package can be removed after the update is complete,
as can @POSTGRES_HOMEDIR@/data-old/
NOTE: The in-place upgrade process is new and relatively poorly tested,
@@ -109,25 +109,25 @@ choose' what pieces are needed, and what dependencies are required.
The RPMset is packaged in the following subpackages:
-@pkgname@: Key client programs and basic documentation
-@pkgname@-libs: Client shared libraries
-@pkgname@-server: Server executables and data files
-@pkgname@-devel: Development libraries and include files
-@pkgname@-test: The regression tests and associated files
-@pkgname@-upgrade: Support files for upgrading from previous major version
-@pkgname@-docs: Full documentation in HTML and PDF, the tutorial files
-@pkgname@-contrib: Add-on loadable modules and programs
-@pkgname@-plperl: PL/Perl procedural language
-@pkgname@-plpython: PL/Python procedural language (for Python 2)
-@pkgname@-plpython3: PL/Python procedural language (for Python 3)
-@pkgname@-pltcl: PL/Tcl procedural language
-
-You have to install @pkgname@ and @pkgname@-libs to do anything.
-@pkgname@-server is needed unless you only plan to use the clients to work with
+@NAME_PACKAGE@: Key client programs and basic documentation
+@NAME_PACKAGE@-libs: Client shared libraries
+@NAME_PACKAGE@-server: Server executables and data files
+@NAME_PACKAGE@-devel: Development libraries and include files
+@NAME_PACKAGE@-test: The regression tests and associated files
+@NAME_PACKAGE@-upgrade: Support files for upgrading from previous major version
+@NAME_PACKAGE@-docs: Full documentation in HTML and PDF, the tutorial files
+@NAME_PACKAGE@-contrib: Add-on loadable modules and programs
+@NAME_PACKAGE@-plperl: PL/Perl procedural language
+@NAME_PACKAGE@-plpython: PL/Python procedural language (for Python 2)
+@NAME_PACKAGE@-plpython3: PL/Python procedural language (for Python 3)
+@NAME_PACKAGE@-pltcl: PL/Tcl procedural language
+
+You have to install @NAME_PACKAGE@ and @NAME_PACKAGE@-libs to do anything.
+@NAME_PACKAGE@-server is needed unless you only plan to use the clients to work with
a remote PostgreSQL server. The others are optional.
-Note that there are no @pkgname@-perl, @pkgname@-jdbc, @pkgname@-odbc,
-@pkgname@-python, @pkgname@-tcl, or @pkgname@-tk subpackages any longer.
+Note that there are no @NAME_PACKAGE@-perl, @NAME_PACKAGE@-jdbc, @NAME_PACKAGE@-odbc,
+@NAME_PACKAGE@-python, @NAME_PACKAGE@-tcl, or @NAME_PACKAGE@-tk subpackages any longer.
Those programs have been split off into separate source distributions.
They are still available, but in some cases not under those RPM names.
@@ -172,8 +172,8 @@ mailing list.
MULTIPLE POSTMASTERS
-------------------------------------------------------------------------------
-The postgresql-server package contains a systemd "unit" files @pkgname@.service
-and @pkgname@@.service. The first file is used solely to start the default
+The postgresql-server package contains a systemd "unit" files @NAME_SERVICE@.service
+and @NAME_SERVICE@@.service. The first file is used solely to start the default
PostgreSQL server. The second one is designed to allow instantiating
additional PostgreSQL servers on same machine.
@@ -182,7 +182,7 @@ enough, 'postgresql@secondary'. Here are the steps:
1) Run the following command to create the necessary configuration and
to initialize the new database cluster:
- @pkgname@-setup --initdb \
+ @NAME_BINARYBASE@-setup --initdb \
--unit postgresql@secondary \
--new-systemd-unit \
--datadir /path/to/data/directory \
@@ -197,15 +197,15 @@ enough, 'postgresql@secondary'. Here are the steps:
settings as needed.
3) Start the new service with this command:
- 'systemctl start @pkgname@@secondary.service'
+ 'systemctl start @NAME_SERVICE@@secondary.service'
You will probably also want to run the command
- 'systemctl enable @pkgname@@secondary.service'
+ 'systemctl enable @NAME_SERVICE@@secondary.service'
so that the new service is automatically started in future reboots.
When doing a major-version upgrade of a secondary service, add the service name
-to the @pkgname@-setup command, for example:
- '@pkgname@-setup --upgrade --unit @pkgname@@secondary'
-This will let @pkgname@-setup find the correct data directory from the proper
+to the @NAME_BINARYBASE@-setup command, for example:
+ '@NAME_BINARYBASE@-setup --upgrade --unit @NAME_SERVICE@@secondary'
+This will let @NAME_BINARYBASE@-setup find the correct data directory from the proper
configuration file.
If you are running SELinux in enforcing mode (which is highly recommended,
@@ -223,14 +223,14 @@ see "man semanage".
REGRESSION TESTING
-------------------------------------------------------------------------------
-If you install the @pkgname@-test RPM then you can run the PostgreSQL
+If you install the @NAME_PACKAGE@-test RPM then you can run the PostgreSQL
regression tests. These tests stress your database installation and produce
results that give you assurances that the installation is complete, and that
your database machine is up to the task.
To run the regression tests under the RPM installation, make sure that the
PostgreSQL server has been started (if not, su to root and do "systemctl start
-@pkgname@.service"), su to postgres, cd to @libdir@/pgsql/test/regress and
+@NAME_SERVICE@.service"), su to postgres, cd to @libdir@/pgsql/test/regress and
execute "make check".
This command will start the regression tests and will both show the
results to the screen and store the results in the file regress.out.
@@ -241,23 +241,23 @@ find out whether the differences are actually significant. If you need help
interpreting the results, contact the pgsql-general list at postgresql.org.
After testing, run "make clean" to remove the files generated by the test
-script. Then you can remove the @pkgname@-test RPM, if you wish.
+script. Then you can remove the @NAME_PACKAGE@-test RPM, if you wish.
STARTING POSTMASTER AUTOMATICALLY AT SYSTEM STARTUP
-------------------------------------------------------------------------------
Fedora / Red Hat / CentOS use the systemd package to manage server startup.
A systemd unit file for PostgreSQL is provided in the server package, as
-@systemdunitsdir@/@pkgname@.service. To start the postmaster manually,
+@systemdunitsdir@/@NAME_SERVICE@.service. To start the postmaster manually,
as root run
- systemctl start @pkgname@.service
+ systemctl start @NAME_SERVICE@.service
To shut the postmaster down,
- systemctl stop @pkgname@.service
+ systemctl stop @NAME_SERVICE@.service
These two commands only change the postmaster's current status. If you
want the postmaster to be started automatically during future system startups,
run
- systemctl enable @pkgname@.service
+ systemctl enable @NAME_SERVICE@.service
To undo that again,
- systemctl disable @pkgname@.service
+ systemctl disable @NAME_SERVICE@.service
See "man systemctl" for other possible subcommands.
GRAND UNIFIED CONFIGURATION (GUC) FILE
diff --git a/configure.ac b/configure.ac
index d6476f6..ce34c15 100644
--- a/configure.ac
+++ b/configure.ac
@@ -9,9 +9,6 @@ AC_CONFIG_FILES([Makefile doc/Makefile])
AC_CONFIG_MACRO_DIR([m4])
AM_SILENT_RULES([yes])
-AC_ARG_VAR([DISTSUFF], [Append string suffix to all binaries and package names])
-AC_SUBST([DISTSUFF])
-
# Initialize the test suite.
AC_CONFIG_TESTDIR(tests)
AC_CONFIG_FILES([tests/Makefile])
@@ -45,7 +42,6 @@ AM_CONDITIONAL([WANT_SYSVINIT], [test "$WANT_SYSVINIT" -eq 1])
m4_define([sed_subst_var_pattern], [ -e 's|@$1[[@]]|\$($1)|g' \\])
SED_RULES="\\
sed_subst_var_pattern(bindir)
-sed_subst_var_pattern(DISTSUFF)
sed_subst_var_pattern(docdir)
sed_subst_var_pattern(libdir)
sed_subst_var_pattern(libexecdir)
@@ -70,8 +66,12 @@ sed_subst_var_pattern(systemdunitsdir)
sed_subst_var_pattern(userunitsdir)
sed_subst_var_pattern(TEST_GEN_FILES_LIST)
sed_subst_var_pattern(VERSION)
-sed_subst_var_pattern(UPGRADE_CONFIG_LIST)
- -e 's|@__FILE__[[@]]|\$@|g'"
+sed_subst_var_pattern(UPGRADE_CONFIG_LIST)"
+
+m4_define([add_sed_subst_var], [
+SED_RULES="$SED_RULES
+sed_subst_var_pattern($1)"
+])
SED_CALL="\$(SED) \$(SED_RULES)"
m4_pattern_allow(AM_V_GEN)
@@ -81,7 +81,6 @@ INSTANTIATE="\$(INSTANTIATE_CONV) && \$(SED_CALL) \$< > \$@ && chmod -w \$@"
INSTANTIATE_SCRIPT="\$(INSTANTIATE) && chmod +x \$@"
c_s='$(top_builddir)/config.status'
-AC_SUBST([SED_RULES])
AC_SUBST([SED_CALL])
AC_SUBST([INSTANTIATE])
AC_SUBST([INSTANTIATE_CONV])
@@ -207,6 +206,40 @@ PGSETUP_SUBST_REQ([PKGCONFIG_DIR], [where configuration should be stored])
PGSETUP_SUBST_REQ([POSTGRES_HOMEDIR], [full path to postgres home dir])
PGSETUP_SUBST_REQ([PGDATADIR], [full path to postgres data dir])
+PGSETUP_SUBST_OPT([NAME_SRV_PFX], [],
+ [service name prefix, like (PFX)postgresql.service])
+PGSETUP_SUBST_OPT([NAME_SRV_SFX], [],
+ [service name suffix, like postgresql(SFX).service ])
+PGSETUP_SUBST_OPT([NAME_BIN_SFX], [],
+ [binary name prefix, like (PFX)postgresql-setup])
+PGSETUP_SUBST_OPT([NAME_BIN_SFX], [],
+ [binary name suffix, like postgresql(SFX)-setup])
+PGSETUP_SUBST_OPT([NAME_PKG_PFX], [],
+ [package name prefix, like (PFX)postgresql.rpm])
+PGSETUP_SUBST_OPT([NAME_PKG_SFX], [],
+ [package name suffix, like postgresql(SFX).rpm])
+
+NAME_BINARYBASE="$NAME_BIN_PFX""postgresql$NAME_BIN_SFX"
+NAME_PACKAGE="$NAME_PKG_PFX""postgresql$NAME_PKG_SFX"
+NAME_SERVICE="$NAME_SRV_PFX""postgresql$NAME_SRV_SFX"
+
+AC_SUBST([NAME_BINARYBASE])
+AC_SUBST([NAME_PACKAGE])
+AC_SUBST([NAME_SERVICE])
+
+AC_SUBST([NAME_BINARYBASE])
+AC_SUBST([NAME_PACKAGE])
+AC_SUBST([NAME_SERVICE])
+
+add_sed_subst_var(NAME_SERVICE)
+add_sed_subst_var(NAME_PACKAGE)
+add_sed_subst_var(NAME_BINARYBASE)
+
+# As late as possible.
+SED_RULES="$SED_RULES
+ -e 's|@__FILE__[[@]]|\$@|g'"
+AC_SUBST([SED_RULES])
+
AC_OUTPUT
AC_MSG_NOTICE([Configured the folowing way:
@@ -215,4 +248,7 @@ AC_MSG_NOTICE([Configured the folowing way:
PGDATADIR: $PGDATADIR
Upgrade from: $PREVMAJORVERSION
PREV_POSTGRES_BIN: $PREV_POSTGRES_BIN
+ PostgreSQL service: $NAME_SERVICE
+ PostgreSQL package: $NAME_PACKAGE
+ PostgreSQL bin_pfx: $NAME_BINARYBASE
])
diff --git a/doc/.gitignore b/doc/.gitignore
new file mode 100644
index 0000000..f7e585b
--- /dev/null
+++ b/doc/.gitignore
@@ -0,0 +1 @@
+*.1
diff --git a/doc/Makefile.am b/doc/Makefile.am
index 63d09de..3b7c378 100644
--- a/doc/Makefile.am
+++ b/doc/Makefile.am
@@ -13,9 +13,7 @@ HELP2MAN = $(SHELL) $(top_srcdir)/$(config_aux_dir)/missing --run help2man
# TODO: separate it to its own m4 module (for easier distribution)
HELP2MAN_RUN = \
- file=$< ; \
- file=$${file%%.in} ; \
- $(HELP2MAN) --output=$@ $$file -N ; \
+ $(HELP2MAN) --output=$@ $$input -N ; \
rs=$$? ; \
if test $$rs -eq 127; then \
test -f $@ ; \
@@ -23,7 +21,10 @@ HELP2MAN_RUN = \
test $$rs -eq 0 ; \
fi
-dist_man_MANS = $(srcdir)/postgresql$(DISTSUFF)-setup.1
+setup_man = $(srcdir)/$(NAME_BINARYBASE)-setup.1
-$(srcdir)/postgresql$(DISTSUFF)-setup.1: $(top_srcdir)/postgresql-setup.in
- $(AM_V_GEN)$(HELP2MAN_RUN)
+dist_man_MANS = $(setup_man)
+
+$(setup_man): $(top_srcdir)/postgresql-setup.in
+ $(AM_V_GEN)export input=$(top_srcdir)/$(NAME_BINARYBASE)-setup ; \
+ $(HELP2MAN_RUN)
diff --git a/legacy-sysv-script.in b/legacy-sysv-script.in
index fb26a49..6255373 100644
--- a/legacy-sysv-script.in
+++ b/legacy-sysv-script.in
@@ -1,6 +1,6 @@
#!/bin/sh
# Legacy action script for "service postgresql --@__FILE__@"
-cmd="@bindir@/postgresql-setup --@__FILE__@ postgresql@DISTSUFF@"
+cmd="@bindir@/postgresql-setup --@__FILE__@ @NAME_SERVICE@"
echo "Hint: the preferred way to do this is now \"$cmd\"" >&2
$cmd
diff --git a/m4/packaging.m4 b/m4/packaging.m4
index 7160ae8..a50c4ba 100644
--- a/m4/packaging.m4
+++ b/m4/packaging.m4
@@ -33,3 +33,11 @@ m4_define([PGSETUP_SUBST_REQ], [
AC_MSG_ERROR([the \$$1 variable is not set])
])
+# PGSETUP_SUBST_OPT(VARIABLE, DEFAULT, DESCRIPTION)
+# -------------------------------------------------
+m4_define([PGSETUP_SUBST_OPT], [
+ AC_ARG_VAR([$1], [$3])
+ test -z "$[]$1" &&
+ $1=$2
+ add_sed_subst_var($1)
+])
diff --git a/postgresql-setup.in b/postgresql-setup.in
index 43294f9..6f32dc4 100644
--- a/postgresql-setup.in
+++ b/postgresql-setup.in
@@ -21,13 +21,14 @@ SU_POSTGRES="@SU_POSTGRES@"
# The where PostgreSQL server listens by default
PGPORT_DEF=5432
+# We upgrade by default from system's default PostgreSQL installation
option_upgradefrom="postgresql"
USAGE_STRING=$"\
Usage: $0 MODE_OPTION [--unit=UNIT_NAME] [OPTION...]
Script is aimed to help sysadmin with basic database cluster administration.
-Usually, \"postgresql-setup --initdb\" and \"postgresql-setup --upgrade\" is
+Usually, \"@NAME_BINARYBASE@-setup --initdb\" and \"@NAME_BINARYBASE@-setup --upgrade\" is
enough, however there are other options described below.
For more info and howto/when use this script please look at the documentation
@@ -154,7 +155,7 @@ parse_upgrade_setup()
print_version()
{
- echo "postgresql@DISTSUFF@-setup @VERSION@"
+ echo "@NAME_BINARYBASE@-setup @VERSION@"
echo $"Built against PostgreSQL version @PGVERSION@."
}
@@ -251,7 +252,7 @@ upgrade()
exit 1
fi
if [ ! -x "$PGENGINE/pg_upgrade" ]; then
- error $"Please install the postgresql-upgrade package."
+ error $"Please install the @NAME_PACKAGE@-upgrade package."
exit 5
fi
@@ -274,7 +275,7 @@ upgrade()
fi
# Create configuration file for upgrade process
- HBA_CONF_BACKUP="$pgdataold/pg_hba.conf.postgresql-setup.`date +%s`"
+ HBA_CONF_BACKUP="$pgdataold/pg_hba.conf.@NAME_BINARYBASE@-setup.`date +%s`"
HBA_CONF_BACKUP_EXISTS=0
if [ ! -f $HBA_CONF_BACKUP ]; then
@@ -335,7 +336,7 @@ generate_systemd_dropin()
{
local service="$1"
local dropindir="@userunitsdir@/$service.service.d"
- local dropin="$dropindir/30-postgresql-setup.conf"
+ local dropin="$dropindir/30-@NAME_BINARYBASE@-setup.conf"
test -e "$dropindir" \
&& die "The systemd drop-in directory '$dropindir' exists already"
@@ -498,7 +499,7 @@ case "$1" in initdb|upgrade)
esac
done
- service=postgresql
+ service="@NAME_SERVICE@"
if test -n "$1"; then
service=$1
shift
@@ -512,7 +513,7 @@ esac
# postgresql-setup arguments are parsed into those variables
option_mode=none
-option_service=postgresql
+option_service="@NAME_SERVICE@"
option_port=
option_pgdata=
option_debug=0
@@ -545,7 +546,7 @@ unit:,service:,port:,datadir:,upgrade-from:,\
debug,\
version,help,usage"
-args=`getopt -o "$short_opts" -l "$long_opts" -n "postgresql-setup" -- "$@"` \
+args=`getopt -o "$short_opts" -l "$long_opts" -n "@NAME_BINARYBASE@-setup" -- "$@"` \
|| die "can't parse arguments"
eval set -- "$args"
parse_fail=0
@@ -644,8 +645,8 @@ parse_configuration initdb pgdata UNUSED "$option_service"
# Check that nothing breaks --new-systemd-unit
if test "$option_systemd_config" = yes; then
- if test "$option_service" = postgresql; then
- die $"Default unit 'postgresql.service' should not need --new-systemd-unit"
+ if test "$option_service" = "@NAME_SERVICE@"; then
+ die $"Default unit '@NAME_SERVICE@.service' should not need --new-systemd-unit"
elif test "$pgdata" != default; then
die $"Option --new-systemd-unit failed, is '$option_service.service'"\
$"already configured to '$pgdata'?"
@@ -688,7 +689,7 @@ test "$option_mode" = upgrade -a "$pgport" = default \
# This is mostly for 'initdb'. We assume that the default port is $PGPORT_DEF
# if not set explicitly for default service name 'postgresql'.
-if test "$pgport" = default -a "$option_service" = postgresql; then
+if test "$pgport" = default -a "$option_service" = "@NAME_SERVICE@"; then
debug $"Using the default port '$PGPORT_DEF'"
pgport=$PGPORT_DEF
fi