File opentftp.spec of Package opentftp

#
# spec file for package opentftp
#
# Copyright (c) 2010 SUSE LINUX Products 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 pkg_version spV1.62
#%define auid 50
#%define agid 50

Name:           opentftp
Summary:        Open TFTP Server
Version:        1.62
Release:        1
License:        GPLv2
Group:          System/Daemons
Url:            http://sourceforge.net/projects/tftp-server/
Source:         %{name}%{pkg_version}.tar.bz2
#Source1:        atftpd.init.d
#Source2:        atftpd.sysconfig
#Source3:        atftpd.logrotate
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
#PreReq:         %insserv_prereq  %fillup_prereq
#PreReq:         pwdutils /usr/bin/getent
BuildRequires:   gcc-c++
#BuildRequires:  readline-devel tcpd-devel
Conflicts:      tftp
#Requires:       logrotate

%description
A single port TFTP Server based on Trivial File Transfer Protocol
and is normally used for PXE Boot or other Network Boots. It supports
advance options like tsize, blksize, block number rollover and timeout.

%prep
%setup -q -n %{name}
chmod 0644 README opentftpd.ini

%build
g++ $RPM_OPT_FLAGS opentftpd.cpp -oopentftpd -lpthread

%install
%{__install} -D -m0644 opentftpd.ini %{buildroot}/etc/opentftpd.ini
%{__install} -D -m0755 opentftpd %{buildroot}/%{_sbindir}/opentftpd

%pre
#if [ -z  "`%{_bindir}/getent %{name} group 2>/dev/null`" ]; then
#  %{_sbindir}/groupadd -g %{agid} %{name} 2>/dev/null
#  if [ $? != 0 ]; then
#    %{_sbindir}/groupadd -r %{name} 2>/dev/null
#  fi
#fi
#if [ -z "`%{_bindir}/getent %{name} passwd 2>/dev/null`" ]; then
#  %{_sbindir}/useradd -c "TFTP account" -d /tftpboot -G %{name} -g %{name} -u %{auid} \
#      -s /bin/false %{name} 2>/dev/null
#  if [ $? != 0 ]; then
#    %{_sbindir}/useradd -c "TFTP account" -d /tftpboot -G %{name} -g %{name} -r \
#      -s /bin/false %{name} 2>/dev/null
#  fi
#fi

%preun
%stop_on_removal opentftpd

#%post
#%{fillup_only -n atftpd}

%postun
%restart_on_update opentftpd
%{insserv_cleanup}

%clean
%{__rm} -rf $RPM_BUILD_ROOT

%files
%defattr(-,root,root)
%doc README
%{_sbindir}/opentftpd
%config /etc/opentftpd.ini

%changelog

openSUSE Build Service is sponsored by