dhcpd/rc.dhcpd

Tue, 29 Mar 2011 20:04:34 +0200

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Tue, 29 Mar 2011 20:04:34 +0200
changeset 334
4a34d7a82eab
child 354
4ca17af53013
permissions
-rw-r--r--

Rework package yet again, correcting and introducing new buildconf logic:
Conditionally disable bootstrap stage comparison correctly, correct
english grammar, better find system as(1) and ld(1), indotruce detailed
optimization option messages, more completely guess cpu types, allow
profiled bootstrapping without a preinstalled GCC because many other
compilers have long since implemented 64-bit arithmetic, instruct make
to build sequentially (not in sparallel) when building a profiled
bootstrap as GCC online documents recommend, and generally improve
comment blocks.

The single most important correction in this changeset relates to the
GCC changed optimization policy since at least GCC 4.5, in which -march
is always passed and not always correctly guessed. In the case of this
package, allowing GCC to guess the architecture leads to wild build
errors at various subcomponents (zlib, libgcc, libiberty...) and
bootstrap stages. It seems quite platform specific, and the safest
approach to correcting this seems to be explicitly always specifying the
-march argument when bootstrapping GCC. Because the best choice 'native'
is not available when bootstrapping using a foreign (non GCC) compiler,
a guess is made according to rpmmacros l_platform in that case.

It is questionable as to whether these recent optimization changes
on the part of GCC or this package are compatible with each other,
or if either are complete or correct at all. At least applying these
corrections allows this package to build again in most cases test.

     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         [ -f $dhcpd_pidfile ] && kill -$1 `cat $dhcpd_pidfile`
    22     }
    23     dhcpd_start () {
    24         if [ ! -f $dhcpd_leases ]; then
    25             touch $dhcpd_leases
    26             chmod 644 $dhcpd_leases
    27             chown @l_susr@:@l_mgrp@ $dhcpd_leases
    28         fi
    29         local cmd="@l_prefix@/sbin/dhcpd"
    30         cmd="$cmd $dhcpd_flags"
    31         echo ".$dhcpd_flags" | grep -- -p >/dev/null 2>&1
    32         if [ $? -ne 0 -a ".$dhcpd_port" != . ]; then
    33             cmd="$cmd -p $dhcpd_port"
    34         fi
    35         if [ $# -gt 0 ]; then
    36             cmd="$cmd $@"
    37         fi
    38         cmd="$cmd >/dev/null 2>&1"
    39         eval $cmd
    40     }
    42 %status -u @l_susr@ -o
    43     dhcpd_usable="unknown"
    44     dhcpd_active="no"
    45     dhcpd_start -q -t || dhcpd_usable="no"
    46     [ ".$dhcpd_if" = . ] && dhcpd_usable="no"
    47     rcService dhcpd enable yes && \
    48         dhcpd_signal 0 && dhcpd_active="yes"
    49     echo "dhcpd_enable=\"$dhcpd_enable\""
    50     echo "dhcpd_usable=\"$dhcpd_usable\""
    51     echo "dhcpd_active=\"$dhcpd_active\""
    53 %start -u @l_susr@
    54     rcService dhcpd enable yes || exit 0
    55     rcService dhcpd usable no  && exit 0
    56     rcService dhcpd active yes && exit 0
    57     dhcpd_start $dhcpd_if
    59 %stop -u @l_susr@
    60     rcService dhcpd enable yes || exit 0
    61     rcService dhcpd active no  && exit 0
    62     dhcpd_signal TERM
    63     sleep 2
    64     rm -f $dhcpd_pidfile 2>/dev/null || true
    66 %restart -u @l_susr@
    67     rcService dhcpd enable yes || exit 0
    68     rcService dhcpd active no  && exit 0
    69     rc dhcpd stop start
    71 %reload -u @l_susr@
    72     rcService dhcpd enable yes || exit 0
    73     dhcpd_signal HUP
    75 %daily -u @l_susr@
    76     rcService dhcpd enable yes || exit 0
    77     rcTmp -i
    78     hintfile=`rcTmp -f -n hint`
    79     for tool in dhcpd dhclient dhrelay omshell; do
    80         shtool rotate -f \
    81             -n $dhcpd_log_numfiles -s $dhcpd_log_minsize -d \
    82             -z $dhcpd_log_complevel -m 644 -o @l_susr@ -g @l_mgrp@ \
    83             -P "$dhcpd_log_prolog" \
    84             -E "$dhcpd_log_epilog; echo 1 >$hintfile" \
    85             @l_prefix@/var/dhcpd/log/$tool.log
    86     done
    87     if [ -s $hintfile ]; then
    88         rc dhcpd restart
    89     fi
    90     rcTmp -k

mercurial