snmp/rc.snmp

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 588
300d43423c2e
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.

michael@325 1 #!@l_prefix@/bin/openpkg rc
michael@325 2 ##
michael@325 3 ## rc.snmp -- Run-Commands
michael@325 4 ##
michael@325 5
michael@325 6 %config
michael@325 7 snmp_enable="$openpkg_rc_def"
michael@325 8 snmp_daemons="snmpd snmptrapd"
michael@325 9 snmp_listen="127.0.0.1"
michael@325 10 snmp_listentrap="127.0.0.1"
michael@325 11 snmp_log_prolog="true"
michael@325 12 snmp_log_epilog="true"
michael@325 13 snmp_log_numfiles="10"
michael@325 14 snmp_log_minsize="1M"
michael@325 15 snmp_log_complevel="9"
michael@325 16
michael@325 17 %common
michael@325 18 snmp_pidfile_snmptrapd="@l_prefix@/var/snmp/snmptrapd.pid"
michael@325 19 snmp_pidfile_snmpd="@l_prefix@/var/snmp/snmpd.pid"
michael@325 20 snmp_signal () {
michael@325 21 [ -f $snmp_pidfile_snmptrapd ] \
michael@325 22 && kill -$1 `cat $snmp_pidfile_snmptrapd`
michael@325 23 local rc_snmptrapd=$?
michael@325 24 [ -f $snmp_pidfile_snmpd ] \
michael@325 25 && kill -$1 `cat $snmp_pidfile_snmpd`
michael@325 26 local rc_snmpd=$?
michael@325 27 [ $rc_snmptrapd -eq 0 -o $rc_snmpd -eq 0 ]
michael@325 28 }
michael@325 29
michael@325 30 %status -u @l_susr@ -o
michael@325 31 snmp_usable="no"
michael@325 32 snmp_active="no"
michael@325 33 rcService snmp enable yes && \
michael@325 34 snmp_usable="yes"
michael@325 35 rcService snmp enable yes && \
michael@325 36 snmp_signal 0 && snmp_active="yes"
michael@325 37 echo "snmp_enable=\"$snmp_enable\""
michael@325 38 echo "snmp_usable=\"$snmp_usable\""
michael@325 39 echo "snmp_active=\"$snmp_active\""
michael@325 40
michael@325 41 %start -u @l_susr@
michael@325 42 rcService snmp enable yes || exit 0
michael@325 43 rcService snmp active yes && exit 0
michael@325 44 for daemon in $snmp_daemons; do
michael@325 45 case "$daemon" in
michael@325 46 snmpd ) @l_prefix@/sbin/snmpd -Lsd $snmp_listen ;;
michael@325 47 snmptrapd ) @l_prefix@/sbin/snmptrapd -Lsd $snmp_listentrap ;;
michael@325 48 esac
michael@325 49 done
michael@325 50
michael@325 51 %stop -u @l_susr@
michael@325 52 rcService snmp enable yes || exit 0
michael@325 53 rcService snmp active no && exit 0
michael@325 54 snmp_signal TERM
michael@325 55
michael@325 56 %restart -u @l_susr@
michael@325 57 rcService snmp enable yes || exit 0
michael@325 58 rcService snmp active no && exit 0
michael@325 59 rc snmp stop
michael@325 60 sleep 2
michael@325 61 rc snmp start
michael@325 62
michael@325 63 %daily -u @l_susr@
michael@325 64 rcService snmp enable yes || exit 0
michael@325 65 shtool rotate -f \
michael@325 66 -n ${snmp_log_numfiles} -s ${snmp_log_minsize} -d \
michael@325 67 -z ${snmp_log_complevel} -o @l_rusr@ -g @l_rgrp@ -m 644 \
michael@325 68 -P "${snmp_log_prolog}" \
michael@325 69 -E "${snmp_log_epilog}" \
michael@325 70 @l_prefix@/var/snmp/snmp.log
michael@325 71

mercurial