Mon, 25 Aug 2014 19:06:31 +0200
Import package vendor original specs for necessary manipulations.
tftp/fsl.tftp | file | annotate | diff | comparison | revisions | |
tftp/rc.tftp | file | annotate | diff | comparison | revisions | |
tftp/tftp.patch | file | annotate | diff | comparison | revisions | |
tftp/tftp.spec | file | annotate | diff | comparison | revisions | |
tftp/tftpd.remap | file | annotate | diff | comparison | revisions |
1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/tftp/fsl.tftp Mon Aug 25 19:06:31 2014 +0200 1.3 @@ -0,0 +1,16 @@ 1.4 +## 1.5 +## fsl.tftp -- OSSP fsl configuration 1.6 +## 1.7 + 1.8 +ident (tftpd)/.+ q{ 1.9 + prefix( 1.10 + prefix="%b %d %H:%M:%S %N <%L> $1[%P]: " 1.11 + ) 1.12 + -> { 1.13 + debug: file( 1.14 + path="@l_prefix@/var/tftp/tftp.log", 1.15 + perm=0644 1.16 + ) 1.17 + } 1.18 +}; 1.19 +
2.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 2.2 +++ b/tftp/rc.tftp Mon Aug 25 19:06:31 2014 +0200 2.3 @@ -0,0 +1,65 @@ 2.4 +#!@l_prefix@/bin/openpkg rc 2.5 +## 2.6 +## rc.tftp -- Run-Commands 2.7 +## 2.8 + 2.9 +%config 2.10 + tftp_enable="$openpkg_rc_def" 2.11 + tftp_listen="127.0.0.1:69" 2.12 + tftp_flags="" 2.13 + tftp_rootdir="@l_prefix@/pub" 2.14 + tftp_log_prolog="true" 2.15 + tftp_log_epilog="true" 2.16 + tftp_log_numfiles="10" 2.17 + tftp_log_minsize="1M" 2.18 + tftp_log_complevel="9" 2.19 + 2.20 +%common 2.21 + tftp_pidfile="@l_prefix@/var/tftp/tftpd.pid" 2.22 + tftp_signal () { 2.23 + [ -f $tftp_pidfile ] && kill -$1 `cat $tftp_pidfile` 2.24 + } 2.25 + 2.26 +%status -u @l_susr@ -o 2.27 + tftp_usable="unknown" 2.28 + tftp_active="no" 2.29 + rcService tftp enable yes && \ 2.30 + tftp_signal 0 && tftp_active="yes" 2.31 + echo "tftp_enable=\"$tftp_enable\"" 2.32 + echo "tftp_usable=\"$tftp_usable\"" 2.33 + echo "tftp_active=\"$tftp_active\"" 2.34 + 2.35 +%start -u @l_susr@ 2.36 + rcService tftp enable yes || exit 0 2.37 + rcService tftp active yes && exit 0 2.38 + opts="-l -u @l_nusr@ -m @l_prefix@/etc/tftp/tftpd.remap" 2.39 + if [ ".$tftp_listen" != . ]; then 2.40 + opts="$opts -a $tftp_listen" 2.41 + fi 2.42 + if [ ".$tftp_flags" != . ]; then 2.43 + opts="$opts $tftp_flags" 2.44 + fi 2.45 + @l_prefix@/sbin/tftpd $opts -s $tftp_rootdir 2.46 + 2.47 +%stop -u @l_susr@ 2.48 + rcService tftp enable yes || exit 0 2.49 + rcService tftp active no && exit 0 2.50 + tftp_signal TERM 2.51 + rm -f $tftp_pidfile 2>/dev/null || true 2.52 + 2.53 +%restart -u @l_susr@ 2.54 + rcService tftp enable yes || exit 0 2.55 + rcService tftp active no && exit 0 2.56 + rc tftp stop 2.57 + sleep 2 2.58 + rc tftp start 2.59 + 2.60 +%daily -u @l_susr@ 2.61 + rcService tftp enable yes || exit 0 2.62 + shtool rotate -f \ 2.63 + -n ${tftp_log_numfiles} -s ${tftp_log_minsize} -d \ 2.64 + -z ${tftp_log_complevel} -o @l_susr@ -g @l_mgrp@ -m 644 \ 2.65 + -P "${tftp_log_prolog}" \ 2.66 + -E "${tftp_log_epilog}; rc tftp restart" \ 2.67 + @l_prefix@/var/tftp/tftp.log 2.68 +
3.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 3.2 +++ b/tftp/tftp.patch Mon Aug 25 19:06:31 2014 +0200 3.3 @@ -0,0 +1,63 @@ 3.4 +Index: MCONFIG.in 3.5 +--- MCONFIG.in.orig 2011-06-23 01:32:56.000000000 +0200 3.6 ++++ MCONFIG.in 2011-06-24 20:54:05.000000000 +0200 3.7 +@@ -21,6 +21,7 @@ 3.8 + # Prefixes 3.9 + prefix = @prefix@ 3.10 + exec_prefix = @exec_prefix@ 3.11 ++datarootdir = @datarootdir@ 3.12 + 3.13 + # Directory for user binaries 3.14 + BINDIR = @bindir@ 3.15 +Index: Makefile 3.16 +--- Makefile.orig 2011-06-23 01:32:56.000000000 +0200 3.17 ++++ Makefile 2011-06-24 20:54:05.000000000 +0200 3.18 +@@ -59,9 +59,9 @@ 3.19 + # Adding "configure" to the dependencies serializes this with running 3.20 + # autoconf, because there are apparently race conditions between 3.21 + # autoconf and autoheader. 3.22 +-aconfig.h.in: configure.in configure aclocal.m4 3.23 +- rm -f aconfig.h.in aconfig.h 3.24 +- autoheader 3.25 ++#aconfig.h.in: configure.in configure aclocal.m4 3.26 ++# rm -f aconfig.h.in aconfig.h 3.27 ++# autoheader 3.28 + 3.29 + configure: configure.in aclocal.m4 3.30 + rm -rf MCONFIG configure config.log aconfig.h *.cache 3.31 +Index: tftpd/tftpd.c 3.32 +--- tftpd/tftpd.c.orig 2011-06-23 01:32:56.000000000 +0200 3.33 ++++ tftpd/tftpd.c 2011-06-24 20:54:05.000000000 +0200 3.34 +@@ -33,6 +33,9 @@ 3.35 + * SUCH DAMAGE. 3.36 + */ 3.37 + 3.38 ++#if defined(__NetBSD__) 3.39 ++#define _NETBSD_SOURCE 3.40 ++#endif 3.41 + #include "config.h" /* Must be included first */ 3.42 + #include "tftpd.h" 3.43 + 3.44 +@@ -767,6 +770,22 @@ 3.45 + #ifndef __CYGWIN__ 3.46 + set_socket_nonblock(fd, 1); 3.47 + #endif 3.48 ++#ifdef PID_FILE 3.49 ++ /* Write PID file */ 3.50 ++ { 3.51 ++ mode_t old_umask; 3.52 ++ pid_t pid; 3.53 ++ FILE *fp; 3.54 ++ 3.55 ++ old_umask = umask((mode_t) 0022); 3.56 ++ pid = getpid(); 3.57 ++ if ((fp = fopen(PID_FILE, "w")) == NULL) 3.58 ++ syslog(LOG_ERR, "cannot write PID file '%s'", PID_FILE); 3.59 ++ fprintf(fp, "%ld\n", (long)pid); 3.60 ++ fclose(fp); 3.61 ++ umask(old_umask); 3.62 ++ } 3.63 ++#endif 3.64 + } 3.65 + 3.66 + /* Disable path MTU discovery */
4.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 4.2 +++ b/tftp/tftp.spec Mon Aug 25 19:06:31 2014 +0200 4.3 @@ -0,0 +1,155 @@ 4.4 +## 4.5 +## tftp.spec -- OpenPKG RPM Package Specification 4.6 +## Copyright (c) 2000-2014 OpenPKG Foundation e.V. <http://openpkg.net/> 4.7 +## 4.8 +## Permission to use, copy, modify, and distribute this software for 4.9 +## any purpose with or without fee is hereby granted, provided that 4.10 +## the above copyright notice and this permission notice appear in all 4.11 +## copies. 4.12 +## 4.13 +## THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED 4.14 +## WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 4.15 +## MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 4.16 +## IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR 4.17 +## CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 4.18 +## SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 4.19 +## LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF 4.20 +## USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 4.21 +## ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 4.22 +## OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 4.23 +## OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 4.24 +## SUCH DAMAGE. 4.25 +## 4.26 + 4.27 +# package information 4.28 +Name: tftp 4.29 +Summary: TFTP Client and Server 4.30 +URL: http://www.kernel.org/pub/software/network/tftp/ 4.31 +Vendor: H. Peter Anvin 4.32 +Packager: OpenPKG Foundation e.V. 4.33 +Distribution: OpenPKG Community 4.34 +Class: BASE 4.35 +Group: FTP 4.36 +License: GPL 4.37 +Version: 5.2 4.38 +Release: 20140301 4.39 + 4.40 +# package options 4.41 +%option with_fsl yes 4.42 + 4.43 +# list of sources 4.44 +Source0: http://www.kernel.org/pub/software/network/tftp/tftp-hpa/tftp-hpa-%{version}.tar.gz 4.45 +Source1: tftpd.remap 4.46 +Source2: rc.tftp 4.47 +Source3: fsl.tftp 4.48 +Patch0: tftp.patch 4.49 + 4.50 +# build information 4.51 +BuildPreReq: OpenPKG, openpkg >= 20100101, make, gcc 4.52 +PreReq: OpenPKG, openpkg >= 20100101 4.53 +BuildPreReq: getopt 4.54 +PreReq: getopt 4.55 +%if "%{with_fsl}" == "yes" 4.56 +BuildPreReq: fsl 4.57 +PreReq: fsl 4.58 +%endif 4.59 + 4.60 +%description 4.61 + This is a portable client and server for the Trivial File Transfer 4.62 + Protocol (TFTP). 4.63 + 4.64 +%track 4.65 + prog tftp = { 4.66 + version = %{version} 4.67 + url = http://www.kernel.org/pub/software/network/tftp/tftp-hpa/ 4.68 + regex = tftp-hpa-(__VER__)\.tar\.gz 4.69 + } 4.70 + 4.71 +%prep 4.72 + %setup -q -n tftp-hpa-%{version} 4.73 + %patch -p0 4.74 + %{l_shtool} subst -e 's;PKTSIZE;TFTP_PKTSIZE;g' */*.[ch] 4.75 + 4.76 +%build 4.77 + export CC="%{l_cc}" 4.78 + export CFLAGS="%{l_cflags -O} %{l_cppflags} -DPID_FILE='\"%{l_prefix}/var/tftp/tftpd.pid\"'" 4.79 + export CPPFLAGS="%{l_cppflags}" 4.80 + export LDFLAGS="%{l_ldflags} %{l_fsl_ldflags}" 4.81 + export LIBS="%{l_fsl_libs} -lgetopt" 4.82 + case "%{l_platform -t}" in 4.83 + *-netbsd* ) 4.84 + CFLAGS="$CFLAGS -D_NETBSD_SOURCE" 4.85 + CPPFLAGS="$CPPFLAGS -D_NETBSD_SOURCE" 4.86 + ;; 4.87 + esac 4.88 + ./configure \ 4.89 + --prefix=%{l_prefix} \ 4.90 + --mandir=%{l_prefix}/man \ 4.91 + --with-remap \ 4.92 + --without-tcpwrappers \ 4.93 + --without-readline 4.94 + %{l_shtool} subst -e 's; -W[^ ]*;;g' MCONFIG 4.95 + %{l_make} %{l_mflags} 4.96 + 4.97 +%install 4.98 + %{l_shtool} mkdir -f -p -m 755 \ 4.99 + $RPM_BUILD_ROOT%{l_prefix}/var/tftp \ 4.100 + $RPM_BUILD_ROOT%{l_prefix}/etc/tftp \ 4.101 + $RPM_BUILD_ROOT%{l_prefix}/var/tftp 4.102 + %{l_make} %{l_mflags} install \ 4.103 + INSTALL="%{l_shtool} install -c" \ 4.104 + INSTALLROOT=$RPM_BUILD_ROOT 4.105 + %{l_shtool} install -c -m 644 %{l_value -s -a} \ 4.106 + %{SOURCE tftpd.remap} $RPM_BUILD_ROOT%{l_prefix}/etc/tftp/ 4.107 + rm -f $RPM_BUILD_ROOT%{l_prefix}/man/man8/tftpd.8 4.108 + mv $RPM_BUILD_ROOT%{l_prefix}/man/man8/in.tftpd.8 \ 4.109 + $RPM_BUILD_ROOT%{l_prefix}/man/man8/tftpd.8 4.110 + mv $RPM_BUILD_ROOT%{l_prefix}/sbin/in.tftpd \ 4.111 + $RPM_BUILD_ROOT%{l_prefix}/sbin/tftpd 4.112 + strip $RPM_BUILD_ROOT%{l_prefix}/bin/* >/dev/null 2>&1 || true 4.113 + strip $RPM_BUILD_ROOT%{l_prefix}/sbin/* >/dev/null 2>&1 || true 4.114 + 4.115 + # install run-command script 4.116 + %{l_shtool} mkdir -f -p -m 755 \ 4.117 + $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d 4.118 + %{l_shtool} install -c -m 755 %{l_value -s -a} \ 4.119 + %{SOURCE rc.tftp} $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d/ 4.120 + 4.121 + # install OSSP fsl configuration 4.122 + %{l_shtool} mkdir -f -p -m 755 $RPM_BUILD_ROOT%{l_prefix}/etc/fsl 4.123 + %{l_shtool} install -c -m 644 %{l_value -s -a} \ 4.124 + %{SOURCE fsl.tftp} \ 4.125 + $RPM_BUILD_ROOT%{l_prefix}/etc/fsl/ 4.126 + 4.127 + # determine installation files 4.128 + %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT \ 4.129 + %{l_files_std} \ 4.130 + '%config %{l_prefix}/etc/fsl/fsl.tftp' \ 4.131 + '%config %{l_prefix}/etc/tftp/*' 4.132 + 4.133 +%files -f files 4.134 + 4.135 +%clean 4.136 + 4.137 +%pre 4.138 + # before upgrade, save status and stop service 4.139 + [ $1 -eq 2 ] || exit 0 4.140 + eval `%{l_rc} tftp status 2>/dev/null | tee %{l_tmpfile}` 4.141 + %{l_rc} tftp stop 2>/dev/null 4.142 + exit 0 4.143 + 4.144 +%post 4.145 + if [ $1 -eq 2 ]; then 4.146 + # after upgrade, restore status 4.147 + eval `cat %{l_tmpfile}`; rm -f %{l_tmpfile} 4.148 + [ ".$tftp_active" = .yes ] && %{l_rc} tftp start 4.149 + fi 4.150 + exit 0 4.151 + 4.152 +%preun 4.153 + # before erase, stop service and remove log files 4.154 + [ $1 -eq 0 ] || exit 0 4.155 + %{l_rc} tftp stop 2>/dev/null 4.156 + rm -f $RPM_INSTALL_PREFIX/var/tftp/*.log* >/dev/null 2>&1 || true 4.157 + exit 0 4.158 +
5.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 5.2 +++ b/tftp/tftpd.remap Mon Aug 25 19:06:31 2014 +0200 5.3 @@ -0,0 +1,33 @@ 5.4 +# 5.5 +# tftpd.remap -- TFTP Daemon Path Remapping 5.6 +# 5.7 +# This file has three fields: operation, regex, remapping 5.8 +# 5.9 +# The operation is a combination of the following letters: 5.10 +# 5.11 +# r - rewrite the matched string with the remapping pattern 5.12 +# i - case-insensitive matching 5.13 +# g - repeat until no match (used with "r") 5.14 +# e - exit (with success) if we match this pattern, do not process 5.15 +# subsequent rules 5.16 +# s - start over from the first rule if we match this pattern 5.17 +# a - abort (refuse the request) if we match this rule 5.18 +# G - this rule applies to TFTP GET requests only 5.19 +# P - this rule applies to TFTP PUT requests only 5.20 +# 5.21 +# The regex is a regular expression in the style of egrep(1). 5.22 +# 5.23 +# The remapping is a pattern, all characters are verbatim except \ 5.24 +# \0 copies the full string that matched the regex 5.25 +# \1..\9 copies the 9 first (..) expressions in the regex 5.26 +# \\ is an escaped \ 5.27 +# 5.28 +# "#" begins a comment, unless \-escaped 5.29 +# 5.30 +ri ^[a-z]: # Remove drive letters 5.31 +rg \\ / # Convert backslashes to slashes 5.32 +rg \# @ # Convert hash marks to @ signs 5.33 +rg /../ /..no../ # Convert /../ to /..no../ 5.34 +e ^incoming/ # These are always ok 5.35 +r ^[^/] /\0 # Convert nonabsolute files 5.36 +a ^\. # Reject requests for hidden files