portreserve/portreserve.spec
2019-11-19 11:53:02 +08:00

78 lines
2.2 KiB
RPMSpec

Name: portreserve
Version: 0.0.5
Release: 21
Summary: Reserve ports to prevent portmap mapping them
License: GPLv2+
URL: http://cyberelk.net/tim/portreserve/
Source0: http://cyberelk.net/tim/data/portreserve/stable/%{name}-%{version}.tar.bz2
Source1: portreserve.service
Patch0001: portreserve-pid-file.patch
BuildRequires: gcc xmlto systemd-units
Requires(post): systemd-units systemd-sysv
Requires(preun): systemd-units
Requires(postun): systemd-units
Obsoletes: portreserve-selinux < 0.0.3-3
%description
The portreserve program aims to help services with well-known ports that lie in the
bindresvport() range (currently 600-1023).. It prevents programs requesting a port
to the libc from occupying a real service's port by occupying it itself, until the
real service tells it to release the port (generally in the init script).
%package help
Summary: Help documents for portreserve
Requires: %{name} = %{version}-%{release}
%description help
Man pages and other related help documents for portreserve.
%prep
%autosetup -n %{name}-%{version} -p1
%build
%configure --sbindir=/sbin
make
%install
%make_install
install -d %{buildroot}%{_unitdir}
install -d %{buildroot}%{_tmpfilesdir}
install -d %{buildroot}%{_sysconfdir}/portreserve
install -d %{buildroot}%{_localstatedir}/run/portreserve
install -m644 %{SOURCE1} %{buildroot}%{_unitdir}/portreserve.service
cat << EOF > %{buildroot}%{_tmpfilesdir}/portreserve.conf
d %{_localstatedir}/run/portreserve 0755 root root 10d
EOF
%post
%systemd_post portreserve.service
%preun
%systemd_preun portreserve.service
%postun
%systemd_postun_with_restart portreserve.service
%triggerun -- portreserve < 0.0.5-3
%{_bindir}/systemd-sysv-convert --save portreserve >/dev/null 2>&1 ||:
/sbin/chkconfig --del portreserve >/dev/null 2>&1 || :
/bin/systemctl try-restart portreserve.service >/dev/null 2>&1 || :
%files
%doc COPYING
%{_unitdir}/portreserve.service
%dir %{_sysconfdir}/portreserve
%dir %{_localstatedir}/run/portreserve
%config %{_tmpfilesdir}/portreserve.conf
/sbin/*
%files help
%doc ChangeLog README NEWS
%{_mandir}/*/*
%changelog
* Wed Nov 06 2019 yanzhihua <yanzhihua4@huawei.com> - 0.0.5-21
- Package init