#!@l_prefix@/bin/openpkg rc
##
##  rc.bird -- Run-Commands
##

%config
    bird_enable="$openpkg_rc_def"
    bird_flags=""
    bird_log_prolog="true"
    bird_log_epilog="true"
    bird_log_numfiles="10"
    bird_log_minsize="1M"
    bird_log_complevel="9"

%status -u @l_susr@ -o
    bird_usable="no"
    bird_active="no"
    echo "bird_enable=\"$bird_enable\""
    echo "bird_usable=\"$bird_usable\""
    echo "bird_active=\"$bird_active\""

%start -p 100 -u @l_susr@
    rcService bird enable yes || exit 0
    rcService bird active yes && exit 0
    @l_prefix@/sbin/bird

%stop -p 900 -u @l_susr@
    rcService bird enable yes || exit 0
    rcService bird active no  && exit 0
    @l_prefix@/sbin/birdc down

%restart -p 100 -u @l_susr@
    rcService bird enable yes || exit 0
    rcService bird active no  && exit 0
    rc bird stop start

%reload -p 100 -u @l_susr@
    rcService bird enable yes || exit 0
    rcService bird active no  && exit 0
    @l_prefix@/sbin/birdc restart all

%daily -u @l_susr@
    rcService bird enable yes || exit 0
    shtool rotate -f \
        -n ${bird_log_numfiles} -s ${bird_log_minsize} -d \
        -z ${bird_log_complevel} -m 644 -o @l_rusr@ -g @l_rgrp@ \
        -P "${bird_log_prolog}" \
        -E "${bird_log_epilog} && rc bird reload" \
        @l_prefix@/var/bird/named.log

