Import package vendor original specs for necessary manipulations.

Fri, 25 Mar 2011 20:06:11 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Fri, 25 Mar 2011 20:06:11 +0100
changeset 325
6601d28cfe52
parent 324
d423aaf00721
child 326
efe7dfa57059

Import package vendor original specs for necessary manipulations.

snmp/fsl.snmp file | annotate | diff | comparison | revisions
snmp/rc.snmp file | annotate | diff | comparison | revisions
snmp/snmp.patch file | annotate | diff | comparison | revisions
snmp/snmp.spec file | annotate | diff | comparison | revisions
snmp/snmpd.conf file | annotate | diff | comparison | revisions
snmp/snmptrapd.conf file | annotate | diff | comparison | revisions
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/snmp/fsl.snmp	Fri Mar 25 20:06:11 2011 +0100
     1.3 @@ -0,0 +1,16 @@
     1.4 +##
     1.5 +##  fsl.snmp -- OSSP fsl configuration
     1.6 +##
     1.7 +
     1.8 +ident (snmpd|snmptrapd|net-snmp)/.+ q{
     1.9 +    prefix(
    1.10 +        prefix="%b %d %H:%M:%S %N <%L> $1[%P]: "
    1.11 +    )
    1.12 +    -> {
    1.13 +        debug: file(
    1.14 +            path="@l_prefix@/var/snmp/snmp.log",
    1.15 +            perm=0644
    1.16 +        )
    1.17 +    }
    1.18 +};
    1.19 +
     2.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     2.2 +++ b/snmp/rc.snmp	Fri Mar 25 20:06:11 2011 +0100
     2.3 @@ -0,0 +1,71 @@
     2.4 +#!@l_prefix@/bin/openpkg rc
     2.5 +##
     2.6 +##  rc.snmp -- Run-Commands
     2.7 +##
     2.8 +
     2.9 +%config
    2.10 +    snmp_enable="$openpkg_rc_def"
    2.11 +    snmp_daemons="snmpd snmptrapd"
    2.12 +    snmp_listen="127.0.0.1"
    2.13 +    snmp_listentrap="127.0.0.1"
    2.14 +    snmp_log_prolog="true"
    2.15 +    snmp_log_epilog="true"
    2.16 +    snmp_log_numfiles="10"
    2.17 +    snmp_log_minsize="1M"
    2.18 +    snmp_log_complevel="9"
    2.19 +
    2.20 +%common
    2.21 +    snmp_pidfile_snmptrapd="@l_prefix@/var/snmp/snmptrapd.pid"
    2.22 +    snmp_pidfile_snmpd="@l_prefix@/var/snmp/snmpd.pid"
    2.23 +    snmp_signal () {
    2.24 +        [ -f $snmp_pidfile_snmptrapd ] \
    2.25 +            && kill -$1 `cat $snmp_pidfile_snmptrapd`
    2.26 +        local rc_snmptrapd=$?
    2.27 +        [ -f $snmp_pidfile_snmpd ] \
    2.28 +            && kill -$1 `cat $snmp_pidfile_snmpd`
    2.29 +        local rc_snmpd=$?
    2.30 +        [ $rc_snmptrapd -eq 0 -o $rc_snmpd -eq 0 ]
    2.31 +    }
    2.32 +
    2.33 +%status -u @l_susr@ -o
    2.34 +    snmp_usable="no"
    2.35 +    snmp_active="no"
    2.36 +    rcService snmp enable yes && \
    2.37 +        snmp_usable="yes"
    2.38 +    rcService snmp enable yes && \
    2.39 +        snmp_signal 0 && snmp_active="yes"
    2.40 +    echo "snmp_enable=\"$snmp_enable\""
    2.41 +    echo "snmp_usable=\"$snmp_usable\""
    2.42 +    echo "snmp_active=\"$snmp_active\""
    2.43 +
    2.44 +%start -u @l_susr@
    2.45 +    rcService snmp enable yes || exit 0
    2.46 +    rcService snmp active yes && exit 0
    2.47 +    for daemon in $snmp_daemons; do
    2.48 +        case "$daemon" in
    2.49 +            snmpd     ) @l_prefix@/sbin/snmpd     -Lsd $snmp_listen ;;
    2.50 +            snmptrapd ) @l_prefix@/sbin/snmptrapd -Lsd $snmp_listentrap ;;
    2.51 +        esac
    2.52 +    done
    2.53 +
    2.54 +%stop -u @l_susr@
    2.55 +    rcService snmp enable yes || exit 0
    2.56 +    rcService snmp active no  && exit 0
    2.57 +    snmp_signal TERM
    2.58 +
    2.59 +%restart -u @l_susr@
    2.60 +    rcService snmp enable yes || exit 0
    2.61 +    rcService snmp active no  && exit 0
    2.62 +    rc snmp stop
    2.63 +    sleep 2
    2.64 +    rc snmp start
    2.65 +
    2.66 +%daily -u @l_susr@
    2.67 +    rcService snmp enable yes || exit 0
    2.68 +    shtool rotate -f \
    2.69 +        -n ${snmp_log_numfiles} -s ${snmp_log_minsize} -d \
    2.70 +        -z ${snmp_log_complevel} -o @l_rusr@ -g @l_rgrp@ -m 644 \
    2.71 +        -P "${snmp_log_prolog}" \
    2.72 +        -E "${snmp_log_epilog}" \
    2.73 +        @l_prefix@/var/snmp/snmp.log
    2.74 +
     3.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     3.2 +++ b/snmp/snmp.patch	Fri Mar 25 20:06:11 2011 +0100
     3.3 @@ -0,0 +1,196 @@
     3.4 +Index: Makefile.in
     3.5 +--- Makefile.in.orig	2010-09-10 06:23:07.000000000 +0200
     3.6 ++++ Makefile.in	2010-10-09 09:56:09.000000000 +0200
     3.7 +@@ -18,7 +18,7 @@
     3.8 + INCLUDESUBDIR=system
     3.9 + INCLUDESUBDIRHEADERS= aix.h bsd.h bsdi3.h bsdi4.h bsdi.h cygwin.h \
    3.10 + 	darwin.h darwin7.h darwin8.h darwin9.h darwin10.h dragonfly.h dynix.h \
    3.11 +-	freebsd2.h freebsd3.h freebsd4.h freebsd5.h freebsd6.h freebsd.h \
    3.12 ++	freebsd2.h freebsd3.h freebsd4.h freebsd5.h freebsd6.h freebsd7.h freebsd8.h freebsd9.h freebsd.h \
    3.13 + 	generic.h \
    3.14 + 	hpux.h irix.h linux.h mingw32.h mips.h netbsd.h openbsd.h osf5.h \
    3.15 + 	solaris2.3.h solaris2.4.h solaris2.5.h solaris2.6.h \
    3.16 +Index: agent/auto_nlist.c
    3.17 +--- agent/auto_nlist.c.orig	2010-07-29 16:58:47.000000000 +0200
    3.18 ++++ agent/auto_nlist.c	2010-10-09 09:08:23.000000000 +0200
    3.19 +@@ -53,6 +53,7 @@
    3.20 +     }
    3.21 +     if (*ptr == 0) {
    3.22 +         *ptr = (struct autonlist *) malloc(sizeof(struct autonlist));
    3.23 ++	memset(*ptr, 0, sizeof(struct autonlist));
    3.24 +         it = *ptr;
    3.25 +         it->left = 0;
    3.26 +         it->right = 0;
    3.27 +Index: agent/mibgroup/mibII/tcp.c
    3.28 +--- agent/mibgroup/mibII/tcp.c.orig	2010-08-13 17:04:33.000000000 +0200
    3.29 ++++ agent/mibgroup/mibII/tcp.c	2010-10-09 09:08:23.000000000 +0200
    3.30 +@@ -87,7 +87,7 @@
    3.31 +                  * But only define it under FreeBSD, since it
    3.32 +                  *   breaks other systems (notable AIX)
    3.33 +                  */
    3.34 +-#ifdef freebsd4
    3.35 ++#if defined (freebsd4) || defined (__NetBSD__)
    3.36 + int  hz = 1000;
    3.37 + #endif
    3.38 + 
    3.39 +Index: agent/mibgroup/mibII/tcpTable.c
    3.40 +--- agent/mibgroup/mibII/tcpTable.c.orig	2010-06-16 15:13:25.000000000 +0200
    3.41 ++++ agent/mibgroup/mibII/tcpTable.c	2010-10-09 09:08:23.000000000 +0200
    3.42 +@@ -104,6 +104,11 @@
    3.43 + #define	TCPTABLE_REMOTEPORT	pcb.inp_fport
    3.44 + #define	TCPTABLE_IS_LINKED_LIST
    3.45 + 
    3.46 ++#if defined(__FreeBSD__)
    3.47 ++#undef  INP_NEXT_SYMBOL
    3.48 ++#define INP_NEXT_SYMBOL inp_next
    3.49 ++#endif
    3.50 ++
    3.51 + #endif                          /* linux */
    3.52 + #endif                          /* WIN32 cygwin */
    3.53 + #endif                          /* solaris2 */
    3.54 +@@ -867,12 +872,17 @@
    3.55 +         nnew = SNMP_MALLOC_TYPEDEF(netsnmp_inpcb);
    3.56 +         if (!nnew)
    3.57 +             break;
    3.58 ++#if defined(__FreeBSD__)
    3.59 ++        memcpy(&(nnew->pcb), &(((struct xinpcb *) xig)->xi_inp),
    3.60 ++                           sizeof(struct inpcb));
    3.61 ++#else
    3.62 +         nnew->state = StateMap[((NS_ELEM *) xig)->xt_tp.t_state];
    3.63 +         if (nnew->state == 5 /* established */ ||
    3.64 +             nnew->state == 8 /*  closeWait  */ )
    3.65 +             tcp_estab++;
    3.66 +         memcpy(&(nnew->pcb), &(((NS_ELEM *) xig)->xt_inp),
    3.67 +                            sizeof(struct inpcb));
    3.68 ++#endif
    3.69 + 
    3.70 + 	nnew->inp_next = tcp_head;
    3.71 + 	tcp_head   = nnew;
    3.72 +Index: agent/mibgroup/ucd-snmp/diskio.c
    3.73 +--- agent/mibgroup/ucd-snmp/diskio.c.orig	2010-08-13 17:04:33.000000000 +0200
    3.74 ++++ agent/mibgroup/ucd-snmp/diskio.c	2010-10-09 09:08:23.000000000 +0200
    3.75 +@@ -618,6 +618,20 @@
    3.76 +     case DISKIO_DEVICE:
    3.77 +         *var_len = strlen(stat->dinfo->devices[indx].device_name);
    3.78 +         return (u_char *) stat->dinfo->devices[indx].device_name;
    3.79 ++#if defined(freebsd5) && (__FreeBSD_version >= 500107)
    3.80 ++    case DISKIO_NREAD:
    3.81 ++        long_ret = (signed long) stat->dinfo->devices[indx].bytes[DEVSTAT_READ];
    3.82 ++        return (u_char *) & long_ret;
    3.83 ++    case DISKIO_NWRITTEN:
    3.84 ++        long_ret = (signed long) stat->dinfo->devices[indx].bytes[DEVSTAT_WRITE];
    3.85 ++        return (u_char *) & long_ret;
    3.86 ++    case DISKIO_READS:
    3.87 ++        long_ret = (signed long) stat->dinfo->devices[indx].operations[DEVSTAT_READ];
    3.88 ++        return (u_char *) & long_ret;
    3.89 ++    case DISKIO_WRITES:
    3.90 ++        long_ret = (signed long) stat->dinfo->devices[indx].operations[DEVSTAT_WRITE];
    3.91 ++        return (u_char *) & long_ret;
    3.92 ++#else
    3.93 +     case DISKIO_NREAD:
    3.94 + #if defined(freebsd5) && __FreeBSD_version >= 500107
    3.95 +         long_ret = (signed long) stat->dinfo->devices[indx].bytes[DEVSTAT_READ];
    3.96 +@@ -675,6 +689,7 @@
    3.97 +     case DISKIO_LA15:
    3.98 +         long_ret = devloads[indx].la15;
    3.99 +         return (u_char *) & long_ret;
   3.100 ++#endif
   3.101 + 
   3.102 +     default:
   3.103 +         ERROR_MSG("diskio.c: don't know how to handle this request.");
   3.104 +Index: agent/mibgroup/ucd-snmp/memory_solaris2.c
   3.105 +--- agent/mibgroup/ucd-snmp/memory_solaris2.c.orig	2008-10-21 23:10:43.000000000 +0200
   3.106 ++++ agent/mibgroup/ucd-snmp/memory_solaris2.c	2010-10-09 09:08:23.000000000 +0200
   3.107 +@@ -1,3 +1,4 @@
   3.108 ++#undef _FILE_OFFSET_BITS /* swapctl doesn't support 64bit off_t */
   3.109 + #include <net-snmp/net-snmp-config.h>   /* local SNMP configuration details */
   3.110 + #if HAVE_STRING_H
   3.111 + #include <string.h>
   3.112 +Index: agent/mibgroup/ucd-snmp/proc.c
   3.113 +--- agent/mibgroup/ucd-snmp/proc.c.orig	2010-07-29 16:58:47.000000000 +0200
   3.114 ++++ agent/mibgroup/ucd-snmp/proc.c	2010-10-09 09:08:23.000000000 +0200
   3.115 +@@ -1,3 +1,6 @@
   3.116 ++#ifdef solaris2
   3.117 ++#undef _FILE_OFFSET_BITS /* solaris procfs doesn't support 64bit off_t */
   3.118 ++#endif
   3.119 + #include <net-snmp/net-snmp-config.h>
   3.120 + 
   3.121 + #ifdef solaris2
   3.122 +Index: agent/mibgroup/util_funcs.c
   3.123 +--- agent/mibgroup/util_funcs.c.orig	2010-05-16 20:12:40.000000000 +0200
   3.124 ++++ agent/mibgroup/util_funcs.c	2010-10-09 09:08:23.000000000 +0200
   3.125 +@@ -457,6 +457,9 @@
   3.126 +     int             fd[2][2], i, cnt;
   3.127 +     char            ctmp[STRMAX], *cptr1, *cptr2, argvs[STRMAX], **argv,
   3.128 +         **aptr;
   3.129 ++
   3.130 ++    *pid = -1;  /* open_persist_pipe ignores return code but checks *pid */
   3.131 ++
   3.132 +     /*
   3.133 +      * Setup our pipes 
   3.134 +      */
   3.135 +Index: agent/snmpd.c
   3.136 +--- agent/snmpd.c.orig	2010-08-17 20:31:31.000000000 +0200
   3.137 ++++ agent/snmpd.c	2010-10-09 09:08:23.000000000 +0200
   3.138 +@@ -429,7 +429,7 @@
   3.139 +     int             uid = 0, gid = 0;
   3.140 +     int             agent_mode = -1;
   3.141 +     char           *cptr, **argvptr;
   3.142 +-    char           *pid_file = NULL;
   3.143 ++    char           *pid_file = "@l_prefix@/var/snmp/snmpd.pid";
   3.144 +     char            option_compatability[] = "-Le";
   3.145 + #if HAVE_GETPID
   3.146 +     int fd;
   3.147 +Index: apps/snmptrapd.c
   3.148 +--- apps/snmptrapd.c.orig	2010-08-13 20:50:07.000000000 +0200
   3.149 ++++ apps/snmptrapd.c	2010-10-09 09:08:23.000000000 +0200
   3.150 +@@ -652,6 +652,7 @@
   3.151 +      */
   3.152 + #if HAVE_GETPID
   3.153 +     strcat(options, "p:");
   3.154 ++    parse_config_pidFile(NULL, "@l_prefix@/var/snmp/snmptrapd.pid");
   3.155 + #endif
   3.156 + 
   3.157 + #ifdef WIN32
   3.158 +Index: include/net-snmp/library/system.h
   3.159 +--- include/net-snmp/library/system.h.orig	2010-03-25 16:06:26.000000000 +0100
   3.160 ++++ include/net-snmp/library/system.h	2010-10-09 09:56:40.000000000 +0200
   3.161 +@@ -141,7 +141,8 @@
   3.162 + #endif
   3.163 + #ifndef HAVE_SETENV
   3.164 +     NETSNMP_IMPORT
   3.165 +-    int             setenv(const char *, const char *, int);
   3.166 ++    int             __netsnmp_setenv(const char *, const char *, int);
   3.167 ++#   define          setenv(a,b,c) __netsnmp_setenv(a,b,c)
   3.168 + #endif
   3.169 + 
   3.170 +     NETSNMP_IMPORT
   3.171 +Index: include/net-snmp/system/freebsd8.h
   3.172 +--- include/net-snmp/system/freebsd8.h.orig	2010-02-14 20:29:08.000000000 +0100
   3.173 ++++ include/net-snmp/system/freebsd8.h	2010-10-09 09:08:23.000000000 +0200
   3.174 +@@ -1,3 +1,6 @@
   3.175 ++/* freebsd8 is a superset of freebsd7 */
   3.176 ++#include "freebsd7.h"
   3.177 ++#define freebsd7 freebsd7
   3.178 + /* freebsd8 is a superset of freebsd4 */
   3.179 + #include "freebsd4.h"
   3.180 + #define freebsd4 freebsd4
   3.181 +Index: include/net-snmp/system/freebsd9.h
   3.182 +--- include/net-snmp/system/freebsd9.h.orig	2010-10-09 09:08:23.000000000 +0200
   3.183 ++++ include/net-snmp/system/freebsd9.h	2010-10-09 09:08:23.000000000 +0200
   3.184 +@@ -0,0 +1,3 @@
   3.185 ++/* freebsd9 is a superset of freebsd8 */
   3.186 ++#include "freebsd8.h"
   3.187 ++#define freebsd8 freebsd8
   3.188 +Index: snmplib/system.c
   3.189 +--- snmplib/system.c.orig	2010-07-29 16:58:47.000000000 +0200
   3.190 ++++ snmplib/system.c	2010-10-09 09:08:23.000000000 +0200
   3.191 +@@ -837,7 +837,7 @@
   3.192 + 
   3.193 + #ifndef HAVE_SETENV
   3.194 + int
   3.195 +-setenv(const char *name, const char *value, int overwrite)
   3.196 ++__netsnmp_setenv(const char *name, const char *value, int overwrite)
   3.197 + {
   3.198 +     char           *cp;
   3.199 +     int             ret;
     4.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     4.2 +++ b/snmp/snmp.spec	Fri Mar 25 20:06:11 2011 +0100
     4.3 @@ -0,0 +1,243 @@
     4.4 +##
     4.5 +##  snmp.spec -- OpenPKG RPM Package Specification
     4.6 +##  Copyright (c) 2000-2011 OpenPKG Foundation e.V. <http://openpkg.net/>
     4.7 +##
     4.8 +##  Permission to use, copy, modify, and distribute this software for
     4.9 +##  any purpose with or without fee is hereby granted, provided that
    4.10 +##  the above copyright notice and this permission notice appear in all
    4.11 +##  copies.
    4.12 +##
    4.13 +##  THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
    4.14 +##  WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
    4.15 +##  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
    4.16 +##  IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR
    4.17 +##  CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
    4.18 +##  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
    4.19 +##  LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
    4.20 +##  USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
    4.21 +##  ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
    4.22 +##  OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
    4.23 +##  OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
    4.24 +##  SUCH DAMAGE.
    4.25 +##
    4.26 +
    4.27 +#   package information
    4.28 +Name:         snmp
    4.29 +Summary:      Simple Network Management Protocol (SNMP) Toolkit
    4.30 +URL:          http://www.net-snmp.org/
    4.31 +Vendor:       The NET-SNMP Project
    4.32 +Packager:     OpenPKG Foundation e.V.
    4.33 +Distribution: OpenPKG Community
    4.34 +Class:        BASE
    4.35 +Group:        Network
    4.36 +License:      BSD
    4.37 +Version:      5.6.1
    4.38 +Release:      20110104
    4.39 +
    4.40 +#   package options
    4.41 +%option       with_fsl          yes
    4.42 +%option       with_perl         no
    4.43 +%option       with_shared       no
    4.44 +%option       with_mib_host     no
    4.45 +%option       with_mib_smux     no
    4.46 +%option       with_mib_tables   no
    4.47 +%option       with_mib_sendmail no
    4.48 +
    4.49 +#   list of sources
    4.50 +Source0:      http://switch.dl.sourceforge.net/net-snmp/net-snmp-%{version}.tar.gz
    4.51 +Source1:      rc.snmp
    4.52 +Source2:      fsl.snmp
    4.53 +Source3:      snmpd.conf
    4.54 +Source4:      snmptrapd.conf
    4.55 +Patch0:       snmp.patch
    4.56 +
    4.57 +#   build information
    4.58 +BuildPreReq:  OpenPKG, openpkg >= 20100101, gcc
    4.59 +PreReq:       OpenPKG, openpkg >= 20100101
    4.60 +BuildPreReq:  openssl
    4.61 +PreReq:       openssl
    4.62 +%if "%{with_fsl}" == "yes"
    4.63 +BuildPreReq:  fsl
    4.64 +PreReq:       fsl
    4.65 +%endif
    4.66 +%if "%{with_perl}" == "yes"
    4.67 +BuildPreReq:  perl
    4.68 +PreReq:       perl
    4.69 +%endif
    4.70 +
    4.71 +%description
    4.72 +    This is a toolkit relating to the Simple Network Management Protocol
    4.73 +    (SNMP), including an extensible agent, an SNMP library, tools to
    4.74 +    request or set information from SNMP agents, tools to generate and
    4.75 +    handle SNMP traps, a version of the unix 'netstat' command using
    4.76 +    SNMP, etc.
    4.77 +
    4.78 +%track
    4.79 +    prog snmp = {
    4.80 +        version   = %{version}
    4.81 +        url       = http://sourceforge.net/projects/net-snmp/files/
    4.82 +        regex     = net-snmp-(\d+\.\d+\.\d+[a-z]?)\.tar\.gz
    4.83 +    }
    4.84 +
    4.85 +%prep
    4.86 +    #   unpack and patch package
    4.87 +    %setup -q -n net-snmp-%{version}
    4.88 +    %patch -p0
    4.89 +
    4.90 +    #   provide a default PID file location
    4.91 +    %{l_shtool} subst %{l_value -s -a} \
    4.92 +        agent/snmpd.c \
    4.93 +        apps/snmptrapd.c
    4.94 +
    4.95 +    #   adjust package for RPM support in Host MIB
    4.96 +    #   (because OpenPKG RPM is a little bit different)
    4.97 +    %{l_shtool} subst \
    4.98 +        -e 's;/usr/include/rpm;%{l_prefix}/include/rpm;g' \
    4.99 +        -e 's;-lpopt\([^a-z]\);-lrpmpopt\1;g' \
   4.100 +        -e 's;db-3\.1;rpmdb;g' \
   4.101 +        -e 's;-lz\([^a-z]\);-lrpz\1;g' \
   4.102 +        -e 's;-lrpm\([^a-z]\);-lrpm -lrpmio\1;g' \
   4.103 +        -e 's;-lrpmio\([^a-z]\);-lrpmio -lrpmpopt -lrpmbz2 -lrpmz\1;g' \
   4.104 +        configure
   4.105 +
   4.106 +    #   adjust package for not requiring --enable-shared for --with-perl-modules
   4.107 +    #   (because it technically working also with static libraries on most platforms)
   4.108 +    %{l_shtool} subst \
   4.109 +        -e 's/if test "x$enable_shared" != "xyes"; then/if false; then/g' \
   4.110 +        configure
   4.111 +
   4.112 +    #   adjust package to install Perl packages into RPM_BUILD_ROOT
   4.113 +    %{l_shtool} subst \
   4.114 +        -e "s;perl Makefile.PL;perl Makefile.PL PERL=$perl FULLPERL=$perl PREFIX=${RPM_BUILD_ROOT}%{l_prefix} INSTALLDIRS=vendor;g" \
   4.115 +        -e 's/cd perl ; $(MAKE))/cd perl ; $(MAKE) pure_all)/g' \
   4.116 +        -e 's/cd perl ; $(MAKE) install/cd perl ; $(MAKE) pure_install/g' \
   4.117 +        Makefile.in
   4.118 +
   4.119 +%build
   4.120 +    #   disable search for db library
   4.121 +    ( echo "ac_cv_lib_db1_dbopen=no"
   4.122 +      echo "ac_cv_lib_db_dbopen=no"
   4.123 +      echo "ac_cv_lib_rpmdb_db_create=yes"
   4.124 +      echo "ac_cv_lib_db_3_0_db_create=no"
   4.125 +    ) >config.cache
   4.126 +
   4.127 +    #   determine additional MIBs to include
   4.128 +    mibs=""
   4.129 +%if "%{with_mib_host}" == "yes"
   4.130 +    mibs="$mibs host"
   4.131 +%endif
   4.132 +%if "%{with_mib_smux}" == "yes"
   4.133 +    mibs="$mibs smux"
   4.134 +%endif
   4.135 +%if "%{with_mib_sendmail}" == "yes"
   4.136 +    mibs="$mibs mibII/mta_sendmail"
   4.137 +%endif
   4.138 +
   4.139 +    #   use correct libraries for platform
   4.140 +    case "%{l_platform -t}" in
   4.141 +        *-hpux* ) loclibs="-lnm" ;;
   4.142 +    esac
   4.143 +
   4.144 +    #   configure package
   4.145 +    ./configure \
   4.146 +        --cache-file=./config.cache \
   4.147 +        --with-cc="%{l_cc}" \
   4.148 +        --with-cflags="%{l_cflags -O} %{l_cppflags}" \
   4.149 +        --with-ldflags="%{l_ldflags} %{l_fsl_ldflags}" \
   4.150 +        --with-libs="%{l_fsl_libs} $loclibs" \
   4.151 +        --prefix=%{l_prefix} \
   4.152 +        --with-logfile=/dev/null \
   4.153 +        --with-persistent-directory=%{l_prefix}/var/snmp \
   4.154 +        --with-openssl=%{l_prefix} \
   4.155 +        --enable-silent-libtool \
   4.156 +%if "%{with_shared}" == "no"
   4.157 +        --disable-shared \
   4.158 +%endif
   4.159 +%if "%{with_mib_host}" == "yes" || "%{with_mib_smux}" == "yes" || "%{with_mib_sendmail}" == "yes"
   4.160 +        --with-mib-modules="$mibs" \
   4.161 +%endif
   4.162 +%if "%{with_mib_tables}" == "no"
   4.163 +        --with-out-mib-modules="mibII/tcpTable mibII/udpTable" \
   4.164 +%endif
   4.165 +%if "%{with_perl}" == "yes"
   4.166 +        --with-perl-modules \
   4.167 +        --enable-embedded-perl \
   4.168 +%else
   4.169 +        --without-perl-modules \
   4.170 +        --disable-embedded-perl \
   4.171 +%endif
   4.172 +        --with-defaults
   4.173 +
   4.174 +    #   build package
   4.175 +    %{l_make} %{l_mflags} touchit
   4.176 +    %{l_make} %{l_mflags}
   4.177 +
   4.178 +%install
   4.179 +
   4.180 +    #   install package
   4.181 +    %{l_shtool} subst -v \
   4.182 +        -e "s;^\\(prefix.*=\\).*;\\1 $RPM_BUILD_ROOT%{l_prefix};g" \
   4.183 +        -e "s;^\\(exec_prefix.*=\\).*;\\1 $RPM_BUILD_ROOT%{l_prefix};g" \
   4.184 +        -e "s;^\\(persistentdir.*=\\).*;\\1 $RPM_BUILD_ROOT%{l_prefix}/var/snmp;g" \
   4.185 +        `find . -type f -name Makefile -print`
   4.186 +    %{l_make} %{l_mflags} install
   4.187 +
   4.188 +    #   create additional directories
   4.189 +    %{l_shtool} mkdir -f -p -m 755 \
   4.190 +        $RPM_BUILD_ROOT%{l_prefix}/var/snmp \
   4.191 +        $RPM_BUILD_ROOT%{l_prefix}/var/snmp \
   4.192 +        $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d \
   4.193 +        $RPM_BUILD_ROOT%{l_prefix}/etc/snmp
   4.194 +
   4.195 +    #   install default configuration
   4.196 +    %{l_shtool} install -c -m 644 \
   4.197 +        %{SOURCE snmpd.conf} %{SOURCE snmptrapd.conf} \
   4.198 +        $RPM_BUILD_ROOT%{l_prefix}/etc/snmp/
   4.199 +
   4.200 +    #   strip down installation
   4.201 +    rm -f $RPM_BUILD_ROOT%{l_prefix}/bin/snmpinform
   4.202 +    rm -f $RPM_BUILD_ROOT%{l_prefix}/bin/ipf-mod.pl
   4.203 +    ln  $RPM_BUILD_ROOT%{l_prefix}/bin/snmptrap \
   4.204 +        $RPM_BUILD_ROOT%{l_prefix}/bin/snmpinform
   4.205 +    strip $RPM_BUILD_ROOT%{l_prefix}/bin/*  >/dev/null 2>&1 || true
   4.206 +    strip $RPM_BUILD_ROOT%{l_prefix}/sbin/* >/dev/null 2>&1 || true
   4.207 +%if "%{with_perl}" == "yes"
   4.208 +    find ${RPM_BUILD_ROOT}${l_prefix} -name .packlist -print | xargs rm -f
   4.209 +%endif
   4.210 +
   4.211 +    #   install run-command script
   4.212 +    %{l_shtool} mkdir -f -p -m 755 \
   4.213 +        $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d
   4.214 +    %{l_shtool} install -c -m 755 %{l_value -s -a} \
   4.215 +        %{SOURCE rc.snmp} $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d/
   4.216 +
   4.217 +    #   install OSSP fsl configuration
   4.218 +    %{l_shtool} mkdir -f -p -m 755 $RPM_BUILD_ROOT%{l_prefix}/etc/fsl
   4.219 +    %{l_shtool} install -c -m 644 %{l_value -s -a} \
   4.220 +        %{SOURCE fsl.snmp} \
   4.221 +        $RPM_BUILD_ROOT%{l_prefix}/etc/fsl/
   4.222 +
   4.223 +    #   determine installation files
   4.224 +    %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT \
   4.225 +        %{l_files_std} \
   4.226 +        '%config %{l_prefix}/etc/fsl/fsl.snmp' \
   4.227 +        '%config %{l_prefix}/etc/snmp/*.conf'
   4.228 +
   4.229 +%files -f files
   4.230 +
   4.231 +%clean
   4.232 +
   4.233 +%post
   4.234 +    #   after upgrade, restart service
   4.235 +    [ $1 -eq 2 ] || exit 0
   4.236 +    eval `%{l_rc} snmp status 2>/dev/null`
   4.237 +    [ ".$snmp_active" = .yes ] && %{l_rc} snmp restart
   4.238 +    exit 0
   4.239 +
   4.240 +%preun
   4.241 +    #   before erase, stop service and remove log files
   4.242 +    [ $1 -eq 0 ] || exit 0
   4.243 +    %{l_rc} snmp stop 2>/dev/null
   4.244 +    rm -f $RPM_INSTALL_PREFIX/var/snmp/*
   4.245 +    exit 0
   4.246 +
     5.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     5.2 +++ b/snmp/snmpd.conf	Fri Mar 25 20:06:11 2011 +0100
     5.3 @@ -0,0 +1,12 @@
     5.4 +##
     5.5 +##  snmpd.conf
     5.6 +##
     5.7 +
     5.8 +#   rouser: a SNMPv3 read-only user
     5.9 +#   arguments: user [noauth|auth|priv] [restriction_oid]
    5.10 +rouser openpkg
    5.11 +    
    5.12 +#   rocommunity: a SNMPv1/SNMPv2c read-only access community name
    5.13 +#   arguments: community [default|hostname|network/bits] [oid]
    5.14 +rocommunity public 127.0.0.1
    5.15 +
     6.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     6.2 +++ b/snmp/snmptrapd.conf	Fri Mar 25 20:06:11 2011 +0100
     6.3 @@ -0,0 +1,4 @@
     6.4 +##
     6.5 +##  snmptrapd.conf
     6.6 +##
     6.7 +

mercurial