]> CyberLeo.Net >> Repos - FreeBSD/releng/9.2.git/blob - tools/regression/atm/Funcs.sh
- Copy stable/9 to releng/9.2 as part of the 9.2-RELEASE cycle.
[FreeBSD/releng/9.2.git] / tools / regression / atm / Funcs.sh
1 #!/bin/sh
2 # $FreeBSD$
3
4 fatal() {
5         echo -e "$*" >&2
6         exit 1
7 }
8
9 msg() {
10         echo -e "$*" >&2
11 }
12
13 usage1() {
14         msg "Usage: RunTest.sh [-hq] [-b <localbase>]"
15         msg "Options:"
16         msg " -h                show this info"
17         msg " -b <localbase>    localbase if not /usr/local"
18         msg " -q                be quite"
19         msg " -u                run user space test, not kernel"
20         exit 0
21 }
22
23 parse_options() {
24         args=`getopt b:hqu $*`
25         if [ $? -ne 0 ] ; then
26                 fatal "Usage: $0 [-qu] [-b <localbase>]"
27         fi
28
29         options=""
30         set -- $args
31         for i
32         do
33                 case "$i"
34                 in
35
36                 -h)     usage1;;
37                 -u|-q)  options="$options $i"; shift;;
38                 -b)     LOCALBASE="$2"; shift; shift;;
39                 --)     shift; break;;
40                 esac
41         done
42
43         if [ "$LOCALBASE" = "" ] ; then
44                 LOCALBASE="/usr/local"
45
46                 pkg_info -I atmsupport-\* 2>/dev/null >/dev/null
47                 if [ $? -ne 0 ] ; then
48                         fatal "Atmsupport package not installed. \
49 Goto /usr/ports/net/atmsupport,\ntype 'make ; make install ; make clean' \
50 and re-run this script"
51                 fi
52         fi
53 }