aboutsummaryrefslogtreecommitdiff
path: root/tools/regression/atm/Funcs.sh
blob: c981f101df9447933ffdc17130d08d762054e421 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
#!/bin/sh
# $FreeBSD$

fatal() {
	echo -e "$*" >&2
	exit 1
}

msg() {
	echo -e "$*" >&2
}

usage1() {
	msg "Usage: RunTest.sh [-hq] [-b <localbase>]"
	msg "Options:"
	msg " -h		show this info"
	msg " -b <localbase>	localbase if not /usr/local"
	msg " -q		be quite"
	msg " -u		run user space test, not kernel"
	exit 0
}

parse_options() {
	args=`getopt b:hqu $*`
	if [ $? -ne 0 ] ; then
		fatal "Usage: $0 [-qu] [-b <localbase>]"
	fi

	options=""
	set -- $args
	for i
	do
		case "$i"
		in

		-h)	usage1;;
		-u|-q)	options="$options $i"; shift;;
		-b)	LOCALBASE="$2"; shift; shift;;
		--)	shift; break;;
		esac
	done

	if [ "$LOCALBASE" = "" ] ; then
		LOCALBASE="/usr/local"

		pkg_info -I atmsupport-\* 2>/dev/null >/dev/null
		if [ $? -ne 0 ] ; then
			fatal "Atmsupport package not installed. \
Goto /usr/ports/net/atmsupport,\ntype 'make ; make install ; make clean' \
and re-run this script"
		fi
	fi
}