#!/sbin/runscript # # dellomsa-drivers # # Dell OMSA driver module loading script # # This script takes care of loading correct driver modules # (if available) for the OpenManage Server Administrator. # It checks that the server really is Dell and finds out # which environment driver to load (dcdesm/dcdtvm/dcdipm). # Module "dcdbas" is the base module and is always loaded. # This script also creates necessary devices nodes in /dev. # OMSADIR=/opt/dell/srvadmin depend() { use logger net } checkconfig() { if [ ! -d ${OMSADIR} ]; then eerror "Directory ${OMSADIR} does not exist" return 1 fi if [ ! -x ${OMSADIR}/hapi/bin/dchcfg32 ]; then eerror "File ${OMSADIR}/hapi/bin/dchcfg32 does not exist" return 1 fi if [ ! -x ${OMSADIR}/omil/prereqcheck/sysreport ]; then eerror "File ${OMSADIR}/omil/prereqcheck/sysreport does not exist" return 1 fi } checkmodules() { # check that the system is Dell (output contains "System ID" if Dell) ${OMSADIR}/omil/prereqcheck/sysreport | grep -q "System ID" && true if [ $? -ne 0 ]; then eerror "Non-Dell system, not loading drivers." return 1 fi # get the running kernel version KVER=`/bin/uname -r` # check that the modules exist MODULESMISSING=0 MODULES="dcdbas dcdtvm dcdesm dcdipm" for MODULE in ${MODULES}; do if [ ! -f /lib/modules/${KVER}/extra/${MODULE}.ko ]; then # some of the modules are missing eerror "driver modules unavailable for ${KVER}" return 1 fi done } loadmodules() { ebegin "Loading base dell module" # first load the base module "dcdbas" /sbin/modprobe dcdbas eend $? # check that dcdbas is now listed in /proc/devices grep -q dcdbas /proc/devices && true if [ $? -ne 0 ]; then eerror "Error! Something is really wrong: dcdbas module was loaded" eerror "successfully, but dcdbas is not listed in /proc/devices!" return 1 fi # re-create required device nodes in /dev # base device node is always re-created EsmBASDevMAJOR=`grep dcdbas /proc/devices | awk '{print $1}'` if [ -e /dev/EsmBASDev0 ]; then # /dev/EsmBASDev exists rm -f /dev/EsmBASDev0 fi mknod -m 0600 /dev/EsmBASDev0 c ${EsmBASDevMAJOR} 0 ln -sf /dev/EsmBASDev0 /dev/EsmBASDev # find out which environment module to use (dcdesm|dcdtvm|dcdipm) export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:${OMSADIR}/hapi/bin/ ${OMSADIR}/hapi/bin/dchcfg32 command=getsystype >/dev/null 2>&1 && true case "$?" in 1) # TVM ebegin "Loading [TVM]" /sbin/modprobe dcdtvm EsmTVMDevMAJOR=`grep dcdtvm /proc/devices | awk '{print $1}'` if [ -e /dev/EsmTVMDev0 ]; then # /dev/EsmTVMDev exists rm -f /dev/EsmTVMDev0 fi mknod -m 0600 /dev/EsmTVMDev0 c ${EsmTVMDevMAJOR} 0 ln -sf /dev/EsmTVMDev0 /dev/EsmTVMDev eend $? ;; 2) # ESM ebegin "Loading [ESM]" /sbin/modprobe dcdesm EsmESMDevMAJOR=`grep dcdesm /proc/devices | awk '{print $1}'` if [ -e /dev/EsmESM2Dev0 ]; then # /dev/EsmESM2Dev exists rm -f /dev/EsmESM2Dev0 fi mknod -m 0600 /dev/EsmESM2Dev0 c ${EsmESMDevMAJOR} 0 ln -sf /dev/EsmESM2Dev0 /dev/EsmESM2Dev eend $? ;; 4) # IPMI ebegin "Loading [IPMI]" /sbin/modprobe dcdipm EsmIPMDevMAJOR=`grep dcdipm /proc/devices | awk '{print $1}'` if [ -e /dev/EsmIPMDev0 ]; then # /dev/EsmIPMDev exists rm -f /dev/EsmIPMDev0 fi mknod -m 0600 /dev/EsmIPMDev0 c ${EsmIPMDevMAJOR} 0 ln -sf /dev/EsmIPMDev0 /dev/EsmIPMDev eend $? ;; *) # unknown or none einfo "unknown env. platform, env. driver not loaded." ;; esac } start(){ checkconfig || return 1 checkmodules || return 1 loadmodules } stop() { ebegin "Unloading dell drivers" /sbin/rmmod dcdtvm >/dev/null 2>&1 && true /sbin/rmmod dcdesm >/dev/null 2>&1 && true /sbin/rmmod dcdipm >/dev/null 2>&1 && true /sbin/rmmod dcdbas >/dev/null 2>&1 && true eend $? }