xref: /freebsd/contrib/pjdfstest/tests/conf (revision f81cdf24ba5436367377f7c8e8f51f6df2a75ca7)
1# $FreeBSD: head/tools/regression/pjdfstest/tests/conf 211354 2010-08-15 21:29:03Z pjd $
2# vim: filetype=sh noexpandtab ts=8 sw=8
3# pjdfstest configuration file
4
5# Supported operating systems: FreeBSD, Darwin, SunOS, Linux
6os=`uname`
7
8unsupported_os()
9{
10	echo "Unsupported operating system ${os}." >/dev/stderr
11	exit 1
12}
13
14get_mountpoint()
15{
16	case "${os}" in
17	Darwin|FreeBSD)
18		df . | tail -1 | awk '{print $NF}'
19		;;
20	*)
21		unsupported_os
22		;;
23	esac
24}
25
26case "${os}" in
27Darwin)
28	GREP=grep
29	#fs=`df -T . | tail -1 | awk '{print $2}'`
30	mountpoint="`get_mountpoint`"
31	fs=`mount | grep "on $mountpoint" | sed -e 's/.*(//' -e 's/,.*//g' | tr '[:lower:]' '[:upper:]'`
32	;;
33FreeBSD)
34	GREP=grep
35	#fs=`df -T . | tail -1 | awk '{print $2}'`
36	mountpoint="`get_mountpoint`"
37	fs=`mount -p | awk '$2 == "'$mountpoint'" { print toupper($3) }'`
38	;;
39Solaris|SunOS)
40	GREP=ggrep
41	pattern=`df -Pk . | tail -1 | awk '{printf("%s on %s \n", $1, $6)}'`
42	fs=`mount -v | ${GREP} -E "^${pattern}" | awk '{print $5}' | \
43	    tr -s '[:lower:]' '[:upper:]'`
44	;;
45Linux)
46	GREP=grep
47	fs=`df -PT . | tail -1 | awk '{print toupper($2)}'`
48	;;
49*)
50	unsupported_os
51	;;
52esac
53
54# If we cannot figure out file system type, define it here.
55#fs="UFS"
56
57if [ -z "${fs}" ]; then
58	echo "Cannot figure out file system type, define it by hand." >/dev/stderr
59	exit 1
60fi
61