Debian Codegraph @

dist/net-snmp-solaris-build/buildpackage-solaris

raw symbols SCIP
1 #!/bin/kshscip-shell filesystem . . `/bin/ksh`.
2 #
3 # automatic build (configure/make/package) script
4 # for NET-SNMP on Solaris
5 #
6 # 2004/11 Rewrite to strictly build the package [email protected]
7 # 2002/11 [email protected]
8
9
10 # If you define DEBUG, the script will be verbose, and we won't remove temporary files
11
12 #DEBUG=Y
13 if [scip-shell system . . `[`. ! -z $DEBUG ]; then
14 set -x # be verbose
15 fi
16
17 # TMP is where we are temporarily installing the package to
18 TMP=`pwdscip-shell system . . pwd.`/pkgroot
19
20 # PKG is the internal and external name for the package
21 PKG=OSSnet-snmp
22
23 #PREFIX is the top level architecture dependent directory.
24 # This should be normally determined by configure
25 #prefix=/opt/${PKG}
26 prefix=/usr/localscip-shell filesystem . . `/usr/local`.
27
28 # VARDIR is the persistent dir from configure
29 VARDIR=/var/net-snmpscip-shell filesystem . . `/var/net-snmp`.
30
31 expandedprefix=${TMP}/${prefix}
32
33 PERL=${PERL:=`whichscip-shell system . . which. perl`}
34 MAKE=${MAKE:=`whichscip-shell system . . which. make`}
35
36 if [scip-shell system . . `[`. -d ${TMP} ]; then
37 rmscip-shell system . . rm. -rf ${TMP};
38 fi
39
40 # install to temporary package build root
41 cd ../..
42
43 $MAKE install prefix=${expandedprefix} exec_prefix=${expandedprefix} || exit 1
44
45 # We now have the main software installed, copy over the auxillary files
46 cd -
47
48 awkscip-shell system . . awk. /^___snmpd-init.d/,/___EOF/scip-shell filesystem . . `/^___snmpd-init.d/,/___EOF/`. $0 | grepscip-shell system . . grep. -v ^___ | sedscip-shell system . . sed. "s,@prefix@,$prefix,g" >|snmpd-init.d
49
50 # create persistent directory if it does not exist
51 [scip-shell system . . `[`. -d $TMP/$VARDIR ] || installscip-shell system . . install. -d -m 0755 $TMP/$VARDIR
52
53 # postinstall
54 LD_LIBRARY_PATH=$TMP$prefix/lib:$LD_LIBRARY_PATH $TMP/$prefix/bin/snmptranslate\
55 -M$TMP/$prefix/share/snmp/mibs -m SNMPv2-SMI .1 >&- || exit $? # create MIB index
56
57 # package
58 version=`../../net-snmp-config --version`
59 os=`unamescip-shell system . . uname. -s`
60 rel=`unamescip-shell system . . uname. -r`
61 class=snmp
62 owner=$LOGNAME
63 groupsscip-shell system . . groups. | awkscip-shell system . . awk. '{print $1}' | read group
64 catscip-shell system . . cat. <<== >|pkginfo
65 PKG="${PKG}"
66 NAME="net-snmp-$version"
67 ARCH="`unamescip-shell system . . uname. -p`"
68 VERSION="$version, $os $rel, `datescip-shell system . . date. +%Y.%m.%d.%H.%M.%S`"
69 CATEGORY="OpenSource"
70 DESC="The NET-SNMP Tools and Library"
71 VENDOR="http://net-snmp.sourceforge.net"
72 CLASSES="$class"
73 BASEDIR="$prefix"
74 ==
75 . ./pkginfoscip-shell source . . `./pkginfo`.
76
77 echoscip-shell system . . echo. 'checking dependencies'
78 unset LD_LIBRARY_PATH # binaries and libraries should have RPATH now
79 ./elfdepend.sh $TMP | grepscip-shell system . . grep. -v "P *$PKG " >|depend # ignore own package
80
81 echoscip-shell system . . echo. 'creating prototype file'
82 catscip-shell system . . cat. <<== >|prototype
83 i pkginfo
84 i copyright=../../COPYING
85 #i preinstall=./preinstall-postremove
86 #i postinstall=./preinstall-postremove
87 i depend
88 # set default mode, owner and group
89 ! default 0775 root sys
90 d snmp /etc 0755 root sys
91 d snmp /etc/init.d 0755 root sys
92 f snmp /etc/init.d/snmpd=./snmpd-init.d 0755 root sys
93 #l snmp /etc/rc2.d/S76snmpd=/etc/init.d/snmpd # not yet
94 ==
95
96 pkgproto -c snmp $TMP=/ |\
97 egrep -v '^d .* / |^d .* /var |^d .* /opt |^ .*perllocal.pod=' |\
98 sed -e "s/ $owner $group\$//" >> prototype || exit $?
99 # and ignore top level directories (must pre-exist)
100
101 echoscip-shell system . . echo. 'creating package'
102 pkgmk -od . || exit $?
103 pkgtrans . $PKG-$version-$ARCH-$os$rel.pkg $PKG || exit $?
104
105 # We should really do some cleanup here
106 if [scip-shell system . . `[`. -z $DEBUG ]; then
107 rmscip-shell system . . rm. -rf snmpd-init.d $PKG $TMP pkginfo prototype depend
108 fi
109
110 echoscip-shell system . . echo. "build was successfull"
111 exit 0
112
113 # /etc/init/snmpd
114 # This is packaged inside of buildpackage-solaris because we need to substitute
115 # in the actual server name.
116
117 ___snmpd-init.d___
118 #! /bin/sh
119 #
120 # start/stop the NET-SNMP master agent (snmpd)
121 #
122 # Location: /etc/init.d/snmpd
123 # /etc/rc3.d/S??snmpd
124 #
125 name="NET-SNMP agent"
126 daemon=@prefix@/sbin/snmpd
127
128 case "$1" in
129 start)
130 [scip-shell system . . `[`. ! -x $daemon ] && echoscip-shell system . . echo. "ERROR: cannot start $name ($daemon)" && exit 1
131 echoscip-shell system . . echo. "Starting $name ... \c"
132 PGREP=`whichscip-shell system . . which. pgrep`
133 if [scip-shell system . . `[`. -z $PGREP ]; then
134 pid=`pgrepscip-shell system . . pgrep. -fx $daemon`
135 else
136 pid=`psscip-shell system . . ps. -ef | grepscip-shell system . . grep. $daemon | grepscip-shell system . . grep. -v grep | awkscip-shell system . . awk. '{print $2}'`
137 fi
138
139 [scip-shell system . . `[`. ! -z "$pid" ] && echoscip-shell system . . echo. "already running with pid $pid." && exit 0
140 $daemon && echoscip-shell system . . echo. "done."
141 ;;
142 stop)
143 echoscip-shell system . . echo. "Stopping $name ... \c"
144 PGREP=`whichscip-shell system . . which. pgrep`
145 if [scip-shell system . . `[`. -z $PGREP ]; then
146 pid=`pgrepscip-shell system . . pgrep. -fx $daemon`
147 else
148 pid=`psscip-shell system . . ps. -ef | grepscip-shell system . . grep. $daemon | grepscip-shell system . . grep. -v grep | awkscip-shell system . . awk. '{print $2}'`
149 fi
150 [scip-shell system . . `[`. ! -z "$pid" ] && (killscip-shell system . . kill. $pid && echoscip-shell system . . echo. "done" ) || echoscip-shell system . . echo. "not running"
151
152 ;;
153 status)
154 echoscip-shell system . . echo. "$name is \c"
155 PGREP=`whichscip-shell system . . which. pgrep`
156 if [scip-shell system . . `[`. -z $PGREP ]; then
157 pid=`pgrepscip-shell system . . pgrep. -fx $daemon`
158 else
159 pid=`psscip-shell system . . ps. -ef | grepscip-shell system . . grep. $daemon | grepscip-shell system . . grep. -v grep | awkscip-shell system . . awk. '{print $2}'`
160 fi
161 [scip-shell system . . `[`. -z "$pid" ] && echoscip-shell system . . echo. "not running" || echoscip-shell system . . echo. "running with pid $pid"
162 ;;
163 restart)
164 $0 stop && $0 start
165 ;;
166 reload)
167 echoscip-shell system . . echo. "Re-initializing $name ...\c"
168 PGREP=`whichscip-shell system . . which. pgrep`
169 if [scip-shell system . . `[`. -z $PGREP ]; then
170 pid=`pgrepscip-shell system . . pgrep. -fx $daemon`
171 else
172 pid=`psscip-shell system . . ps. -ef | grepscip-shell system . . grep. $daemon | grepscip-shell system . . grep. -v grep | awkscip-shell system . . awk. '{print $2}'`
173 fi
174 [scip-shell system . . `[`. ! -z "$pid" ] && (killscip-shell system . . kill. -HUP $pid && echoscip-shell system . . echo. "done" ) || echoscip-shell system . . echo. "not running"
175 ;;
176 *)
177 echoscip-shell system . . echo. "Usage: $0 { start | stop | status | restart | reload }"
178 ;;
179 esac
180
181 exit 0
182 ___EOF___