#!@l_prefix@/lib/openpkg/bash @l_prefix@/etc/rc
##
##  rc.tftp-hpa -- Run-Commands for TFTP Daemon
##

%config
    tftp_enable="yes"
    tftp_listen=""
    tftp_flags=""
    tftp_rootdir="@l_prefix@/pub"

%start -p 100 -u root
    if opServiceEnabled tftp; then
        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_root $tftp_root
    fi

%stop -p 200 -u root
    if opServiceEnabled tftp; then
        @l_prefix@/sbin/rndc stop
    fi

