3 # $Id: nsb-package,v 1.7.2.1 2003/03/05 20:16:52 rstory Exp $
4 # Author: Robert Story <rstory@freesnmp.com>
6 ########################################################################
7 ########################################################################
11 echo "Usage: $0 [-c] [-d] [-P] [-s SRCD] [-b BUILDD] [-i INSTALLD] VERSION"
13 echo " VERSION : relase number (eg 5.0.3)"
14 echo " -s SRCDIR : soure directory [$HOME/src/net-snmp-VERSION]"
15 echo " -b BUILDD : build directory [$HOME/build/]"
16 echo " NOTE-platform will be appended to build directory"
17 echo " -i INSTALLD: install directory [$HOME/build/\$PLATFORM/usr/local]"
19 echo " -x : configure extra features for pre-release testing"
20 echo " -c : skip configure"
21 echo " -d : dirty build (don't make distclean)"
22 echo " -m : skip 'make all'"
23 echo " -P : pause at prompts in between stages"
24 echo " -r : remove build dir (rm -fR) before build"
25 echo " -R : remove build dir (rm -fR) after successful build"
26 echo " -t : skip 'make test'"
35 # find nsb-platform based on te path to this script
37 EXE_PATH=${0%nsb-package}
38 EXE_PATH=${EXE_PATH%/}
39 if [ -f $EXE_PATH/nsb-functions ];then
40 source $EXE_PATH/nsb-functions
41 elif [ -f $HOME/bin/nsb-functions ]; then
42 source $HOME/bin/nsb-functions
43 elif [ -f nsb-functions ];then
46 echo "Cannot find nsb-functions in $EXE_PATH, $HOME/bin or $PWD"
51 ########################################################################
52 ########################################################################
57 while getopts b:cdi:mPrRs:tx opt
61 c) NSB_SKIP_CONFIG=1 ;;
63 i) INSTALLD=$OPTARG ;;
64 m) NSB_SKIP_BUILD=1 ;;
67 R) REMOVE_SUCCESS=1 ;;
75 shift `expr $OPTIND - 1`
78 echo "expecting 1 argument, got $# ($@)"
82 if [ $NSB_CLEAN -eq 1 ]; then
83 if [ $NSB_SKIP_CONFIG -eq 1 ]; then
84 echo "A clean build also requires configuration (-d and -c"
85 echo "cannot both be specified)."
91 if [ -z "$SRCD" ]; then
92 SRCD=$HOME/src/net-snmp-$VERSION
94 if [ -z "$BUILDD" ]; then
97 if [ $SRCD != $BUILDD ];then
98 BUILDD=$BUILDD/$VERSION-`nsb-sysname`
100 if [ -z "$INSTALLD" ]; then
101 INSTALLD=$BUILDD/usr/local
105 ########################################################################
106 ########################################################################
107 nsb-prompt "press enter to build $SRCD in $BUILDD, and install in $INSTALLD"
108 nsb-build $VERSION $SRCD $BUILDD $INSTALLD $NSB_CONFIG_ALL
110 if [ $rc -eq 0 ] && [ $REMOVE_SUCCESS -eq 1 ];then
111 nsb-prompt "press enter to remove $BUILDD"
112 /bin/rm -fR $BUILDD > /dev/null 2>&1