]> CyberLeo.Net >> Repos - FreeBSD/releng/10.0.git/blob - tools/tools/mfi/runmegacli.sh
- Copy stable/10 (r259064) to releng/10.0 as part of the
[FreeBSD/releng/10.0.git] / tools / tools / mfi / runmegacli.sh
1 #!/bin/sh
2
3 # $FreeBSD$
4 # This is a simple wrapper for running the MegaCLI tool for Linux.  It assumes
5 # that the MegaCLI binary has been installed in /compat/linux/usr/sbin/MegaCli.
6 # The binary must also have been branded appropriately, and the COMPAT_LINUX,
7 # LINPROCFS, and LINSYSFS options must be enabled.  It is best to enable the
8 # COMPAT_LINUX option and compile the mfi driver into the kernel, instead of
9 # loading it as a module, to ensure that all of the required driver bits are
10 # enabled.
11 #
12
13 megacli=/usr/sbin/MegaCli
14 linuxdir=/compat/linux
15 osrelease=2.6.12
16
17 devfsmount=`mount |grep $linuxdir/dev | awk '{print $3}'`
18 if [ "X$devfsmount" = "X" ]; then
19         mount -t devfs devfs $linuxdir/dev
20 fi
21
22 procfsmount=`mount |grep $linuxdir/proc | awk '{print $3}'`
23 if [ "X$procfsmount" = "X" ]; then
24         mount -t linprocfs linprocfs $linuxdir/proc
25 fi
26
27 sysfsmount=`mount |grep $linuxdir/sys | awk '{print $3}'`
28 if [ "X$sysfsmount" = "X" ]; then
29         mount -t linsysfs linsysfs $linuxdir/sys
30 fi
31
32 linuxver=`sysctl -n compat.linux.osrelease | cut -d . -f 1,2`
33 if [ "X$linuxver" != "X2.6" ]; then
34         sysctl compat.linux.osrelease=$osrelease
35 fi
36
37 chroot $linuxdir $megacli $@