Mon, 28 Jan 2013 17:37:18 +0100
Correct socket error reporting improvement with IPv6 portable code,
after helpful recommendation by Saúl Ibarra Corretgé on OSips devlist.
michael@714 | 1 | #!@l_prefix@/bin/openpkg rc |
michael@714 | 2 | ## |
michael@714 | 3 | ## rc.arpd -- Run-Commands |
michael@714 | 4 | ## |
michael@714 | 5 | |
michael@714 | 6 | %config |
michael@714 | 7 | arpd_enable="$openpkg_rc_def" |
michael@714 | 8 | arpd_log_prolog="true" |
michael@714 | 9 | arpd_log_epilog="true" |
michael@714 | 10 | arpd_log_numfiles="10" |
michael@714 | 11 | arpd_log_minsize="1M" |
michael@714 | 12 | arpd_log_complevel="9" |
michael@714 | 13 | arpd_ip_network="192.168.100.0/24" |
michael@714 | 14 | arpd_if="" |
michael@714 | 15 | |
michael@714 | 16 | %common |
michael@714 | 17 | arpd_pidfile="@l_prefix@/var/arpd/arpd.pid" |
michael@714 | 18 | arpd_signal () { |
michael@714 | 19 | [ -f $arpd_pidfile ] && kill -$1 `cat $arpd_pidfile` |
michael@714 | 20 | } |
michael@714 | 21 | |
michael@714 | 22 | %status -u @l_susr@ -o |
michael@714 | 23 | arpd_usable="unknown" |
michael@714 | 24 | arpd_active="no" |
michael@714 | 25 | rcService arpd enable yes && \ |
michael@714 | 26 | arpd_signal 0 && arpd_active="yes" |
michael@714 | 27 | echo "arpd_enable=\"$arpd_enable\"" |
michael@714 | 28 | echo "arpd_usable=\"$arpd_usable\"" |
michael@714 | 29 | echo "arpd_active=\"$arpd_active\"" |
michael@714 | 30 | |
michael@714 | 31 | %start -u @l_susr@ |
michael@714 | 32 | rcService arpd enable yes || exit 0 |
michael@714 | 33 | rcService arpd active yes && exit 0 |
michael@714 | 34 | if [ ".$arpd_if" != . ]; then |
michael@714 | 35 | arpd_interface="-i $arpd_if" |
michael@714 | 36 | fi |
michael@714 | 37 | @l_prefix@/sbin/arpd \ |
michael@714 | 38 | $arpd_interface \ |
michael@714 | 39 | $arpd_ip_network \ |
michael@714 | 40 | >/dev/null 2>&1 |
michael@714 | 41 | |
michael@714 | 42 | %stop -u @l_susr@ |
michael@714 | 43 | rcService arpd enable yes || exit 0 |
michael@714 | 44 | rcService arpd active no && exit 0 |
michael@714 | 45 | arpd_signal TERM |
michael@715 | 46 | rcService arpd active no && exit 0 |
michael@715 | 47 | arpd_signal TERM |
michael@715 | 48 | rcService arpd active no && exit 0 |
michael@715 | 49 | rm -f $arpd_pidfile |
michael@714 | 50 | |
michael@714 | 51 | %restart -u @l_susr@ |
michael@714 | 52 | rcService arpd enable yes || exit 0 |
michael@714 | 53 | rcService arpd active no && exit 0 |
michael@714 | 54 | rc arpd start |
michael@714 | 55 | sleep 2 |
michael@714 | 56 | rc arpd stop |
michael@714 | 57 | |
michael@714 | 58 | %reload -u @l_susr@ |
michael@714 | 59 | rcService arpd enable yes || exit 0 |
michael@714 | 60 | rcService arpd active no && exit 0 |
michael@714 | 61 | arpd_signal HUP |
michael@714 | 62 | |
michael@714 | 63 | %daily -u @l_susr@ |
michael@714 | 64 | rcService arpd enable yes || exit 0 |
michael@714 | 65 | shtool rotate -f \ |
michael@714 | 66 | -n ${arpd_log_numfiles} -s ${arpd_log_minsize} -d \ |
michael@714 | 67 | -z ${arpd_log_complevel} -o @l_susr@ -g @l_rgrp@ -m 644 \ |
michael@714 | 68 | -P "${arpd_log_prolog}" \ |
michael@714 | 69 | -E "${arpd_log_epilog}; rc arpd restart" \ |
michael@714 | 70 | @l_prefix@/var/arpd/arpd.log |
michael@714 | 71 |