Mon, 17 Sep 2012 19:10:10 +0200
Update to new version of vendor software although Oracle fails to deliver.
More specifically, newer db(3) patch revisions exist but Oracle has
removed them from the canonical download server URI for Berkely DB.
michael@666 | 1 | #!@l_prefix@/bin/openpkg rc |
michael@666 | 2 | ## |
michael@666 | 3 | ## rc.openvpn -- Run-Commands |
michael@666 | 4 | ## |
michael@666 | 5 | |
michael@666 | 6 | %config |
michael@666 | 7 | openvpn_enable="$openpkg_rc_def" |
michael@666 | 8 | openvpn_log_prolog="true" |
michael@666 | 9 | openvpn_log_epilog="true" |
michael@666 | 10 | openvpn_log_numfiles="10" |
michael@666 | 11 | openvpn_log_minsize="1M" |
michael@666 | 12 | openvpn_log_complevel="9" |
michael@666 | 13 | |
michael@666 | 14 | %common |
michael@666 | 15 | openvpn_etcdir="@l_prefix@/etc/openvpn" |
michael@666 | 16 | openvpn_vardir="@l_prefix@/var/openvpn" |
michael@666 | 17 | openvpn_signal () { |
michael@666 | 18 | [ -f $openvpn_vardir/$1.pid ] && kill -$2 `cat $openvpn_vardir/$1.pid` |
michael@666 | 19 | } |
michael@666 | 20 | |
michael@666 | 21 | %status -u @l_susr@ -o |
michael@666 | 22 | openvpn_usable="unknown" |
michael@666 | 23 | openvpn_active="yes" |
michael@666 | 24 | if rcService openvpn enable yes; then |
michael@666 | 25 | for cfgfile in $openvpn_etcdir/*.conf; do |
michael@666 | 26 | [ ".`grep '^disable' $cfgfile`" != . ] && continue |
michael@666 | 27 | name=`echo "$cfgfile" | sed -e 's;^.*/\([^/]*\)\.conf;\1;'` |
michael@666 | 28 | openvpn_signal $name 0 |
michael@666 | 29 | if [ $? -ne 0 ]; then |
michael@666 | 30 | openvpn_active="no" |
michael@666 | 31 | break |
michael@666 | 32 | fi |
michael@666 | 33 | done |
michael@666 | 34 | fi |
michael@666 | 35 | echo "openvpn_enable=\"$openvpn_enable\"" |
michael@666 | 36 | echo "openvpn_usable=\"$openvpn_usable\"" |
michael@666 | 37 | echo "openvpn_active=\"$openvpn_active\"" |
michael@666 | 38 | |
michael@666 | 39 | %start -p 200 -u @l_susr@ |
michael@666 | 40 | rcService openvpn enable yes || exit 0 |
michael@666 | 41 | rcService openvpn active yes && exit 0 |
michael@666 | 42 | if [ -f $openvpn_etcdir/openvpn.sh ]; then |
michael@666 | 43 | sh $openvpn_etcdir/openvpn.sh start || exit $? |
michael@666 | 44 | fi |
michael@666 | 45 | for cfgfile in $openvpn_etcdir/*.conf; do |
michael@666 | 46 | [ ".`grep '^disable' $cfgfile`" != . ] && continue |
michael@666 | 47 | name=`echo "$cfgfile" | sed -e 's;^.*/\([^/]*\)\.conf;\1;'` |
michael@666 | 48 | if [ -f $openvpn_etcdir/$name.sh -a ".$name" != .openvpn ]; then |
michael@666 | 49 | sh $openvpn_etcdir/$name.sh start || exit $? |
michael@666 | 50 | fi |
michael@666 | 51 | @l_prefix@/sbin/openvpn \ |
michael@666 | 52 | --daemon "$name" \ |
michael@666 | 53 | --log-append $openvpn_vardir/$name.log \ |
michael@666 | 54 | --writepid $openvpn_vardir/$name.pid \ |
michael@666 | 55 | --status $openvpn_vardir/$name.status 60 \ |
michael@666 | 56 | --config $cfgfile \ |
michael@666 | 57 | --cd $openvpn_etcdir || exit $? |
michael@666 | 58 | done |
michael@666 | 59 | |
michael@666 | 60 | %stop -p 800 -u @l_susr@ |
michael@666 | 61 | rcService openvpn enable yes || exit 0 |
michael@666 | 62 | rcService openvpn active no && exit 0 |
michael@666 | 63 | for cfgfile in $openvpn_etcdir/*.conf; do |
michael@666 | 64 | [ ".`grep '^disable' $cfgfile`" != . ] && continue |
michael@666 | 65 | name=`echo "$cfgfile" | sed -e 's;^.*/\([^/]*\)\.conf;\1;'` |
michael@666 | 66 | openvpn_signal $name TERM |
michael@666 | 67 | done |
michael@666 | 68 | sleep 1 |
michael@666 | 69 | for cfgfile in $openvpn_etcdir/*.conf; do |
michael@666 | 70 | [ ".`grep '^disable' $cfgfile`" != . ] && continue |
michael@666 | 71 | name=`echo "$cfgfile" | sed -e 's;^.*/\([^/]*\)\.conf;\1;'` |
michael@666 | 72 | if [ -f $openvpn_etcdir/$name.sh -a ".$name" != .openvpn ]; then |
michael@666 | 73 | sh $openvpn_etcdir/$name.sh stop || true |
michael@666 | 74 | fi |
michael@666 | 75 | done |
michael@666 | 76 | if [ -f $openvpn_etcdir/openvpn.sh ]; then |
michael@666 | 77 | sh $openvpn_etcdir/openvpn.sh stop || true |
michael@666 | 78 | fi |
michael@666 | 79 | rm -f $openvpn_vardir/*.pid 2>/dev/null || true |
michael@666 | 80 | |
michael@666 | 81 | %restart -u @l_susr@ |
michael@666 | 82 | rcService openvpn enable yes || exit 0 |
michael@666 | 83 | rcService openvpn active no && exit 0 |
michael@666 | 84 | rc openvpn stop start |
michael@666 | 85 | |
michael@666 | 86 | %reload -u @l_susr@ |
michael@666 | 87 | rcService openvpn enable yes || exit 0 |
michael@666 | 88 | rcService openvpn active no && exit 0 |
michael@666 | 89 | for cfgfile in $openvpn_etcdir/*.conf; do |
michael@666 | 90 | [ ".`grep '^disable' $cfgfile`" != . ] && continue |
michael@666 | 91 | name=`echo "$cfgfile" | sed -e 's;^.*/\([^/]*\)\.conf;\1;'` |
michael@666 | 92 | openvpn_signal $name USR1 |
michael@666 | 93 | if [ -f $openvpn_etcdir/$name.sh ]; then |
michael@666 | 94 | sh $openvpn_etcdir/$name.sh reload || true |
michael@666 | 95 | fi |
michael@666 | 96 | done |
michael@666 | 97 | |
michael@666 | 98 | %daily -u @l_susr@ |
michael@666 | 99 | rcService openvpn enable yes || exit 0 |
michael@666 | 100 | for cfgfile in $openvpn_etcdir/*.conf; do |
michael@666 | 101 | [ ".`grep '^disable' $cfgfile`" != . ] && continue |
michael@666 | 102 | name=`echo "$cfgfile" | sed -e 's;^.*/\([^/]*\)\.conf;\1;'` |
michael@666 | 103 | shtool rotate -f \ |
michael@666 | 104 | -n ${openvpn_log_numfiles} -s ${openvpn_log_minsize} -d \ |
michael@666 | 105 | -z ${openvpn_log_complevel} -o @l_rusr@ -g @l_rgrp@ -m 644 \ |
michael@666 | 106 | -P "${openvpn_log_prolog}" \ |
michael@666 | 107 | -E "${openvpn_log_epilog}; rc openvpn reload" \ |
michael@666 | 108 | $openvpn_vardir/$name.log |
michael@666 | 109 | done |
michael@666 | 110 |