From 3d353d40fe5fc407ea56d0eaf17e512fc6ec56d8 Mon Sep 17 00:00:00 2001 From: Marcin Krol Date: Thu, 23 Aug 2018 10:04:21 +0000 Subject: [PATCH] - fix init and sysconfig, delete common stuff after install, cleanup --- postgresql.spec | 41 +++++++++++++++-------------------------- 1 file changed, 15 insertions(+), 26 deletions(-) diff --git a/postgresql.spec b/postgresql.spec index 22279bb..f391bb6 100644 --- a/postgresql.spec +++ b/postgresql.spec @@ -571,8 +571,8 @@ done touch $RPM_BUILD_ROOT/var/log/pgsql -sed -e 's,@pgsqlbindir@,%{pgsqllibdir}/bin,g' %{SOURCE1} >$RPM_BUILD_ROOT/etc/rc.d/init.d/postgresql10 -install %{SOURCE3} $RPM_BUILD_ROOT/etc/sysconfig/postgresql10 +sed -e 's,@pgsqlbindir@,%{pgsqllibdir}/bin,g' %{SOURCE1} >$RPM_BUILD_ROOT/etc/rc.d/init.d/postgresql%{pgversion} +install %{SOURCE3} $RPM_BUILD_ROOT/etc/sysconfig/postgresql%{pgversion} install -d howto tar zxf %{SOURCE2} -C howto @@ -610,13 +610,18 @@ cp -p src/pl/plperl/ppport.h $RPM_BUILD_ROOT%{_includedir}/postgresql/%{pgversio # package it...? nah, why bother. %{__rm} -r $RPM_BUILD_ROOT%{pgsqldatadir}/doc/html +# remove common files provided by PostgreSQL from master branch +%{__rm} -r $RPM_BUILD_ROOT%{_includedir}/{ecpg*,libpq*,pg_config*,postgres_ext.h,postgresql/internal} +%{__rm} -r $RPM_BUILD_ROOT{%{_libdir}/{libecpg*,libpg*,libpq*,pkgconfig},%{pgsqllibdir}/bin/pg_config,%{pgsqldatadir}/man/man1/pg_config.1*} +%{__rm} -r $RPM_BUILD_ROOT%{pgsqldatadir}/share/locale/*/LC_MESSAGES/{ecpglib*,libpq*,pg_config*} + %clean rm -rf $RPM_BUILD_ROOT %pre PG_DB_CLUSTERS="" -if [ -f /etc/sysconfig/postgresql10 ]; then - . /etc/sysconfig/postgresql10 +if [ -f /etc/sysconfig/postgresql%{pgversion} ]; then + . /etc/sysconfig/postgresql%{pgversion} if [ -z "$PG_DB_CLUSTERS" -a -n "$POSTGRES_DATA_DIR" ]; then PG_DB_CLUSTERS="$POSTGRES_DATA_DIR" fi @@ -643,30 +648,14 @@ if [ "$foundold" = "1" ]; then exit 1 fi -%triggerpostun -- postgresql < 10.5-2 -if [ -n "`/bin/id -u postgres 2>/dev/null`" ]; then - /usr/sbin/usermod -d /var/lib/pgsql postgres -fi -echo -echo "This version of PostgreSQL uses new default location for database clusters." -echo "Please move your existing clusters before starting PostgreSQL so they follow" -echo "below scheme:" -echo -echo "/var/lib/pgsql//" -echo -echo "where means PostgreSQL version like 9.6 or 10 and name is cluster" -echo "name of your choice. When done, be sure to update /etc/sysconfig/postgresql*" -echo "files so they reflect your changes." -echo - %post -/sbin/chkconfig --add postgresql10 -%service postgresql10 restart "postgresql10 server" +/sbin/chkconfig --add postgresql%{pgversion} +%service postgresql%{pgversion} restart "postgresql%{pgversion} server" %preun if [ "$1" = "0" ]; then - %service postgresql10 stop - /sbin/chkconfig --del postgresql10 + %service postgresql%{pgversion} stop + /sbin/chkconfig --del postgresql%{pgversion} fi %posttrans clients @@ -730,8 +719,8 @@ fi %files -f main.lang %defattr(644,root,root,755) %doc COPYRIGHT README HISTORY doc/{bug.template,KNOWN_BUGS,MISSING_FEATURES,TODO} -%attr(754,root,root) /etc/rc.d/init.d/postgresql10 -%attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) /etc/sysconfig/postgresql10 +%attr(754,root,root) /etc/rc.d/init.d/postgresql%{pgversion} +%attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) /etc/sysconfig/postgresql%{pgversion} %attr(755,root,root) %{pgsqllibdir}/bin/initdb %attr(755,root,root) %{pgsqllibdir}/bin/pg_basebackup -- 2.46.0