File pound.spec of Package pound
#
# spec file for package pound
#
# Copyright (c) 2020 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
# Please submit bugfixes or comments via https://bugs.opensuse.org/
#
%if 0%{?suse_version} > 1230
%bcond_without systemd
%else
%bcond_with systemd
%endif
Name: pound
Version: 3.0d
Release: 0
Summary: Reverse proxy and load balancer
License: SUSE-GPL-3.0+-with-openssl-exception
Group: Productivity/Networking/Web/Proxy
URL: http://www.apsis.ch/pound.html
Source0: http://www.apsis.ch/pound/Pound-%{version}.tgz
Source1: pound.yaml
Source2: init.pound
Source3: %{name}.service
BuildRequires: cmake
BuildRequires: libyaml-devel
BuildRequires: mbedtls-devel
BuildRequires: nanomsg-devel
BuildRequires: zlib-devel
Requires(pre): shadow
%if %{with systemd}
BuildRequires: systemd-rpm-macros
%{?systemd_requires}
%else
Requires(pre): %insserv_prereq
%endif
%description
The Pound program is a reverse proxy, load balancer and HTTPS front-end
for Web server(s). Pound was developed to enable distributing the load
among several web servers and to allow for a convenient SSL wrapper for
those web servers that do not offer it natively.
%prep
%setup -q -n Pound-%{version}
%build
%cmake
%cmake_build
%install
install -Dm 0755 build/pound %{buildroot}%{_sbindir}/pound
install -Dm 0644 man/pound.8 %{buildroot}%{_mandir}/man8/pound.8
# Install pound init script
%if %{with systemd}
install -Dm 0644 %{SOURCE3} %{buildroot}/%{_unitdir}/pound.service
ln -s %{_sbindir}/service %{buildroot}%{_sbindir}/rc%{name}
%else
install -Dm 0744 %{SOURCE2} %{buildroot}%{_initddir}/pound
ln -sf ../..%{_initddir}/pound %{buildroot}%{_sbindir}/rcpound
%endif
install -Dm 0644 %{SOURCE1} %{buildroot}%{_sysconfdir}/pound/pound.yaml
%pre
# Add the "pound" user and group
getent group pound >/dev/null || %{_sbindir}/groupadd -r pound
getent passwd pound >/dev/null || \
%{_sbindir}/useradd -c "Pound" -g pound -r -d %{_localstatedir}/lib/pound pound
%if %{with systemd}
%service_add_pre %{name}.service
%endif
%post
%if %{with systemd}
%service_add_post %{name}.service
%else
%{fillup_and_insserv -f -n pound pound}
%endif
%postun
%if %{with systemd}
%service_del_postun %{name}.service
%else
%restart_on_update pound
%insserv_cleanup
%endif
%preun
%if %{with systemd}
%service_del_preun %{name}.service
%else
%stop_on_removal pound
%endif
%files
%doc README.md
%license GPL.txt
%if %{with systemd}
%{_unitdir}/%{name}.service
%else
%{_initddir}/pound
%endif
%attr(555, root, root) %{_sbindir}/pound
%{_sbindir}/rcpound
%{_mandir}/man8/pound.8%{?ext_man}
%dir %{_sysconfdir}/pound
%config(noreplace) %{_sysconfdir}/pound/pound.yaml
%changelog