File tftp.spec of Package tftp.6441
#
# spec file for package tftp
#
# Copyright (c) 2018 SUSE LINUX GmbH, Nuernberg, Germany.
#
# 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 http://bugs.opensuse.org/
#
%define _fwdefdir /etc/sysconfig/SuSEfirewall2.d/services
%if 0%{?suse_version} >= 1230
%define _systemddir /usr/lib/systemd/
%else
%define _systemddir /lib/systemd/
%endif
%define _unitdir %{_systemddir}/system
#Compat macro for new _fillupdir macro introduced in Nov 2017
%if ! %{defined _fillupdir}
%define _fillupdir /var/adm/fillup-templates
%endif
Name: tftp
Version: 5.2
Release: 0
Summary: Trivial File Transfer Protocol (TFTP)
License: BSD-3-Clause
Group: Productivity/Networking/Ftp/Clients
Url: http://www.kernel.org/pub/software/network/tftp/
Source: http://www.kernel.org/pub/software/network/tftp/tftp-hpa-%{version}.tar.bz2
Source1: tftp.xinetd
Source2: tftp.fw
Source3: tftp.service
Source4: tftp.socket
Source5: tftp.sysconfig
Patch0: tftp-hpa-0.43_include_sys_params.patch
Patch1: tftp-hpa-0.46_colon_check.patch
Patch4: tftp-hpa-0.49-fortify-strcpy-crash.patch
Patch5: tftp-hpa-0.48-tzfix.patch
Patch42: tftp-hpa-0.43_old-autoconf.diff
Patch6: tftp-multi-addresses.patch
Patch7: tftp-hpa-0.48-macros-crash.patch
Patch8: tftp-hpa-0.48-macros-v6mapped.patch
Provides: tftp(client)
Provides: tftp(server)
PreReq: pwdutils
BuildRequires: autoconf
BuildRequires: pwdutils
BuildRequires: tcpd-devel
BuildRoot: %{_tmppath}/%{name}-%{version}-build
%if 0%{?suse_version} > 1110
BuildRequires: binutils-devel
%endif
Recommends: inet-daemon
Requires: netcfg
Conflicts: atftp
%description
The Trivial File Transfer Protocol (TFTP) is normally used only for
booting diskless workstations and for getting or saving network
component configuration files.
%prep
%setup -n %{name}-hpa-%{version}
%patch0
%patch1
%patch4 -p1
%patch5 -p1
%patch6 -p1
%patch7
%patch8
%if 0%{?suse_version} < 1030
%patch42
%endif
%build
autoreconf -fi
%configure \
--enable-largefile \
--with-tcpwrappers \
--with-remap \
--without-editline \
--with-ipv6
make
%install
%makeinstall INSTALLROOT=%{buildroot} MANDIR="%{_mandir}"
install -D -m 0644 %{SOURCE1} %{buildroot}%{_sysconfdir}/xinetd.d/tftp
mkdir -p $RPM_BUILD_ROOT/%{_fwdefdir}
install -m 644 %SOURCE2 $RPM_BUILD_ROOT/%{_fwdefdir}/tftp
install -d -m 0755 %{buildroot}/srv/tftpboot
# Install systemd unit / socket (As an alternativ to xinetd activation)
install -d %{buildroot}%{_unitdir}
install -m 0644 %{S:3} %{S:4} %{buildroot}%{_unitdir}
install -D -m 0644 %{SOURCE5} %{buildroot}%{_fillupdir}/sysconfig.tftp
ln -sv %{_sbindir}/service %{buildroot}%{_sbindir}/rc%{name}
%pre
# This group/user is shared with atftp, so please
# keep this in sync with atftp.spec
# add group
%{_sbindir}/groupadd -r tftp 2>/dev/null || :
# add user
%{_sbindir}/useradd -c "TFTP account" -d /srv/tftpboot -G tftp -g tftp \
-r -s /bin/false tftp 2>/dev/null || :
%service_add_pre %{name}.service %{name}.socket
%preun
%service_del_preun %{name}.service %{name}.socket
%post
%service_add_post %{name}.service %{name}.socket
%{fillup_only -n tftp}
%postun
%service_del_postun %{name}.service %{name}.socket
%clean
rm -rf %{buildroot};
%files
%defattr(-,root,root)
%doc README README.security tftpd/sample.rules
%{_bindir}/tftp
%{_sbindir}/in.tftpd
%{_sbindir}/rctftp
%{_mandir}/man1/tftp.1.gz
%{_mandir}/man8/in.tftpd.8.gz
%{_mandir}/man8/tftpd.8.gz
%dir %{_systemddir}
%dir %{_unitdir}
%{_unitdir}/tftp.service
%{_unitdir}/tftp.socket
%config(noreplace) %{_sysconfdir}/xinetd.d/tftp
%config %{_fwdefdir}/tftp
%dir %attr(0755,tftp,tftp) /srv/tftpboot
%{_fillupdir}/sysconfig.tftp
%changelog