#!@l_prefix@/bin/openpkg rc ## ## rc.tftp -- Run-Commands ## %config tftp_enable="$openpkg_rc_def" tftp_listen="127.0.0.1:69" tftp_flags="" tftp_rootdir="@l_prefix@/pub" tftp_log_prolog="true" tftp_log_epilog="true" tftp_log_numfiles="10" tftp_log_minsize="1M" tftp_log_complevel="9" %common tftp_pidfile="@l_prefix@/var/tftp/tftpd.pid" tftp_signal () { [ -f $tftp_pidfile ] && kill -$1 `cat $tftp_pidfile` } %status -u @l_susr@ -o tftp_usable="unknown" tftp_active="no" rcService tftp enable yes && \ tftp_signal 0 && tftp_active="yes" echo "tftp_enable=\"$tftp_enable\"" echo "tftp_usable=\"$tftp_usable\"" echo "tftp_active=\"$tftp_active\"" %start -u @l_susr@ rcService tftp enable yes || exit 0 rcService tftp active yes && exit 0 opts="-l -u @l_nusr@ -m @l_prefix@/etc/tftp/tftpd.remap" if [ ".$tftp_listen" != . ]; then opts="$opts -a $tftp_listen" fi if [ ".$tftp_flags" != . ]; then opts="$opts $tftp_flags" fi @l_prefix@/sbin/tftpd $opts -s $tftp_rootdir %stop -u @l_susr@ rcService tftp enable yes || exit 0 rcService tftp active no && exit 0 tftp_signal TERM rm -f $tftp_pidfile 2>/dev/null || true %restart -u @l_susr@ rcService tftp enable yes || exit 0 rcService tftp active no && exit 0 rc tftp stop sleep 2 rc tftp start %daily -u @l_susr@ rcService tftp enable yes || exit 0 shtool rotate -f \ -n ${tftp_log_numfiles} -s ${tftp_log_minsize} -d \ -z ${tftp_log_complevel} -o @l_susr@ -g @l_mgrp@ -m 644 \ -P "${tftp_log_prolog}" \ -E "${tftp_log_epilog}; rc tftp restart" \ @l_prefix@/var/tftp/tftp.log