Mon, 25 Aug 2014 19:06:31 +0200
Import package vendor original specs for necessary manipulations.
1 #!@l_prefix@/bin/openpkg rc
2 ##
3 ## rc.tftp -- Run-Commands
4 ##
6 %config
7 tftp_enable="$openpkg_rc_def"
8 tftp_listen="127.0.0.1:69"
9 tftp_flags=""
10 tftp_rootdir="@l_prefix@/pub"
11 tftp_log_prolog="true"
12 tftp_log_epilog="true"
13 tftp_log_numfiles="10"
14 tftp_log_minsize="1M"
15 tftp_log_complevel="9"
17 %common
18 tftp_pidfile="@l_prefix@/var/tftp/tftpd.pid"
19 tftp_signal () {
20 [ -f $tftp_pidfile ] && kill -$1 `cat $tftp_pidfile`
21 }
23 %status -u @l_susr@ -o
24 tftp_usable="unknown"
25 tftp_active="no"
26 rcService tftp enable yes && \
27 tftp_signal 0 && tftp_active="yes"
28 echo "tftp_enable=\"$tftp_enable\""
29 echo "tftp_usable=\"$tftp_usable\""
30 echo "tftp_active=\"$tftp_active\""
32 %start -u @l_susr@
33 rcService tftp enable yes || exit 0
34 rcService tftp active yes && exit 0
35 opts="-l -u @l_nusr@ -m @l_prefix@/etc/tftp/tftpd.remap"
36 if [ ".$tftp_listen" != . ]; then
37 opts="$opts -a $tftp_listen"
38 fi
39 if [ ".$tftp_flags" != . ]; then
40 opts="$opts $tftp_flags"
41 fi
42 @l_prefix@/sbin/tftpd $opts -s $tftp_rootdir
44 %stop -u @l_susr@
45 rcService tftp enable yes || exit 0
46 rcService tftp active no && exit 0
47 tftp_signal TERM
48 rm -f $tftp_pidfile 2>/dev/null || true
50 %restart -u @l_susr@
51 rcService tftp enable yes || exit 0
52 rcService tftp active no && exit 0
53 rc tftp stop
54 sleep 2
55 rc tftp start
57 %daily -u @l_susr@
58 rcService tftp enable yes || exit 0
59 shtool rotate -f \
60 -n ${tftp_log_numfiles} -s ${tftp_log_minsize} -d \
61 -z ${tftp_log_complevel} -o @l_susr@ -g @l_mgrp@ -m 644 \
62 -P "${tftp_log_prolog}" \
63 -E "${tftp_log_epilog}; rc tftp restart" \
64 @l_prefix@/var/tftp/tftp.log