LogoopenSUSE Build Service > Projects
Sign Up | Log In

View File atftp.spec of Package atftp (Project home:vitezslav_cizek:branches:network)

#
# spec file for package atftp
#
# Copyright (c) 2015 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 %{_sysconfdir}/sysconfig/SuSEfirewall2.d/services
%define pkg_version 0.7
Name:           atftp
Version:        0.7.0
Release:        0
Summary:        Advanced TFTP Server and Client
License:        GPL-2.0+
Group:          System/Daemons
Url:            ftp://ftp.mamalinux.com/pub/atftp/
Source:         %{name}-%{pkg_version}.tar.bz2
Source1:        atftpd.init
Source2:        atftpd.sysconfig
Source3:        atftpd.logrotate
Source4:        atftp.fw
Source5:        atftpd.service
Source6:        atftpd.socket
Patch1:         atftp-0.7.dif
Patch2:         atftp-CLK_TCK.diff
Patch3:         atftp-0.7_compiler_warnings.patch
Patch4:         atftp-0.7_thread_crash.patch
Patch5:         atftp-0.7_sol_ip.patch
Patch6:         atftp-0.7_bug-213384_OPT_NUMBER.patch
Patch7:         atftpd-0.7_unprotected_assignments_crash.patch
Patch8:         atftpd-0.7_circumvent_tftp_size_restrictions.patch
# PATCH-FIX-SUSE sorcerer's apprentice syndrom (bnc#727843)
Patch9:         atftp-0.7-sorcerers_apprentice.patch
# PATCH-FIX-SUSE server receive thread race (bnc#599856)
Patch10:        atftp-0.7-server_receive_race.patch
# PATCH-FIX-SUSE drop one duplicated ACK each round (bnc#774376)
Patch12:        atftp-0.7-ack_heuristic.patch
Patch13:        atftp-0.7-default_user_man.patch
# PATCH-FIX-SUSE update default directory in man (bnc#507011)
Patch14:        atftp-0.7-default_dir_man.patch
BuildRequires:  autoconf
BuildRequires:  automake
BuildRequires:  pcre-devel
BuildRequires:  readline-devel
BuildRequires:  tcpd-devel
Requires(pre):  %fillup_prereq
Requires(pre):  pwdutils
Recommends:     logrotate
Conflicts:      tftp
Provides:       tftp(client)
Provides:       tftp(server)
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
%if 0%{?suse_version} >= 1210
BuildRequires:  systemd-rpm-macros
%{?systemd_requires}
%else
Requires(pre):	%insserv_prereq
%endif

%description
atftp stands for Advanced Trivial File Transfer Protocol. It is called
"advanced", in contrast to others TFTP servers, for two reasons. First,
it is intended to be fully compliant with all related RFCs. This
includes RFC1350, RFC2090, RFC2347, RFC2348, and RFC2349. Second, atftp
is intended for serving boot files to large clusters. It is
multithreaded and will eventually support multicast, allowing faster
boot of hundreds of machines simultaneously.

%prep
%setup -q -n %{name}-%{pkg_version}
%patch1
%patch2
%patch3
%patch4
%patch5
%patch6
%patch7
%patch8
%patch9
%patch10
%patch12
%patch13
%patch14

%build
autoreconf -fi
CFLAGS="%optflags -fgnu89-inline"
%configure
make %{?_smp_mflags}

%install
make DESTDIR=%{buildroot} install %{?_smp_mflags}
# SuSE rc
%if 0%{?suse_version} >= 1210
install -D -m 0644 %{SOURCE5} %{buildroot}/%{_unitdir}/atftpd.service
install -D -m 0644 %{SOURCE6} %{buildroot}/%{_unitdir}/atftpd.socket
ln -s %{_sbindir}/service %{buildroot}%{_sbindir}/rcatftpd
%else
install -D -m 0755 %{SOURCE1} %{buildroot}%{_initddir}/atftpd
ln -s -f ../..%{_initddir}/atftpd %{buildroot}%{_sbindir}/rcatftpd
%endif
install -D -m 0644 %{SOURCE2} %{buildroot}%{_localstatedir}/adm/fillup-templates/sysconfig.atftpd
install -D -m 0644 %{SOURCE3} %{buildroot}%{_sysconfdir}/logrotate.d/%{name}
mkdir -p %{buildroot}/%{_fwdefdir}
install -m 0644 %{SOURCE4} %{buildroot}/%{_fwdefdir}/atftp
install -d -m 0750 %{buildroot}/srv/tftpboot
install -d -m 0750 %{buildroot}%{_localstatedir}/log/atftpd

%pre
# This group/user is shared with tftp, so please
# keep this in sync with tftp.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 || :
# fix sysconfig to get new defaults on Update
if [ -f %{_sysconfdir}/sysconfig/atftpd ]; then
  sed -i -e "s@^\(ATFTPD_OPTIONS=\"--daemon \"\)@#\1@" %{_sysconfdir}/sysconfig/atftpd
  sed -i -e "s@^\(ATFTPD_DIRECTORY=\"/tftpboot\"\)@#\1@" %{_sysconfdir}/sysconfig/atftpd
fi
%if 0%{?suse_version} >= 1210
%service_add_pre atftpd.service atftpd.socket
%endif

%preun
%if 0%{?suse_version} >= 1210
%service_del_preun atftpd.service atftpd.socket
%else
%stop_on_removal atftpd
%endif

%post
%if 0%{?suse_version} >= 1210
%service_add_post atftpd.service atftpd.socket
%endif
%{fillup_only -n atftpd}

%postun
%if 0%{?suse_version} >= 1210
%service_del_postun atftpd.service atftpd.socket
%else
%restart_on_update atftpd
%insserv_cleanup
%endif

%files
%defattr(-,root,root)
%doc BUGS FAQ LICENSE README README.MCAST README.PCRE TODO
%{_bindir}/atftp
%{_sbindir}/atftpd
%{_sbindir}/in.tftpd
%{_sbindir}/rcatftpd
%if 0%{?suse_version} >= 1210
%{_unitdir}/atftpd.service
%{_unitdir}/atftpd.socket
%else
%{_initddir}/atftpd
%endif
%config %{_sysconfdir}/logrotate.d/%{name}
%{_localstatedir}/adm/fillup-templates/sysconfig.atftpd
%{_mandir}/man1/atftp.1.gz
%{_mandir}/man8/atftpd.8.gz
%{_mandir}/man8/in.tftpd.8.gz
%config %{_fwdefdir}/atftp
%dir %attr(0750,tftp,tftp) /srv/tftpboot
%dir %attr(0750,tftp,tftp) %{_localstatedir}/log/atftpd/

%changelog