diff --git a/pgpool.init b/pgpool.init index e0a4119..f09b982 100755 --- a/pgpool.init +++ b/pgpool.init @@ -1,7 +1,7 @@ #!/bin/sh # pgpool This is the init script for starting up pgpool-II # -# chkconfig: - 235 74 33 +# chkconfig: - 64 36 # description: Starts and stops the pgpool daemon # processname: pgpool # pidfile: /var/run/pgpool.pid @@ -14,9 +14,6 @@ # # v2.2.5 Devrim GUNDUZ # - Fix logging. -# -# v2.3 Devrim GUNDUZ -# - Adjust order of startup and kill, per RH bugzilla #545739. if [ -r /etc/sysconfig/pgpool ]; then . /etc/sysconfig/pgpool diff --git a/postgresql-pgpool-II.spec b/postgresql-pgpool-II.spec index 82c0dc9..fd4f10e 100644 --- a/postgresql-pgpool-II.spec +++ b/postgresql-pgpool-II.spec @@ -1,22 +1,36 @@ %define short_name pgpool-II +%if 0%{?rhel} && 0%{?rhel} <= 6 +%define systemd_enabled 0 +%else +%define systemd_enabled 1 +%endif Summary: Pgpool is a connection pooling/replication server for PostgreSQL Name: postgresql-%{short_name} -Version: 3.1.3 -Release: 2%{?dist} +Version: 3.2.0 +Release: 1%{?dist} License: BSD Group: Applications/Databases URL: http://pgpool.net Source0: http://www.pgpool.net/download.php?f=%{short_name}-%{version}.tar.gz Source1: pgpool.service Source2: pgpool.sysconfig +Source3: pgpool.init Patch1: pgpool-3.1-conf.sample.patch BuildRequires: postgresql-devel pam-devel -BuildRequires: systemd-units +%if %{systemd_enabled} +BuildRequires: systemd Requires(post): systemd-sysv -Requires(post): systemd-units -Requires(preun): systemd-units -Requires(postun): systemd-units +Requires(post): systemd +Requires(preun): systemd +Requires(postun): systemd +%else +Requires(post): chkconfig +Requires(preun): chkconfig +# This is for /sbin/service +Requires(preun): initscripts +Requires(postun): initscripts +%endif Obsoletes: postgresql-pgpool %description @@ -38,13 +52,21 @@ pgpool-II that is executed in pgpool-I mode enables multiple DB nodes to be connected, which was not possible in pgpool-I. %package devel -Summary: The development files for pgpool-II +Summary: The development files for pgpool-II Group: Development/Libraries Requires: %{name} = %{version}-%{release} %description devel Development headers and libraries for pgpool-II. +%package recovery +Summary: PGPool recovery add-on for PostgreSQL +Group: Applications/Databases +Requires: %{name} = %{version}-%{release} + +%description recovery +PGPool recovery add-on for PostgreSQL. + %prep %setup -q -n %{short_name}-%{version} %patch1 -p1 -b .samplefix @@ -53,9 +75,11 @@ Development headers and libraries for pgpool-II. %configure --with-pgsql-includedir=%{_includedir}/pgsql --with-pgsql=%{_libdir}/pgsql --disable-static --with-pam --disable-rpath --sysconfdir=%{_sysconfdir}/%{short_name}/ make %{?_smp_flags} +( cd sql/pgpool-recovery && make %{?_smp_flags} ) %install make %{?_smp_flags} DESTDIR=%{buildroot} install +( cd sql/pgpool-recovery && make %{?_smp_flags} DESTDIR=%{buildroot} install ) install -d %{buildroot}%{_datadir}/%{short_name} install -d %{buildroot}%{_sysconfdir}/%{short_name} mv %{buildroot}/%{_sysconfdir}/%{short_name}/pcp.conf.sample %{buildroot}%{_sysconfdir}/%{short_name}/pcp.conf @@ -65,8 +89,14 @@ mv %{buildroot}/%{_sysconfdir}/%{short_name}/pgpool.conf.sample-master-slave %{b mv %{buildroot}/%{_sysconfdir}/%{short_name}/pgpool.conf.sample-replication %{buildroot}%{_datadir}/%{short_name}/ mv %{buildroot}/%{_sysconfdir}/%{short_name}/pgpool.conf.sample-stream %{buildroot}%{_datadir}/%{short_name}/ +%if %{systemd_enabled} install -d %{buildroot}%{_unitdir} install -m 755 %{SOURCE1} %{buildroot}%{_unitdir}/pgpool.service +%else +install -d %{buildroot}%{_sysconfdir}/init.d +install -m 755 %{SOURCE3} %{buildroot}%{_sysconfdir}/init.d/pgpool +%endif + install -d %{buildroot}%{_sysconfdir}/sysconfig install -m 644 %{SOURCE2} %{buildroot}%{_sysconfdir}/sysconfig/pgpool @@ -75,26 +105,34 @@ rm -f %{buildroot}%{_libdir}/libpcp.{a,la} %post /sbin/ldconfig -if [ $1 -eq 1 ] ; then - # Initial installation - /bin/systemctl daemon-reload >/dev/null 2>&1 || : -fi +%if %{systemd_enabled} +%systemd_post pgpool.service +%else +# This adds the proper /etc/rc*.d links for the script +/sbin/chkconfig --add pgpool +%endif %preun +%if %{systemd_enabled} +%systemd_preun pgpool.service +%else if [ $1 -eq 0 ] ; then - # Package removal, not upgrade - /bin/systemctl --no-reload disable pgpool.service > /dev/null 2>&1 || : - /bin/systemctl stop pgpool.service > /dev/null 2>&1 || : + /sbin/service pgpool stop >/dev/null 2>&1 + /sbin/chkconfig --del pgpool fi +%endif %postun /sbin/ldconfig -/bin/systemctl daemon-reload >/dev/null 2>&1 || : +%if %{systemd_enabled} +%systemd_postun_with_restart pgpool.service +%else if [ $1 -ge 1 ] ; then - # Package upgrade, not uninstall - /bin/systemctl try-restart pgpool.service >/dev/null 2>&1 || : + /sbin/service pgpool condrestart >/dev/null 2>&1 || : fi +%endif +%if %{systemd_enabled} %triggerun -- pgpool < 3.1-1 # Save the current service runlevel info # User must manually run systemd-sysv-convert --apply pgpool @@ -104,6 +142,7 @@ fi # Run these because the SysV package being removed won't do them /sbin/chkconfig --del pgpool >/dev/null 2>&1 || : /bin/systemctl try-restart pgpool.service >/dev/null 2>&1 || : +%endif %files %doc README README.euc_jp TODO COPYING INSTALL AUTHORS ChangeLog NEWS doc/pgpool-en.html doc/pgpool-ja.html doc/pgpool.css doc/tutorial-en.html doc/tutorial-ja.html @@ -129,7 +168,11 @@ fi %{_datadir}/%{short_name}/pgpool.conf.sample-stream %{_libdir}/libpcp.so.* %{_datadir}/%{short_name}/pgpool.pam +%if %{systemd_enabled} %{_unitdir}/pgpool.service +%else +%{_sysconfdir}/init.d/pgpool +%endif %attr(764,root,root) %config(noreplace) %{_sysconfdir}/%{short_name}/*.conf %config(noreplace) %{_sysconfdir}/sysconfig/pgpool @@ -140,8 +183,19 @@ fi %{_includedir}/pool_type.h %{_libdir}/libpcp.so +%files recovery +%{_libdir}/pgsql/pgpool-recovery.so +%{_datadir}/pgsql/contrib/pgpool-recovery.sql +%{_datadir}/pgsql/contrib/uninstall_pgpool-recovery.sql +%doc sample/pgpool_recovery* %changelog +* Wed Sep 19 2012 Tom Callaway - 3.2.0-1 +- update to 3.2.0 +- add recovery subpackage (thanks to Dmitry S. Makovey) +- add rhel conditionalization (thanks to Dmitry S. Makovey) +- update systemd scriptlets + * Sat Jul 21 2012 Fedora Release Engineering - 3.1.3-2 - Rebuilt for https://fedoraproject.org/wiki/Fedora_18_Mass_Rebuild diff --git a/sources b/sources index 11794a0..aa256c1 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -3094f4a8cc24a7ff5e40e37b1db243e7 pgpool-II-3.1.3.tar.gz +b3194d7ff15c2c74a803a323c4afd22b pgpool-II-3.2.0.tar.gz