From 1f35a8e32e9287d84b0d46f48a94eca85b59836f Mon Sep 17 00:00:00 2001 From: Pavel Raiskup Date: Wed, 25 Feb 2015 16:09:53 +0100 Subject: 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. --- postgresql-setup.in | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) (limited to 'postgresql-setup.in') 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 -- cgit