and added files
[bcm963xx.git] / userapps / opensource / net-snmp / dist / nsb-package
diff --git a/userapps/opensource/net-snmp/dist/nsb-package b/userapps/opensource/net-snmp/dist/nsb-package
new file mode 100755 (executable)
index 0000000..329c28f
--- /dev/null
@@ -0,0 +1,115 @@
+#!/bin/bash
+#
+# $Id: nsb-package,v 1.7.2.1 2003/03/05 20:16:52 rstory Exp $
+# Author: Robert Story <rstory@freesnmp.com>
+#
+########################################################################
+########################################################################
+
+usage()
+{
+   echo "Usage: $0  [-c] [-d] [-P] [-s SRCD] [-b BUILDD] [-i INSTALLD] VERSION"
+   echo ""
+   echo " VERSION    : relase number (eg 5.0.3)"
+   echo " -s SRCDIR  : soure directory [$HOME/src/net-snmp-VERSION]"
+   echo " -b BUILDD  : build directory [$HOME/build/]"
+   echo "              NOTE-platform will be appended to build directory"
+   echo " -i INSTALLD: install directory [$HOME/build/\$PLATFORM/usr/local]"
+   echo ""
+   echo " -x : configure extra features for pre-release testing"
+   echo " -c : skip configure"
+   echo " -d : dirty build (don't make distclean)"
+   echo " -m : skip 'make all'"
+   echo " -P : pause at prompts in between stages"
+   echo " -r : remove build dir (rm -fR) before build"
+   echo " -R : remove build dir (rm -fR) after successful build"
+   echo " -t : skip 'make test'"
+   exit 1
+}
+
+#trap exit SIGINT
+
+#set -x
+
+#
+# find nsb-platform based on te path to this script
+#
+EXE_PATH=${0%nsb-package}
+EXE_PATH=${EXE_PATH%/}
+if [ -f $EXE_PATH/nsb-functions ];then
+   source $EXE_PATH/nsb-functions
+elif [ -f $HOME/bin/nsb-functions ]; then
+   source $HOME/bin/nsb-functions
+elif [ -f nsb-functions ];then
+   source nsb-functions
+else
+   echo "Cannot find nsb-functions in $EXE_PATH, $HOME/bin or $PWD"
+   exit 1
+fi
+
+
+########################################################################
+########################################################################
+
+REMOVE_SUCCESS=0
+
+#      x)  x=$OPTARG ;;
+while getopts b:cdi:mPrRs:tx opt
+do
+    case "$opt" in
+      b)  BUILDD=$OPTARG ;;
+      c)  NSB_SKIP_CONFIG=1 ;;
+      d)  NSB_CLEAN=0 ;;
+      i)  INSTALLD=$OPTARG ;;
+      m)  NSB_SKIP_BUILD=1 ;;
+      P)  NSB_PROMPT=1 ;;
+      r)  NSB_CLEAN=2 ;;
+      R)  REMOVE_SUCCESS=1 ;;
+      s)  SRCD=$OPTARG ;;
+      t)  NSB_SKIP_TEST=1 ;;
+      x)  NSB_CONFIG_ALL=1;;
+      \?)# unknown flag
+        usage;;
+    esac
+done
+shift `expr $OPTIND - 1`
+
+if [ $# -ne 1 ]; then
+   echo "expecting 1 argument, got $# ($@)"
+   usage
+fi
+
+if [ $NSB_CLEAN -eq 1 ]; then
+   if [ $NSB_SKIP_CONFIG -eq 1 ]; then
+      echo "A clean build also requires configuration (-d and -c"
+      echo "cannot both be specified)."
+      usage
+   fi
+fi
+
+VERSION=$1
+if [ -z "$SRCD" ]; then
+   SRCD=$HOME/src/net-snmp-$VERSION
+fi
+if [ -z "$BUILDD" ]; then
+   BUILDD=$HOME/build
+fi
+if [ $SRCD != $BUILDD ];then
+    BUILDD=$BUILDD/$VERSION-`nsb-sysname`
+fi
+if [ -z "$INSTALLD" ]; then
+   INSTALLD=$BUILDD/usr/local
+fi
+
+
+########################################################################
+########################################################################
+nsb-prompt "press enter to build $SRCD in $BUILDD, and install in $INSTALLD"
+nsb-build $VERSION $SRCD $BUILDD $INSTALLD $NSB_CONFIG_ALL
+rc=$?
+if [ $rc -eq 0 ] && [ $REMOVE_SUCCESS -eq 1 ];then
+    nsb-prompt "press enter to remove $BUILDD"
+    /bin/rm -fR $BUILDD > /dev/null 2>&1
+fi
+
+exit $rc