1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/tftp/rc.tftp Mon Aug 25 19:06:31 2014 +0200 1.3 @@ -0,0 +1,65 @@ 1.4 +#!@l_prefix@/bin/openpkg rc 1.5 +## 1.6 +## rc.tftp -- Run-Commands 1.7 +## 1.8 + 1.9 +%config 1.10 + tftp_enable="$openpkg_rc_def" 1.11 + tftp_listen="127.0.0.1:69" 1.12 + tftp_flags="" 1.13 + tftp_rootdir="@l_prefix@/pub" 1.14 + tftp_log_prolog="true" 1.15 + tftp_log_epilog="true" 1.16 + tftp_log_numfiles="10" 1.17 + tftp_log_minsize="1M" 1.18 + tftp_log_complevel="9" 1.19 + 1.20 +%common 1.21 + tftp_pidfile="@l_prefix@/var/tftp/tftpd.pid" 1.22 + tftp_signal () { 1.23 + [ -f $tftp_pidfile ] && kill -$1 `cat $tftp_pidfile` 1.24 + } 1.25 + 1.26 +%status -u @l_susr@ -o 1.27 + tftp_usable="unknown" 1.28 + tftp_active="no" 1.29 + rcService tftp enable yes && \ 1.30 + tftp_signal 0 && tftp_active="yes" 1.31 + echo "tftp_enable=\"$tftp_enable\"" 1.32 + echo "tftp_usable=\"$tftp_usable\"" 1.33 + echo "tftp_active=\"$tftp_active\"" 1.34 + 1.35 +%start -u @l_susr@ 1.36 + rcService tftp enable yes || exit 0 1.37 + rcService tftp active yes && exit 0 1.38 + opts="-l -u @l_nusr@ -m @l_prefix@/etc/tftp/tftpd.remap" 1.39 + if [ ".$tftp_listen" != . ]; then 1.40 + opts="$opts -a $tftp_listen" 1.41 + fi 1.42 + if [ ".$tftp_flags" != . ]; then 1.43 + opts="$opts $tftp_flags" 1.44 + fi 1.45 + @l_prefix@/sbin/tftpd $opts -s $tftp_rootdir 1.46 + 1.47 +%stop -u @l_susr@ 1.48 + rcService tftp enable yes || exit 0 1.49 + rcService tftp active no && exit 0 1.50 + tftp_signal TERM 1.51 + rm -f $tftp_pidfile 2>/dev/null || true 1.52 + 1.53 +%restart -u @l_susr@ 1.54 + rcService tftp enable yes || exit 0 1.55 + rcService tftp active no && exit 0 1.56 + rc tftp stop 1.57 + sleep 2 1.58 + rc tftp start 1.59 + 1.60 +%daily -u @l_susr@ 1.61 + rcService tftp enable yes || exit 0 1.62 + shtool rotate -f \ 1.63 + -n ${tftp_log_numfiles} -s ${tftp_log_minsize} -d \ 1.64 + -z ${tftp_log_complevel} -o @l_susr@ -g @l_mgrp@ -m 644 \ 1.65 + -P "${tftp_log_prolog}" \ 1.66 + -E "${tftp_log_epilog}; rc tftp restart" \ 1.67 + @l_prefix@/var/tftp/tftp.log 1.68 +