1125204Sharti#!/bin/sh 2125204Sharti# $FreeBSD$ 3125204Sharti 4125204Shartifatal() { 5125204Sharti echo -e "$*" >&2 6125204Sharti exit 1 7125204Sharti} 8125204Sharti 9125204Shartimsg() { 10125204Sharti echo -e "$*" >&2 11125204Sharti} 12125204Sharti 13125204Shartiusage1() { 14125204Sharti msg "Usage: RunTest.sh [-hq] [-b <localbase>]" 15125204Sharti msg "Options:" 16125204Sharti msg " -h show this info" 17125204Sharti msg " -b <localbase> localbase if not /usr/local" 18125204Sharti msg " -q be quite" 19125204Sharti msg " -u run user space test, not kernel" 20125204Sharti exit 0 21125204Sharti} 22125204Sharti 23125204Shartiparse_options() { 24125204Sharti args=`getopt b:hqu $*` 25125204Sharti if [ $? -ne 0 ] ; then 26125204Sharti fatal "Usage: $0 [-qu] [-b <localbase>]" 27125204Sharti fi 28125204Sharti 29125204Sharti options="" 30125204Sharti set -- $args 31125204Sharti for i 32125204Sharti do 33125204Sharti case "$i" 34125204Sharti in 35125204Sharti 36125204Sharti -h) usage1;; 37125204Sharti -u|-q) options="$options $i"; shift;; 38125204Sharti -b) LOCALBASE="$2"; shift; shift;; 39125204Sharti --) shift; break;; 40125204Sharti esac 41125204Sharti done 42125204Sharti 43125204Sharti if [ "$LOCALBASE" = "" ] ; then 44125204Sharti LOCALBASE="/usr/local" 45125204Sharti 46125204Sharti pkg_info -I atmsupport-\* 2>/dev/null >/dev/null 47125204Sharti if [ $? -ne 0 ] ; then 48125204Sharti fatal "Atmsupport package not installed. \ 49125204ShartiGoto /usr/ports/net/atmsupport,\ntype 'make ; make install ; make clean' \ 50125204Shartiand re-run this script" 51125204Sharti fi 52125204Sharti fi 53125204Sharti} 54