rinetd/rinetd.spec

93 lines
2.8 KiB
RPMSpec

%define with_systemd 1
Name: rinetd
Version: 0.62
Release: 4
Summary: TCP Redirection Server
License: GPL-2.0-or-later
URL: http://www.boutell.com/rinetd/
Source0: %{name}-%{version}.tar.bz2
Source1: rc.rinetd
Source2: logrotate.rinetd
Source3: rinetd.service
Patch0: rinetd-doc.patch
Patch1: rinetd-syslog.patch
Patch2: rinetd-conf.patch
BuildRoot: %{_tmppath}/%{name}-%{version}-build
%if %{with_systemd}
BuildRequires: pkgconfig(systemd)
%{?systemd_ordering}
%else
PreReq: %fillup_prereq %insserv_prereq
%endif
%description
rinetd redirects TCP connections from one IP address and port to
another address and port. rinetd is a single-process server which
handles any number of connections to the address or port pairs
specified in the file /etc/rinetd.conf. Because rinetd runs as a single
process using nonblocking I/O, it is able to redirect a large number of
connections without a severe impact on the machine. This makes it
practical to run TCP services on machines inside an IP masquerading
firewall.
Note: rinetd can not redirect FTP because FTP requires more than one
socket.
%prep
%autosetup
%build
make CFLAGS="$CFLAGS $RPM_OPT_FLAGS -DLINUX -fno-strict-aliasing"
%install
mkdir -p %{buildroot}/%_mandir/man8
mkdir -p %{buildroot}/%{_sbindir}
%if %{with_systemd}
mkdir -p %{buildroot}%{_unitdir}
install -m 644 %{SOURCE3} %{buildroot}%{_unitdir}/%{name}.service
ln -s /usr/sbin/service %{buildroot}%{_sbindir}/rc%{name}
%else
mkdir -p %{buildroot}/etc/init.d
install -m 755 %{SOURCE1} $RPM_BUILD_ROOT/etc/init.d/rinetd
ln -s ../../etc/init.d/rinetd $RPM_BUILD_ROOT/usr/sbin/rcrinetd
%endif
mkdir -p %{buildroot}/etc/logrotate.d
touch $RPM_BUILD_ROOT/etc/rinetd.conf
install -m 700 rinetd %{buildroot}/usr/sbin
install -m 644 rinetd.8 %{buildroot}%_mandir/man8
install -m 644 %SOURCE2 %{buildroot}/etc/logrotate.d/rinetd
%post
%systemd_post %{name}.service
%preun
%systemd_preun %{name}.service
%postun
%systemd_postun_with_restart %{name}.service
%files
%defattr(-, root, root)
%doc CHANGES README index.html rinetd.conf.sample
%config(noreplace) /etc/rinetd.conf
%config(noreplace) /etc/logrotate.d/rinetd
%if %{with_systemd}
%{_unitdir}/%{name}.service
%else
%config /etc/init.d/rinetd
%endif
%_mandir/man8/rinetd.8.gz
/usr/sbin/rcrinetd
/usr/sbin/rinetd
%changelog
* Mon Sep 13 2021 lingsheng <lingsheng@huawei.com> - 0.62-4
- Fix service description typo, PIDFILE location and cannot open problem
* Mon Aug 30 2021 caodongxia <caodongxia@huawei.com> - 0.62-3
- fix miss rinetd.conf
* Sat 28 Aug 2021 wangyue <wangyue92@huawei.com> - 0.62-2
- fix post and postun error
* Fri May 7 2021 baizhonggui <baizhonggui@huawei.com> - 0.62-1
- package init