SPECS/pgbouncer/pgbouncer.spec
d18d8603
 Summary:	Connection pooler for PostgreSQL.
 Name:		pgbouncer
 Version:	1.7.2
7f9d2e12
 Release:	7%{?dist}
d18d8603
 License:	BSD
 URL:		https://wiki.postgresql.org/wiki/PgBouncer
 Source0:        https://pgbouncer.github.io/downloads/files/1.7.2/%{name}-%{version}.tar.gz
 %define sha1 pgbouncer=d9bb29da15d90713e2399af3ebf5019da5cbe2d6
ffae6476
 Source1:        pgbouncer.service
d18d8603
 Group:		Application/Databases.
 Vendor:		VMware, Inc.
 Distribution:	Photon
 BuildRequires:  libevent-devel
 BuildRequires:  openssl-devel
 BuildRequires:  systemd
 BuildRequires:  pkg-config
8782caec
 Requires:		libevent
 Requires:		openssl
7f9d2e12
 Requires(pre):  /usr/sbin/useradd /usr/sbin/groupadd
 Requires(postun):/usr/sbin/userdel /usr/sbin/groupdel
d18d8603
 %description
 Pgbouncer is a light-weight, robust connection pooler for PostgreSQL.
 
 %prep
 %setup
 
 %build
 %configure --datadir=%{_datadir}
 make %{?_smp_mflags} V=1
 
 %install
 [ %{buildroot} != "/"] && rm -rf %{buildroot}/*
 make DESTDIR=%{buildroot} install
 install -vdm 744 %{buildroot}/var/log/pgbouncer
 install -vdm 755 %{buildroot}/var/run/pgbouncer
 install -p -d %{buildroot}%{_sysconfdir}/
 install -p -d %{buildroot}%{_sysconfdir}/sysconfig
 install -p -m 644 etc/pgbouncer.ini %{buildroot}%{_sysconfdir}/
 mkdir -p %{buildroot}/etc/systemd/system/
ffae6476
 install -m 0644 %{SOURCE1} %{buildroot}/etc/systemd/system/%{name}.service
d18d8603
 
64ab4af5
 %check
 pushd test
 make all
 popd
 
d18d8603
 %pre
819141e7
 if ! getent group %{name} >/dev/null; then
     /sbin/groupadd -r %{name}
 fi
 if ! getent passwd %{name} >/dev/null; then
     /sbin/useradd -g %{name} %{name}
 fi
d18d8603
 
 %post
819141e7
 if [ $1 -eq 1 ] ; then
     chown %{name}:%{name} /var/log/%{name}
     chown %{name}:%{name} /var/run/%{name}
 fi
d18d8603
 
 %postun
819141e7
 if [ $1 -eq 0 ] ; then
     if getent passwd %{name} >/dev/null; then
         /sbin/userdel %{name}
     fi
     if getent group %{name} >/dev/null; then
         /sbin/groupdel %{name}
     fi
     rm -rf /var/log/%{name}
     rm -rf /var/run/%{name}
 fi
d18d8603
 
 %files
 %defattr(-,root,root,-)
 %{_bindir}/*
 /etc/systemd/system/%{name}.service
 %config(noreplace) %{_sysconfdir}/%{name}.ini
 %{_mandir}/man1/%{name}.*
 %{_mandir}/man5/%{name}.*
 /usr/share/doc/pgbouncer/*
 
 %changelog
7f9d2e12
 *   Mon Sep 18 2017 Alexey Makhalov <amakhalov@vmware.com> 1.7.2-7
 -   Remove shadow from requires and use explicit tools for post actions
ffae6476
 *   Mon Jul 24 2017 Dheeraj Shetty <dheerajs@vmware.com> 1.7.2-6
 -   Seperate the service file from the spec file
3c5a1d35
 *   Wed May 31 2017 Rongrong Qiu <rqiu@vmware.com> 1.7.2-5
 -   Add RuntimeDirectory and Type=forking
 *   Thu Apr 13 2017 Harish Udaiya Kumar <hudaiyakumar@vmware.com> 1.7.2-4
 -   Fixed the requires.
 *   Tue May 24 2016 Priyesh Padmavilasom <ppadmavilasom@vmware.com> 1.7.2-3
 -   GA - Bump release of all rpms
 *   Wed May 04 2016 Anish Swaminathan <anishs@vmware.com> 1.7.2-2
 -   Edit scriptlets.
 *   Thu Apr 28 2016 Kumar Kaushik <kaushikk@vmware.com> 1.7.2-1
 -   Initial Version.