dhcpd/rc.dhcpd

Sat, 24 Mar 2012 21:40:49 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Sat, 24 Mar 2012 21:40:49 +0100
changeset 414
fd611cde817f
parent 13
cb59d6afeb61
permissions
-rw-r--r--

Introduce many changes to the buildconf and source code including:
(01) clean up, update, and partially update default config files,
(02) seems that Melware is unable to perform release engineering so
update chan_capi to new daily snapshot to solve echo problems,
(03) correct Asterisk inadequate hard coded gmime version check,
(04) force postgresql pthreads linkage to solve build problem,
(05) remove buggy hard coded LibXML configure definitions,
(06) remove local architecture specification to allow GCC
internal logic to determine proper CPU type instead,
(07) remove vendor sound install target causing uncontrolled
downloads and non RPM managed file installation,
(08) solve long outstanding bug in tcptls causing Asterisk
to ignore any intermediate CA certificate signatures,
(09) back out Digium engineering team's bright idea of replacing the
very portable and pervasive POSIX rand(1) with ast_random(), and
then not even implementing it causing all references to fail in
platforms not providing the very new POSIX.1-2008 mkdtemp(3)
function only distributed by BSD and some Linux,
(10) withdraw advanced linker symbol manipulations from SVR5 builds
until either Binutils supports hybrid versioned and anonymous
linker scripts or GCC stops hard coding versioned linker scripts,
(11) correct missing library linkage, some tailored to a specific OS,
(12) remove outdated logic for the no longer distributed gmime-config(1),
(13) remove local gmime buildconf hacks now that Asterisk has corrected
their own build configuration to almost portably support gmime,
(14) solve build problems relating to undetected LibXML paths,
(15) correct erroneous out of tree include definitions,
(16) improve some variable and comment naming,
(17) simplify sound language path hierarchy creation,
and correct australian english installation logic.

     1 #!@l_prefix@/bin/openpkg rc
     2 ##
     3 ##  rc.dhcpd -- Run-Commands
     4 ##
     6 %config
     7     dhcpd_enable="$openpkg_rc_def"
     8     dhcpd_flags="-q"
     9     dhcpd_if=""
    10     dhcpd_port="67"
    11     dhcpd_log_prolog="true"
    12     dhcpd_log_epilog="true"
    13     dhcpd_log_numfiles="10"
    14     dhcpd_log_minsize="1M"
    15     dhcpd_log_complevel="9"
    17 %common
    18     dhcpd_pidfile="@l_prefix@/var/dhcpd/run/dhcpd.pid"
    19     dhcpd_leases="@l_prefix@/var/dhcpd/db/dhcpd.leases"
    20     dhcpd_signal () {
    21         if [ ! -f $dhcpd_pidfile ]; then return 1; fi
    22         kill -$1 `cat $dhcpd_pidfile`
    23     }
    24     dhcpd_start () {
    25         if [ ! -f $dhcpd_leases ]; then
    26             touch $dhcpd_leases
    27             chmod 644 $dhcpd_leases
    28             chown @l_susr@:@l_mgrp@ $dhcpd_leases
    29         fi
    30         local cmd="@l_prefix@/sbin/dhcpd"
    31         cmd="$cmd -f"
    32         cmd="$cmd $dhcpd_flags"
    33         echo ".$dhcpd_flags" | grep -- -p >/dev/null 2>&1
    34         if [ $? -ne 0 -a ".$dhcpd_port" != . ]; then
    35             cmd="$cmd -p $dhcpd_port"
    36         fi
    37         if [ $# -gt 0 ]; then
    38             cmd="$cmd $@"
    39         fi
    40         ( eval "nohup $cmd </dev/null >/dev/null 2>&1 &"
    41           echo $! >$dhcpd_pidfile
    42         ) >/dev/null 2>&1
    43     }
    45 %status -u @l_susr@ -o
    46     dhcpd_usable="unknown"
    47     dhcpd_active="no"
    48     @l_prefix@/sbin/dhcpd -q -t || dhcpd_usable="no"
    49     [ ".$dhcpd_if" = . ] && dhcpd_usable="no"
    50     rcService dhcpd enable yes && \
    51         dhcpd_signal 0 && dhcpd_active="yes"
    52     echo "dhcpd_enable=\"$dhcpd_enable\""
    53     echo "dhcpd_usable=\"$dhcpd_usable\""
    54     echo "dhcpd_active=\"$dhcpd_active\""
    56 %start -u @l_susr@
    57     rcService dhcpd enable yes || exit 0
    58     rcService dhcpd usable no  && exit 0
    59     rcService dhcpd active yes && exit 0
    60     dhcpd_start $dhcpd_if
    62 %stop -u @l_susr@
    63     rcService dhcpd enable yes || exit 0
    64     rcService dhcpd active no  && exit 0
    65     dhcpd_signal TERM
    66     sleep 2
    67     rm -f $dhcpd_pidfile 2>/dev/null || true
    69 %restart -u @l_susr@
    70     rcService dhcpd enable yes || exit 0
    71     rcService dhcpd active no  && exit 0
    72     rc dhcpd stop start
    74 %reload -u @l_susr@
    75     rcService dhcpd enable yes || exit 0
    76     dhcpd_signal HUP
    78 %daily -u @l_susr@
    79     rcService dhcpd enable yes || exit 0
    80     rcTmp -i
    81     hintfile=`rcTmp -f -n hint`
    82     for tool in dhcpd dhclient dhrelay omshell; do
    83         shtool rotate -f \
    84             -n $dhcpd_log_numfiles -s $dhcpd_log_minsize -d \
    85             -z $dhcpd_log_complevel -m 644 -o @l_susr@ -g @l_mgrp@ \
    86             -P "$dhcpd_log_prolog" \
    87             -E "$dhcpd_log_epilog; echo 1 >$hintfile" \
    88             @l_prefix@/var/dhcpd/log/$tool.log
    89     done
    90     if [ -s $hintfile ]; then
    91         rc dhcpd restart
    92     fi
    93     rcTmp -k

mercurial