summaryrefslogtreecommitdiff
path: root/sysutils/linux-megacli2/files/megacli.sh.in
blob: faca0d4ae890a44d4b12457ad58c02ab4c104b73 (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
#!/bin/sh

# check for root user
#
if [ `id -u` -ne 0 ]
then
	echo "You must be root to run `basename $0`." >&2
	exit 1
fi

if ! [ `sysctl -n compat.linux.osrelease` = "2.6.12" ]; then
	echo "You need to set compat.linux.osrelease to 2.6.12 to run `basename $0`." >&2
	exit 1
fi

lpfs=`mount -t linprocfs | awk 'END{ print NR }'`
if [ ${lpfs} -le 0 ]; then
	echo "You need to mount linprocfs to run `basename $0`." >&2
	exit 1
fi
lsfs=`mount -t linsysfs | awk 'END{ print NR }'`
if [ ${lsfs} -le 0 ]; then
	echo "You need to mount linsysfs to run `basename $0`." >&2
	exit 1
fi

# check for active mfi_linux.ko
#
if ! kldstat -q -m mfi_linux
then
	if kldload mfi_linux
	then
		echo 'mfi_linux module loaded.' >&2
	else
		echo 'mfi_linux module failed to load.' >&2
		exit 1
	fi
fi

if [ $# -le 0 ]; then
	echo "usage: `basename $0` [options]" >&2
	exec %%PREFIX%%/libexec/MegaCli -h
fi

exec %%PREFIX%%/libexec/MegaCli ${*}