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
# 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
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/<version>/<name>"
-echo
-echo "where <version> 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
%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