From: Marcin Krol Date: Thu, 23 Aug 2018 10:52:08 +0000 (+0000) Subject: - don't hardcode version in init X-Git-Url: https://git.tld-linux.org/?p=packages%2Fpostgresql.git;a=commitdiff_plain;h=230376c98dcfe2593cb63bc0ac3ab6474c1ce738 - don't hardcode version in init --- diff --git a/postgresql.init b/postgresql.init index ac82745..8f30817 100644 --- a/postgresql.init +++ b/postgresql.init @@ -21,10 +21,10 @@ cd / PG_INIT_LOCALE=C # Get service config -if [ -f /etc/sysconfig/postgresql10 ]; then - . /etc/sysconfig/postgresql10 +if [ -f /etc/sysconfig/postgresql-@pgsqlversion@ ]; then + . /etc/sysconfig/postgresql-@pgsqlversion@ else - nls "Error: %s not found" /etc/sysconfig/postgresql10 + nls "Error: %s not found" /etc/sysconfig/postgresql-@pgsqlversion@ nls " PostgreSQL can't be run." exit 1 fi @@ -106,11 +106,11 @@ pgsubsys() { for pgdir in $PG_DB_CLUSTERS; do pgstatus "$pgdir" if [ "$PG_STATUS" = "running" ]; then - touch /var/lock/subsys/postgresql10 + touch /var/lock/subsys/postgresql-@pgsqlversion@ return fi done - rm -f /var/lock/subsys/postgresql10 + rm -f /var/lock/subsys/postgresql-@pgsqlversion@ } # diff --git a/postgresql.spec b/postgresql.spec index aa5b9db..2293b1b 100644 --- a/postgresql.spec +++ b/postgresql.spec @@ -681,7 +681,7 @@ done touch $RPM_BUILD_ROOT/var/log/pgsql -sed -e 's,@pgsqlbindir@,%{pgsqllibdir}/bin,g' %{SOURCE1} >$RPM_BUILD_ROOT/etc/rc.d/init.d/postgresql-%{pgversion} +sed -e 's,@pgsqlbindir@,%{pgsqllibdir}/bin,g; s,@pgsqlversion@,%{pgversion},g;' %{SOURCE1} >$RPM_BUILD_ROOT/etc/rc.d/init.d/postgresql-%{pgversion} install %{SOURCE3} $RPM_BUILD_ROOT/etc/sysconfig/postgresql-%{pgversion} install -d howto