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