1#!/bin/sh
2# $FreeBSD$
3
4fatal() {
5	echo -e "$*" >&2
6	exit 1
7}
8
9msg() {
10	echo -e "$*" >&2
11}
12
13usage1() {
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
23parse_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. \
49Goto /usr/ports/net/atmsupport,\ntype 'make ; make install ; make clean' \
50and re-run this script"
51		fi
52	fi
53}
54