Fri, 03 Aug 2012 20:11:53 +0200
Neutralize buggy code causing OpenPKG to have 'fatal problems' in
spite of correct installation, configuration, and operation. An
administrator suffering from this failure is even unable to
uninstall the flawed software.
michael@52 | 1 | #!@l_prefix@/bin/openpkg rc |
michael@52 | 2 | ## |
michael@52 | 3 | ## rc.stun -- Run-Commands |
michael@52 | 4 | ## |
michael@52 | 5 | |
michael@52 | 6 | %config |
michael@52 | 7 | stun_enable="$openpkg_rc_def" |
michael@52 | 8 | stun_bind_addr1="127.0.0.1" |
michael@52 | 9 | stun_bind_addr2="127.0.0.2" |
michael@52 | 10 | stun_bind_port1="3478" |
michael@52 | 11 | stun_bind_port2="3479" |
michael@52 | 12 | |
michael@52 | 13 | %common |
michael@52 | 14 | stun_pidfile="@l_prefix@/var/stun/stun.pid" |
michael@52 | 15 | stun_signal () { |
michael@52 | 16 | [ -f $stun_pidfile ] && kill -$1 `cat $stun_pidfile` |
michael@52 | 17 | } |
michael@52 | 18 | |
michael@52 | 19 | %status -u @l_susr@ -o |
michael@52 | 20 | stun_usable="unknown" |
michael@52 | 21 | stun_active="no" |
michael@52 | 22 | rcService stun enable yes && \ |
michael@52 | 23 | stun_signal 0 && stun_active="yes" |
michael@52 | 24 | echo "stun_enable=\"$stun_enable\"" |
michael@52 | 25 | echo "stun_usable=\"$stun_usable\"" |
michael@52 | 26 | echo "stun_active=\"$stun_active\"" |
michael@52 | 27 | |
michael@52 | 28 | %start -u @l_susr@ |
michael@52 | 29 | rcService stun enable yes || exit 0 |
michael@52 | 30 | rcService stun active yes && exit 0 |
michael@52 | 31 | @l_prefix@/sbin/stund -b \ |
michael@52 | 32 | -h "${stun_bind_addr1}" \ |
michael@52 | 33 | -a "${stun_bind_addr2}" \ |
michael@52 | 34 | -p "${stun_bind_port1}" \ |
michael@52 | 35 | -o "${stun_bind_port2}" \ |
michael@52 | 36 | -P "${stun_pidfile}" |
michael@52 | 37 | |
michael@52 | 38 | %stop -u @l_susr@ |
michael@52 | 39 | rcService stun enable yes || exit 0 |
michael@52 | 40 | rcService stun active no && exit 0 |
michael@52 | 41 | stun_signal TERM |
michael@52 | 42 | sleep 2 |
michael@52 | 43 | rm -f $stun_pidfile >/dev/null 2>&1 || true |
michael@52 | 44 | |
michael@52 | 45 | %restart -u @l_susr@ |
michael@52 | 46 | rcService stun enable yes || exit 0 |
michael@52 | 47 | rcService stun active no && exit 0 |
michael@52 | 48 | rc stun stop start |
michael@52 | 49 |