michael@795: ## michael@795: ## tftp.spec -- OpenPKG RPM Package Specification michael@795: ## Copyright (c) 2000-2014 OpenPKG Foundation e.V. michael@795: ## michael@795: ## Permission to use, copy, modify, and distribute this software for michael@795: ## any purpose with or without fee is hereby granted, provided that michael@795: ## the above copyright notice and this permission notice appear in all michael@795: ## copies. michael@795: ## michael@795: ## THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED michael@795: ## WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF michael@795: ## MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. michael@795: ## IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR michael@795: ## CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, michael@795: ## SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT michael@795: ## LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF michael@795: ## USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND michael@795: ## ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, michael@795: ## OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT michael@795: ## OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF michael@795: ## SUCH DAMAGE. michael@795: ## michael@795: michael@795: # package information michael@795: Name: tftp michael@795: Summary: TFTP Client and Server michael@795: URL: http://www.kernel.org/pub/software/network/tftp/ michael@795: Vendor: H. Peter Anvin michael@795: Packager: OpenPKG Foundation e.V. michael@795: Distribution: OpenPKG Community michael@795: Class: BASE michael@795: Group: FTP michael@795: License: GPL michael@795: Version: 5.2 michael@795: Release: 20140301 michael@795: michael@795: # package options michael@795: %option with_fsl yes michael@795: michael@795: # list of sources michael@795: Source0: http://www.kernel.org/pub/software/network/tftp/tftp-hpa/tftp-hpa-%{version}.tar.gz michael@795: Source1: tftpd.remap michael@795: Source2: rc.tftp michael@795: Source3: fsl.tftp michael@795: Patch0: tftp.patch michael@795: michael@795: # build information michael@795: BuildPreReq: OpenPKG, openpkg >= 20100101, make, gcc michael@795: PreReq: OpenPKG, openpkg >= 20100101 michael@795: BuildPreReq: getopt michael@795: PreReq: getopt michael@795: %if "%{with_fsl}" == "yes" michael@795: BuildPreReq: fsl michael@795: PreReq: fsl michael@795: %endif michael@795: michael@795: %description michael@795: This is a portable client and server for the Trivial File Transfer michael@795: Protocol (TFTP). michael@795: michael@795: %track michael@795: prog tftp = { michael@795: version = %{version} michael@795: url = http://www.kernel.org/pub/software/network/tftp/tftp-hpa/ michael@795: regex = tftp-hpa-(__VER__)\.tar\.gz michael@795: } michael@795: michael@795: %prep michael@795: %setup -q -n tftp-hpa-%{version} michael@795: %patch -p0 michael@795: %{l_shtool} subst -e 's;PKTSIZE;TFTP_PKTSIZE;g' */*.[ch] michael@795: michael@795: %build michael@795: export CC="%{l_cc}" michael@795: export CFLAGS="%{l_cflags -O} %{l_cppflags} -DPID_FILE='\"%{l_prefix}/var/tftp/tftpd.pid\"'" michael@795: export CPPFLAGS="%{l_cppflags}" michael@795: export LDFLAGS="%{l_ldflags} %{l_fsl_ldflags}" michael@795: export LIBS="%{l_fsl_libs} -lgetopt" michael@795: case "%{l_platform -t}" in michael@795: *-netbsd* ) michael@795: CFLAGS="$CFLAGS -D_NETBSD_SOURCE" michael@795: CPPFLAGS="$CPPFLAGS -D_NETBSD_SOURCE" michael@795: ;; michael@795: esac michael@795: ./configure \ michael@795: --prefix=%{l_prefix} \ michael@795: --mandir=%{l_prefix}/man \ michael@795: --with-remap \ michael@795: --without-tcpwrappers \ michael@795: --without-readline michael@795: %{l_shtool} subst -e 's; -W[^ ]*;;g' MCONFIG michael@795: %{l_make} %{l_mflags} michael@795: michael@795: %install michael@795: %{l_shtool} mkdir -f -p -m 755 \ michael@795: $RPM_BUILD_ROOT%{l_prefix}/var/tftp \ michael@795: $RPM_BUILD_ROOT%{l_prefix}/etc/tftp \ michael@795: $RPM_BUILD_ROOT%{l_prefix}/var/tftp michael@795: %{l_make} %{l_mflags} install \ michael@795: INSTALL="%{l_shtool} install -c" \ michael@795: INSTALLROOT=$RPM_BUILD_ROOT michael@795: %{l_shtool} install -c -m 644 %{l_value -s -a} \ michael@795: %{SOURCE tftpd.remap} $RPM_BUILD_ROOT%{l_prefix}/etc/tftp/ michael@795: rm -f $RPM_BUILD_ROOT%{l_prefix}/man/man8/tftpd.8 michael@795: mv $RPM_BUILD_ROOT%{l_prefix}/man/man8/in.tftpd.8 \ michael@795: $RPM_BUILD_ROOT%{l_prefix}/man/man8/tftpd.8 michael@795: mv $RPM_BUILD_ROOT%{l_prefix}/sbin/in.tftpd \ michael@795: $RPM_BUILD_ROOT%{l_prefix}/sbin/tftpd michael@795: strip $RPM_BUILD_ROOT%{l_prefix}/bin/* >/dev/null 2>&1 || true michael@795: strip $RPM_BUILD_ROOT%{l_prefix}/sbin/* >/dev/null 2>&1 || true michael@795: michael@795: # install run-command script michael@795: %{l_shtool} mkdir -f -p -m 755 \ michael@795: $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d michael@795: %{l_shtool} install -c -m 755 %{l_value -s -a} \ michael@795: %{SOURCE rc.tftp} $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d/ michael@795: michael@795: # install OSSP fsl configuration michael@795: %{l_shtool} mkdir -f -p -m 755 $RPM_BUILD_ROOT%{l_prefix}/etc/fsl michael@795: %{l_shtool} install -c -m 644 %{l_value -s -a} \ michael@795: %{SOURCE fsl.tftp} \ michael@795: $RPM_BUILD_ROOT%{l_prefix}/etc/fsl/ michael@795: michael@795: # determine installation files michael@795: %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT \ michael@795: %{l_files_std} \ michael@795: '%config %{l_prefix}/etc/fsl/fsl.tftp' \ michael@795: '%config %{l_prefix}/etc/tftp/*' michael@795: michael@795: %files -f files michael@795: michael@795: %clean michael@795: michael@795: %pre michael@795: # before upgrade, save status and stop service michael@795: [ $1 -eq 2 ] || exit 0 michael@795: eval `%{l_rc} tftp status 2>/dev/null | tee %{l_tmpfile}` michael@795: %{l_rc} tftp stop 2>/dev/null michael@795: exit 0 michael@795: michael@795: %post michael@795: if [ $1 -eq 2 ]; then michael@795: # after upgrade, restore status michael@795: eval `cat %{l_tmpfile}`; rm -f %{l_tmpfile} michael@795: [ ".$tftp_active" = .yes ] && %{l_rc} tftp start michael@795: fi michael@795: exit 0 michael@795: michael@795: %preun michael@795: # before erase, stop service and remove log files michael@795: [ $1 -eq 0 ] || exit 0 michael@795: %{l_rc} tftp stop 2>/dev/null michael@795: rm -f $RPM_INSTALL_PREFIX/var/tftp/*.log* >/dev/null 2>&1 || true michael@795: exit 0 michael@795: