openpkg/rc.openpkg

Thu, 04 Oct 2012 20:30:05 +0200

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 04 Oct 2012 20:30:05 +0200
changeset 715
c10fb90893b9
parent 427
71503088f51b
permissions
-rw-r--r--

Correct out of date build configuration, porting to Solaris 11 network
link infrastructure and new libpcap logic. This additionally allows for
device drivers in subdirectories of /dev. Correct packaged nmap
personalities and signatures to work out of the box. Finally, hack
arpd logic to properly close sockets and quit on TERM by repeating
signaling in the run command script. Sadly, all this fails to correct
the run time behaviour of honeyd which fails to bind to the IP layer.

     1 #!@l_prefix@/bin/openpkg rc
     2 ##
     3 ##  rc.openpkg -- Run-Commands
     4 ##  Copyright (c) 2000-2012 OpenPKG GmbH <http://openpkg.com/>
     5 ##
     6 ##  This software is property of the OpenPKG GmbH, DE MUC HRB 160208.
     7 ##  All rights reserved. Licenses which grant limited permission to use,
     8 ##  copy, modify and distribute this software are available from the
     9 ##  OpenPKG GmbH.
    10 ##
    11 ##  THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED
    12 ##  WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
    13 ##  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
    14 ##  IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR
    15 ##  CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
    16 ##  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
    17 ##  LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
    18 ##  USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
    19 ##  ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
    20 ##  OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
    21 ##  OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
    22 ##  SUCH DAMAGE.
    23 ##
    25 %config
    26     openpkg_rc_def="yes"
    27     openpkg_rc_all="$openpkg_rc_def"
    28     openpkg_enable="$openpkg_rc_def"
    29     openpkg_envprio="high"
    30     openpkg_reghour="3"
    31     openpkg_regrand="1"
    33 %status -o
    34     openpkg_usable="unknown"
    35     openpkg_active="unknown"
    36     echo "openpkg_enable=\"$openpkg_enable\""
    37     echo "openpkg_usable=\"$openpkg_usable\""
    38     echo "openpkg_active=\"$openpkg_active\""
    40 %info -o
    41     @l_prefix@/bin/openpkg uuid info
    43 %start -p0
    44     rcService openpkg enable yes || exit 0
    46     #   update UUID information (in background to not slow down boot sequences)
    47     (nohup @l_prefix@/bin/openpkg uuid update </dev/null >/dev/null 2>&1 &) >/dev/null 2>&1
    49 %hourly -u @l_musr@
    50     rcService openpkg enable yes || exit 0
    52     #   automatic (re-)registration
    53     reregister=0
    55     #   re-register if previously registered
    56     @l_prefix@/bin/openpkg register --printstatus >/dev/null 2>&1 && reregister=1
    58     #   re-register if "openpkg release" configured to pull packages directly from openpkg.(org|com|net)
    59     [ $reregister -eq 0 ] && @l_prefix@/bin/openpkg release --fmt='%u' \
    60     | egrep '^[^:]*://(([^:]*:)?([^@]*@)?)?([^/]*\.)?openpkg\.(com|org|net)/' >/dev/null && reregister=1
    62     #   perform (re-)registration
    63     if [ $reregister -eq 1 ]; then
    64         [ $openpkg_reghour -lt 00 -o $openpkg_reghour -gt 23 ] && openpkg_reghour="3"
    65         now=`date '+%H'`
    66         [ $openpkg_reghour -eq $now ] || exit 0
    67         [ $openpkg_regrand -lt 01 -o $openpkg_regrand -gt 04 ] && openpkg_regrand="1"
    68         rnd=`expr $RANDOM \* 3600 \* $openpkg_regrand / 32768`
    69         (nohup @l_prefix@/lib/openpkg/bash -c "sleep $rnd; @l_prefix@/bin/openpkg register" </dev/null >/dev/null 2>&1 &) >/dev/null 2>&1
    70     fi
    72 %daily -p0
    73     rcService openpkg enable yes || exit 0
    75     #   update UUID information
    76     @l_prefix@/bin/openpkg uuid update >/dev/null 2>&1 || true
    78 %env -p0
    79     rcService openpkg enable yes || exit 0
    81     #   determine append (low prio) or prepend (high prio) mode
    82     opt_prepend=""
    83     if [ ".$openpkg_envprio" = ".high" ]; then
    84         opt_prepend="-p"
    85     fi
    87     #   make sure the software package executables are found
    88     export PATH
    89     rcPath -a -e PATH \
    90         /bin /sbin /usr/bin /usr/sbin
    91     rcPath -a ${opt_prepend} PATH \
    92         @l_prefix@/bin @l_prefix@/sbin \
    93         @l_prefix@/local/bin @l_prefix@/local/sbin
    95     #   make sure the software package manual pages are found
    96     export MANPATH
    97     rcPath -a -e MANPATH \
    98         /usr/man /usr/share/man
    99     rcPath -a ${opt_prepend} MANPATH \
   100         @l_prefix@/man @l_prefix@/local/man
   102     #   make sure the software package info pages are found
   103     export INFOPATH
   104     rcPath -a -e INFOPATH \
   105         /usr/info /usr/share/info
   106     rcPath -a ${opt_prepend} INFOPATH \
   107         @l_prefix@/info @l_prefix@/local/info
   109     #   make sure the software package libraries are found
   110     export LD_LIBRARY_PATH
   111     rcPath -a -e LD_LIBRARY_PATH \
   112         /lib /usr/lib
   113     rcPath -a ${opt_prepend} LD_LIBRARY_PATH \
   114         @l_prefix@/lib @l_prefix@/local/lib
   116     #   cleanup
   117     unset opt_prepend

mercurial