Summary: TCP port reservation utility
Summary(ja): TCP ポート予約ユーティリティ
Name: portreserve
Version: 0.0.5
Release: 1%{?_dist_release}
License: GPLv2+
Group: System Environment/Daemons
URL: http://cyberelk.net/tim/portreserve/
Source0: http://cyberelk.net/tim/data/portreserve/stable/%{name}-%{version}.tar.bz2
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root

BuildRequires: xmlto

%description
The portreserve program aims to help services with well-known ports that
lie in the portmap range.  It prevents portmap from a real service's port
by occupying it itself, until the real service tells it to release the
port (generally in the init script).

%prep
%setup -q

%build
%configure --sbindir=/sbin
make

%install
rm -rf %{buildroot}
make DESTDIR=%{buildroot} install
mkdir -p %{buildroot}%{_localstatedir}/run/portreserve
mkdir -p %{buildroot}%{_initrddir}
install -m755 portreserve.init %{buildroot}%{_initrddir}/portreserve
mkdir -p %{buildroot}%{_sysconfdir}/portreserve
mkdir -p %{buildroot}%{_sysconfdir}/tmpfiles.d
cat <<EOF > %{buildroot}%{_sysconfdir}/tmpfiles.d/portreserve.conf
d %{_localstatedir}/run/portreserve 0755 root root 10d
EOF

%clean
rm -rf %{buildroot}

%post
# Do this unconditionally to fix up the initscript's start priority.
# Earlier versions had an incorrect dependency (bug #487250).
/sbin/chkconfig --add portreserve

%preun
if [ "$1" = 0 ]; then
  /sbin/service portreserve stop >/dev/null 2>&1
  /sbin/chkconfig --del portreserve
fi

%postun
if [ "$1" -ge "1" ]; then
  /sbin/service portreserve condrestart >/dev/null 2>&1
fi

%files
%defattr(-,root,root)
%doc ChangeLog README COPYING NEWS
%ghost %dir %{_localstatedir}/run/portreserve
%dir %{_sysconfdir}/portreserve
%config %{_sysconfdir}/tmpfiles.d/portreserve.conf
%attr(755,root,root) %{_initrddir}/portreserve
/sbin/*
%{_mandir}/*/*

%changelog
* Sun Feb 08 2015 Yoji TOYODA <bsyamato@sea.plala.or.jp> 0.0.5-1
- update to 0.0.5
- remove old patches

* Wed Mar 23 2011 Daisuke SUZUKI <daisuke@linux.or.jp> 0.0.4-1
- initial build for Vine Linux

* Wed Feb 09 2011 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.0.4-8
- Rebuilt for https://fedoraproject.org/wiki/Fedora_15_Mass_Rebuild

* Thu Dec  2 2010 Tim Waugh <twaugh@redhat.com> 0.0.4-7
- /var/run changes for systemd (bug #656670).

* Thu Nov 18 2010 Tim Waugh <twaugh@redhat.com> 0.0.4-6
- Fixed initscript exit code for "status" action (bug #619089).

* Thu Mar  4 2010 Tim Waugh <twaugh@redhat.com> 0.0.4-5
- Added comments to all patches.

* Fri Jan 22 2010 Tim Waugh <twaugh@redhat.com> 0.0.4-4
- Walk the list of newmaps correctly (bug #557781).

* Sun Jul 26 2009 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.0.4-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_12_Mass_Rebuild

* Fri Feb 27 2009 Tim Waugh <twaugh@redhat.com> 0.0.4-1
- 0.0.4:
  - Fixed initscript so that it will not be reordered to start after
    rpcbind (bug #487250).

* Thu Feb 26 2009 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.0.3-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_11_Mass_Rebuild

* Wed Feb  4 2009 Tim Waugh <twaugh@redhat.com> 0.0.3-3
- No longer need SELinux policy as it is now part of the
  selinux-policy package.

* Wed Oct 15 2008 Tim Waugh <twaugh@redhat.com> 0.0.3-2
- New selinux sub-package for SELinux policy.  Policy contributed by
  Miroslav Grepl (thanks!).

* Tue Jul  1 2008 Tim Waugh <twaugh@redhat.com> 0.0.3-1
- 0.0.3:
  - Allow multiple services to be defined in a single configuration
    file.
  - Allow protocol specifications, e.g. ipp/udp.

* Mon Jun 30 2008 Tim Waugh <twaugh@redhat.com> 0.0.2-1
- 0.0.2.

* Fri May  9 2008 Tim Waugh <twaugh@redhat.com> 0.0.1-2
- More consistent use of macros.
- Build requires xmlto.
- Don't use %%makeinstall.
- No need to run make check.

* Thu May  8 2008 Tim Waugh <twaugh@redhat.com> 0.0.1-1
- Default permissions for directories.
- Initscript should not be marked config.
- Fixed license tag.
- Better buildroot tag.

* Wed Sep  3 2003 Tim Waugh <twaugh@redhat.com>
- Initial spec file.
