- Another update to latest initscripts from Dell
- Fixed some missing return statements for non-void functions (#164138)
This commit is contained in:
parent
4b715b9d3d
commit
31e3fcf270
@ -2,7 +2,7 @@
|
|||||||
Summary: OpenIPMI (Intelligent Platform Management Interface) library and tools
|
Summary: OpenIPMI (Intelligent Platform Management Interface) library and tools
|
||||||
Name: OpenIPMI
|
Name: OpenIPMI
|
||||||
Version: 1.4.14
|
Version: 1.4.14
|
||||||
Release: 8
|
Release: 9
|
||||||
License: GPL
|
License: GPL
|
||||||
Group: System Environment/Base
|
Group: System Environment/Base
|
||||||
URL: http://sourceforge.net/projects/openipmi/
|
URL: http://sourceforge.net/projects/openipmi/
|
||||||
@ -13,7 +13,7 @@ Source4: openipmi.initscript
|
|||||||
Patch1: OpenIPMI-1.4.11-gcc4.patch
|
Patch1: OpenIPMI-1.4.11-gcc4.patch
|
||||||
Patch2: OpenIPMI-1.4.14-oob.patch
|
Patch2: OpenIPMI-1.4.14-oob.patch
|
||||||
BuildRoot: /var/tmp/%{name}-%{version}-root
|
BuildRoot: /var/tmp/%{name}-%{version}-root
|
||||||
BuildPrereq: gdbm-devel swig glib2-devel net-snmp-devel ncurses-devel
|
BuildPrereq: gdbm-devel swig glib2-devel net-snmp-devel ncurses-devel openssl-devel
|
||||||
|
|
||||||
%description
|
%description
|
||||||
The Open IPMI project aims to develop an open code base to allow access to
|
The Open IPMI project aims to develop an open code base to allow access to
|
||||||
@ -124,6 +124,10 @@ rm -rf $RPM_BUILD_ROOT
|
|||||||
%{_libdir}/*.a
|
%{_libdir}/*.a
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Thu Sep 08 2005 Phil Knirsch <pknirsch@redhat.com> 1.4.14-9
|
||||||
|
- Another update to latest initscripts from Dell
|
||||||
|
- Fixed some missing return statements for non-void functions (#164138)
|
||||||
|
|
||||||
* Thu Sep 01 2005 Phil Knirsch <pknirsch@redhat.com> 1.4.14-8
|
* Thu Sep 01 2005 Phil Knirsch <pknirsch@redhat.com> 1.4.14-8
|
||||||
- Updated initscript to latest version from Dell
|
- Updated initscript to latest version from Dell
|
||||||
|
|
||||||
|
@ -19,20 +19,23 @@
|
|||||||
# Description: OpenIPMI Driver init script
|
# Description: OpenIPMI Driver init script
|
||||||
### END INIT INFO
|
### END INIT INFO
|
||||||
#
|
#
|
||||||
# Exit Status values
|
# Status return code bits
|
||||||
# from start:
|
# no bits set = no errors
|
||||||
# 0 = no errors
|
# bit 0 set = minimum modules aren't loaded
|
||||||
# 1 = a necessary requested module did not load (error)
|
# bit 1 set = requested feature module isn't loaded
|
||||||
# 2 = an optional but requested module did not load (warning)
|
# bit 2 set = /dev/ipmi0 (or /dev/imb if using that instead) doesn't exist
|
||||||
# 2 = could not create the proper /dev device node (warning)
|
# bit 3 set = /dev/watchdog doesn't exist
|
||||||
|
# bit 4 set = lockfile doesn't exist
|
||||||
|
# bit 5 set = modules are loaded even when asked to be unloaded
|
||||||
|
|
||||||
#
|
#
|
||||||
#############################################################################
|
#############################################################################
|
||||||
# for log_success_msg and friends
|
# for log_success_msg and friends
|
||||||
[ -r /lib/lsb/init-functions ] && . /lib/lsb/init-functions
|
[ -r /lib/lsb/init-functions ] && . /lib/lsb/init-functions
|
||||||
|
|
||||||
|
CONFIGFILE=/etc/sysconfig/ipmi
|
||||||
# source config info
|
# source config info
|
||||||
[ -r /etc/sysconfig/ipmi ] && . /etc/sysconfig/ipmi
|
[ -r ${CONFIGFILE} ] && . ${CONFIGFILE}
|
||||||
|
|
||||||
#############################################################################
|
#############################################################################
|
||||||
# GLOBALS
|
# GLOBALS
|
||||||
@ -48,29 +51,101 @@ if [ "${kernel}" == "2.4" ]; then
|
|||||||
IPMI_SI_MODULE_NAME="ipmi_si_drv"
|
IPMI_SI_MODULE_NAME="ipmi_si_drv"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
MODULES_INTERFACES="ipmi_imb ipmi_devintf"
|
MODULES_INTERFACES=""
|
||||||
MODULES_FEATURES="ipmi_watchdog ipmi_poweroff"
|
[ "${DEV_IPMI}" = "1" ] && MODULES_INTERFACES="${MODULES_INTERFACES} ipmi_devintf"
|
||||||
MODULES_HW="${IPMI_SMB_MODULE_NAME} ${IPMI_SI_MODULE_NAME}"
|
[ "${IPMI_IMB}" = "1" ] && MODULES_INTERFACES="${MODULES_INTERFACES} ipmi_imb"
|
||||||
|
|
||||||
|
MODULES_FEATURES=""
|
||||||
|
[ "${IPMI_WATCHDOG}" = "1" ] && MODULES_FEATURES="${MODULES_FEATURES} ipmi_watchdog"
|
||||||
|
[ "${IPMI_POWEROFF}" = "1" ] && MODULES_FEATURES="${MODULES_FEATURES} ipmi_poweroff"
|
||||||
|
|
||||||
|
MODULES_HW=""
|
||||||
|
[ "${IPMI_SI}" = "1" ] && MODULES_HW="${MODULES_HW} ${IPMI_SI_MODULE_NAME}"
|
||||||
|
[ "${IPMI_SMB}" = "1" ] && MODULES_HW="${MODULES_HW} ${IPMI_SMB_MODULE_NAME}"
|
||||||
|
|
||||||
MODULES_BASE="ipmi_msghandler"
|
MODULES_BASE="ipmi_msghandler"
|
||||||
MODULES="${MODULES_INTERFACES} ${MODULES_FEATURES} ${MODULES_HW} ${MODULES_BASE}"
|
MODULES="${MODULES_INTERFACES} ${MODULES_FEATURES} ${MODULES_HW} ${MODULES_BASE}"
|
||||||
|
|
||||||
|
|
||||||
RETVAL=0
|
RETVAL=0
|
||||||
LOCKFILE=/var/lock/subsys/ipmi
|
LOCKFILE=/var/lock/subsys/ipmi
|
||||||
|
DEV_IPMI_TIMEOUT=15
|
||||||
|
|
||||||
#############################################################################
|
#############################################################################
|
||||||
|
# NOTES:
|
||||||
|
# * /dev/ipmi0 is unconditionally deleted here on ipmi_devintf unload,
|
||||||
|
# because SLES9 and RHEL4 kernels don't send a message for udev to delete
|
||||||
|
# it for us.
|
||||||
|
#
|
||||||
|
#############################################################################
|
||||||
|
|
||||||
|
modules_loaded_verbose()
|
||||||
|
{
|
||||||
|
OnePlusLoaded=0
|
||||||
|
OnePlusUnloaded=0
|
||||||
|
for m in $@; do
|
||||||
|
if /sbin/lsmod | grep $m >/dev/null 2>&1 ; then
|
||||||
|
echo "$m module loaded."
|
||||||
|
OnePlusLoaded=1
|
||||||
|
else
|
||||||
|
echo "$m module not loaded."
|
||||||
|
OnePlusUnloaded=1
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
|
modules_loaded()
|
||||||
|
{
|
||||||
|
OnePlusLoaded=0
|
||||||
|
OnePlusUnloaded=0
|
||||||
|
for m in $@; do
|
||||||
|
if /sbin/lsmod | grep $m >/dev/null 2>&1 ; then
|
||||||
|
OnePlusLoaded=1
|
||||||
|
else
|
||||||
|
OnePlusUnloaded=1
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
|
device_node_exists ()
|
||||||
|
{
|
||||||
|
if [ -e "$1" ]; then
|
||||||
|
echo "$1 exists."
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
echo "$1 does not exist."
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
minimum_modules_loaded()
|
||||||
|
{
|
||||||
|
rc_base=1
|
||||||
|
rc_hw=1
|
||||||
|
modules_loaded_verbose "${MODULES_BASE}"
|
||||||
|
[ ${OnePlusLoaded} -eq 0 ] && rc_base=0
|
||||||
|
|
||||||
|
modules_loaded_verbose "${MODULES_HW}"
|
||||||
|
[ ${OnePlusLoaded} -eq 0 ] && rc_hw=0
|
||||||
|
|
||||||
|
return $((rc_base && rc_hw))
|
||||||
|
}
|
||||||
|
|
||||||
|
#############################################################################
|
||||||
|
|
||||||
load_si()
|
load_si()
|
||||||
{
|
{
|
||||||
if [ "${IPMI_SI}" = "1" ]; then
|
if [ "${IPMI_SI}" = "1" ]; then
|
||||||
modprobe ${IPMI_SI_MODULE_NAME} || RETVAL=1
|
modprobe ${IPMI_SI_MODULE_NAME} > /dev/null 2>&1
|
||||||
|
modules_loaded ${IPMI_SI_MODULE_NAME}
|
||||||
|
[ ${OnePlusLoaded} -ne 1 ] && RETVAL=$((RETVAL | 1))
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
load_smb()
|
load_smb()
|
||||||
{
|
{
|
||||||
if [ "${IPMI_SMB}" = "1" ]; then
|
if [ "${IPMI_SMB}" = "1" ]; then
|
||||||
modprobe ${IPMI_SMB_MODULE_NAME} || RETVAL=1
|
modprobe ${IPMI_SMB_MODULE_NAME} > /dev/null 2>&1
|
||||||
|
modules_loaded ${IPMI_SMB_MODULE_NAME}
|
||||||
|
[ ${OnePlusLoaded} -ne 1 ] && RETVAL=$((RETVAL | 1))
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -80,59 +155,147 @@ load_hw_modules()
|
|||||||
load_smb
|
load_smb
|
||||||
}
|
}
|
||||||
|
|
||||||
|
start_watchdog_common()
|
||||||
|
{
|
||||||
|
load_hw_modules
|
||||||
|
modprobe ipmi_watchdog ${IPMI_WATCHDOG_OPTIONS} > /dev/null 2>&1
|
||||||
|
modules_loaded ipmi_watchdog
|
||||||
|
[ ${OnePlusUnloaded} -ne 0 ] &&
|
||||||
|
RETVAL=$((RETVAL | 2)) &&
|
||||||
|
log_failure_msg &&
|
||||||
|
return
|
||||||
|
if [ ! -x /sbin/udev -a ! -e /dev/watchdog ]; then
|
||||||
|
mknod -m 0600 /dev/watchdog c 10 130
|
||||||
|
[ $? -ne 0 ] &&
|
||||||
|
RETVAL=$((RETVAL | 8)) &&
|
||||||
|
log_failure_msg &&
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
log_success_msg
|
||||||
|
}
|
||||||
|
|
||||||
|
start_watchdog_quiet()
|
||||||
|
{
|
||||||
|
[ "${IPMI_WATCHDOG}" != "1" ] &&
|
||||||
|
return
|
||||||
|
echo -n $"Starting ipmi_watchdog driver: "
|
||||||
|
start_watchdog_common
|
||||||
|
}
|
||||||
|
|
||||||
start_watchdog()
|
start_watchdog()
|
||||||
{
|
{
|
||||||
if [ "${IPMI_WATCHDOG}" = "1" ]; then
|
echo -n $"Starting ipmi_watchdog driver: "
|
||||||
load_hw_modules
|
[ "${IPMI_WATCHDOG}" != "1" ] &&
|
||||||
modprobe ipmi_watchdog ${IPMI_WATCHDOG_OPTIONS} || RETVAL=2
|
RETVAL=$((RETVAL | 2)) &&
|
||||||
if [ ! -x /sbin/udev -a ! -e /dev/watchdog ]; then
|
log_failure_msg "not configured" &&
|
||||||
mknod -m 0600 /dev/watchdog c 10 130 || RETVAL=2
|
return
|
||||||
fi
|
start_watchdog_common
|
||||||
fi
|
|
||||||
}
|
}
|
||||||
|
|
||||||
stop_watchdog()
|
stop_watchdog()
|
||||||
{
|
{
|
||||||
modprobe -q -r ipmi_watchdog
|
echo -n $"Stopping ipmi_watchdog driver: "
|
||||||
[ ! -x /sbin/udev ] && rm -f /dev/watchdog
|
modprobe -q -r ipmi_watchdog > /dev/null 2>&1
|
||||||
|
modules_loaded ipmi_watchdog
|
||||||
|
if [ ${OnePlusLoaded} -ne 0 ]; then
|
||||||
|
RETVAL=$((RETVAL | 32))
|
||||||
|
log_failure_msg
|
||||||
|
else
|
||||||
|
if [ "${IPMI_WATCHDOG}" = "1" ]; then
|
||||||
|
[ ! -x /sbin/udev ] && rm -f /dev/watchdog
|
||||||
|
fi
|
||||||
|
log_success_msg
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
stop_watchdog_quiet()
|
||||||
|
{
|
||||||
|
modprobe -q -r ipmi_watchdog > /dev/null 2>&1
|
||||||
|
modules_loaded ipmi_watchdog
|
||||||
|
if [ ${OnePlusLoaded} -ne 0 ]; then
|
||||||
|
RETVAL=$((RETVAL | 32))
|
||||||
|
else
|
||||||
|
if [ "${IPMI_WATCHDOG}" = "1" ]; then
|
||||||
|
[ ! -x /sbin/udev ] && rm -f /dev/watchdog
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
start_powercontrol_common()
|
||||||
|
{
|
||||||
|
local poweroff_opts=""
|
||||||
|
load_hw_modules
|
||||||
|
[ "${IPMI_POWERCYCLE}" == "1" ] && poweroff_opts="poweroff_control=2"
|
||||||
|
modprobe ipmi_poweroff "${poweroff_opts}" > /dev/null 2>&1
|
||||||
|
modules_loaded ipmi_poweroff
|
||||||
|
[ ${OnePlusUnloaded} -ne 0 ] &&
|
||||||
|
RETVAL=$((RETVAL | 2)) &&
|
||||||
|
log_failure_msg &&
|
||||||
|
return
|
||||||
|
log_success_msg
|
||||||
|
}
|
||||||
|
|
||||||
|
start_powercontrol_quiet()
|
||||||
|
{
|
||||||
|
[ "${IPMI_POWEROFF}" != "1" ] &&
|
||||||
|
return
|
||||||
|
echo -n $"Starting ipmi_poweroff driver: "
|
||||||
|
start_powercontrol_common
|
||||||
}
|
}
|
||||||
|
|
||||||
start_powercontrol()
|
start_powercontrol()
|
||||||
{
|
{
|
||||||
local poweroff_opts=""
|
echo -n $"Starting ipmi_poweroff driver: "
|
||||||
if [ "${IPMI_POWEROFF}" = "1" ]; then
|
[ "${IPMI_POWEROFF}" != "1" ] &&
|
||||||
load_hw_modules
|
RETVAL=$((RETVAL | 2)) &&
|
||||||
[ "${IPMI_POWERCYCLE}" == "1" ] && poweroff_opts="poweroff_control=2"
|
log_failure_msg "not configured" &&
|
||||||
modprobe ipmi_poweroff "${poweroff_opts}" || RETVAL=2
|
return
|
||||||
fi
|
start_powercontrol_common
|
||||||
}
|
}
|
||||||
|
|
||||||
stop_powercontrol()
|
stop_powercontrol()
|
||||||
{
|
{
|
||||||
modprobe -q -r ipmi_poweroff
|
echo -n $"Stopping ipmi_poweroff driver: "
|
||||||
|
modprobe -q -r ipmi_poweroff > /dev/null 2>&1
|
||||||
|
modules_loaded ipmi_poweroff
|
||||||
|
if [ ${OnePlusLoaded} -ne 0 ]; then
|
||||||
|
RETVAL=$((RETVAL | 32))
|
||||||
|
log_failure_msg
|
||||||
|
else
|
||||||
|
log_success_msg
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
stop_powercontrol_quiet()
|
||||||
|
{
|
||||||
|
modprobe -q -r ipmi_poweroff > /dev/null 2>&1
|
||||||
|
modules_loaded ipmi_poweroff
|
||||||
|
[ ${OnePlusLoaded} -ne 0 ] && RETVAL=$((RETVAL | 32))
|
||||||
}
|
}
|
||||||
|
|
||||||
#############################################################################
|
#############################################################################
|
||||||
unload_all_ipmi_modules()
|
unload_all_ipmi_modules()
|
||||||
{
|
{
|
||||||
[ ! -x /sbin/udev ] && rm -f "/dev/ipmi${INTF_NUM}"
|
rm -f "/dev/ipmi${INTF_NUM}"
|
||||||
stop_watchdog
|
stop_watchdog_quiet
|
||||||
|
stop_powercontrol_quiet
|
||||||
for m in ${MODULES}; do
|
for m in ${MODULES}; do
|
||||||
modprobe -q -r ${m}
|
modprobe -q -r ${m} > /dev/null 2>&1
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
unload_ipmi_modules_leave_features()
|
unload_ipmi_modules_leave_features()
|
||||||
{
|
{
|
||||||
[ ! -x /sbin/udev ] && rm -f "/dev/ipmi${INTF_NUM}"
|
rm -f "/dev/ipmi${INTF_NUM}"
|
||||||
for m in ${MODULES_INTERFACES}; do
|
for m in ${MODULES_INTERFACES}; do
|
||||||
modprobe -q -r ${m}
|
modprobe -q -r ${m} > /dev/null 2>&1
|
||||||
done
|
done
|
||||||
lsmod | egrep -q "ipmi_(poweroff|watchdog)"
|
lsmod | egrep -q "ipmi_(poweroff|watchdog)"
|
||||||
if [ "$?" -ne "0" ]; then
|
if [ "$?" -ne "0" ]; then
|
||||||
stop_watchdog
|
stop_watchdog_quiet
|
||||||
|
stop_powercontrol_quiet
|
||||||
for m in ${MODULES}; do
|
for m in ${MODULES}; do
|
||||||
modprobe -q -r ${m}
|
modprobe -q -r ${m} > /dev/null 2>&1
|
||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
@ -140,30 +303,44 @@ unload_ipmi_modules_leave_features()
|
|||||||
#############################################################################
|
#############################################################################
|
||||||
load_ipmi_modules ()
|
load_ipmi_modules ()
|
||||||
{
|
{
|
||||||
modprobe ipmi_msghandler || RETVAL=1
|
local locdelay
|
||||||
|
modprobe ipmi_msghandler > /dev/null 2>&1
|
||||||
|
modules_loaded ipmi_msghandler
|
||||||
|
[ ${OnePlusLoaded} -ne 1 ] && unload_all_ipmi_modules && RETVAL=$((RETVAL | 1)) && return
|
||||||
load_hw_modules
|
load_hw_modules
|
||||||
[ "${RETVAL}" = "1" ] && unload_all_ipmi_modules && return
|
[ $((RETVAL & 1)) -eq 1 ] && unload_all_ipmi_modules && RETVAL=$((RETVAL | 1)) && return
|
||||||
|
|
||||||
start_watchdog
|
|
||||||
start_powercontrol
|
|
||||||
|
|
||||||
if [ "${DEV_IPMI}" = "1" ]; then
|
if [ "${DEV_IPMI}" = "1" ]; then
|
||||||
modprobe ipmi_devintf || RETVAL=2
|
modprobe ipmi_devintf > /dev/null 2>&1
|
||||||
if [ "${RETVAL}" != "2" ]; then
|
modules_loaded ipmi_devintf
|
||||||
|
RETVAL=$((RETVAL & ~2))
|
||||||
|
[ ${OnePlusLoaded} -eq 0 ] && RETVAL=$((RETVAL | 2))
|
||||||
|
if [ ${OnePlusLoaded} -eq 1 ]; then
|
||||||
if [ ! -x /sbin/udev ]; then
|
if [ ! -x /sbin/udev ]; then
|
||||||
DEVMAJOR=`cat /proc/devices | awk '/ipmidev/{print $1}'`
|
DEVMAJOR=`cat /proc/devices | awk '/ipmidev/{print $1}'`
|
||||||
rm -f /dev/ipmi${INTF_NUM}
|
rm -f /dev/ipmi${INTF_NUM}
|
||||||
mknod -m 0600 /dev/ipmi${INTF_NUM} c ${DEVMAJOR} 0 || RETVAL=2
|
mknod -m 0600 /dev/ipmi${INTF_NUM} c ${DEVMAJOR} 0 || RETVAL=$((RETVAL | 4))
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# udev can take several seconds to create /dev/ipmi0,
|
||||||
|
# but it happens asynchronously, so delay here
|
||||||
|
locdelay=${DEV_IPMI_TIMEOUT}
|
||||||
|
while [ ! -e /dev/ipmi${INTF_NUM} -a ${locdelay} -gt 0 ]; do
|
||||||
|
locdelay=$((locdelay - 1))
|
||||||
|
sleep 1
|
||||||
|
done
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "${IPMI_IMB}" = "1" ]; then
|
if [ "${IPMI_IMB}" = "1" ]; then
|
||||||
modprobe ipmi_imb || RETVAL=2
|
modprobe ipmi_imb > /dev/null 2>&1
|
||||||
if [ "${RETVAL}" != "2" ]; then
|
modules_loaded ipmi_imb
|
||||||
|
RETVAL=$((RETVAL & ~2))
|
||||||
|
[ ${OnePlusLoaded} -eq 0 ] && RETVAL=$((RETVAL | 2))
|
||||||
|
if [ ${OnePlusLoaded} -eq 1 ]; then
|
||||||
DEVMAJOR=`cat /proc/devices | awk '/imb/{print $1}'`
|
DEVMAJOR=`cat /proc/devices | awk '/imb/{print $1}'`
|
||||||
rm -f /dev/imb
|
rm -f /dev/imb
|
||||||
mknod -m 0600 /dev/imb c ${DEVMAJOR} 0 || RETVAL=2
|
mknod -m 0600 /dev/imb c ${DEVMAJOR} 0 || RETVAL=$((RETVAL | 4))
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@ -176,117 +353,111 @@ load_ipmi_modules ()
|
|||||||
#############################################################################
|
#############################################################################
|
||||||
start()
|
start()
|
||||||
{
|
{
|
||||||
echo -n $"Starting ${MODULE_NAME} drivers: "
|
echo -n "Starting ${MODULE_NAME} drivers: "
|
||||||
load_ipmi_modules > /dev/null 2>&1
|
load_ipmi_modules
|
||||||
[ "${RETVAL}" = "1" ] && log_failure_msg && return
|
if [ ${RETVAL} -eq 0 ]; then
|
||||||
[ "${RETVAL}" = "2" ] && touch ${LOCKFILE} && log_warning_msg
|
touch ${LOCKFILE} && log_success_msg
|
||||||
[ "${RETVAL}" = "0" ] && touch ${LOCKFILE} && log_success_msg
|
else
|
||||||
|
if [ $((RETVAL & 1)) -eq 1 ]; then
|
||||||
|
log_failure_msg
|
||||||
|
else
|
||||||
|
touch ${LOCKFILE} && log_warning_msg
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
start_watchdog_quiet
|
||||||
|
start_powercontrol_quiet
|
||||||
}
|
}
|
||||||
|
|
||||||
#############################################################################
|
#############################################################################
|
||||||
stop()
|
stop()
|
||||||
{
|
{
|
||||||
echo -n $"Stopping ${MODULE_NAME} drivers: "
|
echo -n "Stopping ${MODULE_NAME} drivers: "
|
||||||
unload_ipmi_modules_leave_features
|
unload_ipmi_modules_leave_features
|
||||||
rm -f ${LOCKFILE}
|
modules_loaded ${MODULES_INTERFACES}
|
||||||
log_success_msg
|
if [ ${OnePlusLoaded} -ne 0 ]; then
|
||||||
|
RETVAL=$((RETVAL | 32))
|
||||||
|
log_failure_msg "may be in use"
|
||||||
|
else
|
||||||
|
rm -f ${LOCKFILE}
|
||||||
|
log_success_msg
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
stop_all()
|
stop_all()
|
||||||
{
|
{
|
||||||
echo -n $"Stopping all ${MODULE_NAME} drivers: "
|
echo -n $"Stopping all ${MODULE_NAME} drivers: "
|
||||||
unload_all_ipmi_modules
|
unload_all_ipmi_modules
|
||||||
rm -f ${LOCKFILE}
|
modules_loaded ${MODULES}
|
||||||
log_success_msg
|
if [ ${OnePlusLoaded} -ne 0 ]; then
|
||||||
|
RETVAL=$((RETVAL | 32))
|
||||||
|
log_failure_msg "may be in use"
|
||||||
|
else
|
||||||
|
rm -f ${LOCKFILE}
|
||||||
|
log_success_msg
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
#############################################################################
|
#############################################################################
|
||||||
restart()
|
restart()
|
||||||
{
|
{
|
||||||
stop_all
|
stop_all
|
||||||
|
RETVAL=0
|
||||||
start
|
start
|
||||||
}
|
}
|
||||||
|
|
||||||
#############################################################################
|
#############################################################################
|
||||||
|
|
||||||
modules_loaded()
|
|
||||||
{
|
|
||||||
OnePlusLoaded=0
|
|
||||||
OnePlusUnloaded=0
|
|
||||||
for m in $@; do
|
|
||||||
if /sbin/lsmod | grep $m >/dev/null 2>&1 ; then
|
|
||||||
echo "$m module loaded."
|
|
||||||
OnePlusLoaded=1
|
|
||||||
else
|
|
||||||
echo "$m module not loaded."
|
|
||||||
OnePlusUnLoaded=1
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
}
|
|
||||||
|
|
||||||
device_node_exists()
|
|
||||||
{
|
|
||||||
if [ -e "$1" ]; then
|
|
||||||
echo "$1 exists."
|
|
||||||
return 1
|
|
||||||
fi
|
|
||||||
echo "$1 does not exist."
|
|
||||||
return 0
|
|
||||||
}
|
|
||||||
|
|
||||||
minimum_modules_loaded()
|
|
||||||
{
|
|
||||||
modules_loaded ${MODULES_BASE}
|
|
||||||
[ ${OnePlusLoaded} -eq 0 ] && return 0
|
|
||||||
|
|
||||||
modules_loaded ${MODULES_HW}
|
|
||||||
[ ${OnePlusLoaded} -eq 0 ] && return 0
|
|
||||||
|
|
||||||
return 1
|
|
||||||
}
|
|
||||||
|
|
||||||
# Status return code bits
|
|
||||||
# bit 0 set = minimum modules aren't loaded
|
|
||||||
# bit 1 set = requested module isn't loaded
|
|
||||||
# bit 2 set = /dev/ipmi0 doesn't exist
|
|
||||||
# bit 3 set = /dev/watchdog doesn't exist
|
|
||||||
# bit 4 set = lockfile doesn't exist
|
|
||||||
|
|
||||||
status_all()
|
status_all()
|
||||||
{
|
{
|
||||||
RETVAL=0
|
minimum_modules_loaded
|
||||||
modules_loaded ${MODULES}
|
[ $? -eq 0 ] && RETVAL=$((RETVAL | 1))
|
||||||
|
|
||||||
|
modules_loaded_verbose ${MODULES_FEATURES} ${MODULES_INTERFACES}
|
||||||
[ ${OnePlusUnloaded} -ne 0 ] && RETVAL=$((RETVAL | 2))
|
[ ${OnePlusUnloaded} -ne 0 ] && RETVAL=$((RETVAL | 2))
|
||||||
|
|
||||||
device_node_exists /dev/ipmi${INTF_NUM}
|
if [ "${DEV_IPMI}" = "1" ]; then
|
||||||
[ $? -eq 0 ] && RETVAL=$((RETVAL | 4))
|
device_node_exists /dev/ipmi${INTF_NUM}
|
||||||
|
[ $? -eq 0 ] && RETVAL=$((RETVAL | 4))
|
||||||
|
fi
|
||||||
|
|
||||||
device_node_exists /dev/watchdog
|
if [ "${IPMI_IMB}" = "1" ]; then
|
||||||
[ $? -eq 0 ] && RETVAL=$((RETVAL | 8))
|
device_node_exists /dev/imb
|
||||||
|
[ $? -eq 0 ] && RETVAL=$((RETVAL | 4))
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ "${IPMI_WATCHDOG}" = "1" ]; then
|
||||||
|
device_node_exists /dev/watchdog
|
||||||
|
[ $? -eq 0 ] && RETVAL=$((RETVAL | 8))
|
||||||
|
fi
|
||||||
|
|
||||||
[ ! -e ${LOCKFILE} ] && RETVAL=$((RETVAL | 16))
|
[ ! -e ${LOCKFILE} ] && RETVAL=$((RETVAL | 16))
|
||||||
}
|
}
|
||||||
|
|
||||||
status()
|
status()
|
||||||
{
|
{
|
||||||
RETVAL=0
|
|
||||||
minimum_modules_loaded
|
minimum_modules_loaded
|
||||||
[ $? -eq 0 ] && RETVAL=$((RETVAL | 1))
|
[ $? -eq 0 ] && RETVAL=$((RETVAL | 1))
|
||||||
|
|
||||||
modules_loaded ipmi_devintf
|
if [ "${DEV_IPMI}" = "1" ]; then
|
||||||
[ ${OnePlusLoaded} -eq 0 ] && RETVAL=$((RETVAL | 2))
|
modules_loaded_verbose ipmi_devintf
|
||||||
|
[ ${OnePlusLoaded} -eq 0 ] && RETVAL=$((RETVAL | 2))
|
||||||
|
|
||||||
device_node_exists /dev/ipmi${INTF_NUM}
|
device_node_exists /dev/ipmi${INTF_NUM}
|
||||||
[ $? -eq 0 ] && RETVAL=$((RETVAL | 4))
|
[ $? -eq 0 ] && RETVAL=$((RETVAL | 4))
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ "${IPMI_IMB}" = "1" ]; then
|
||||||
|
device_node_exists /dev/imb
|
||||||
|
[ $? -eq 0 ] && RETVAL=$((RETVAL | 4))
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
status_watchdog()
|
status_watchdog()
|
||||||
{
|
{
|
||||||
RETVAL=0
|
|
||||||
minimum_modules_loaded
|
minimum_modules_loaded
|
||||||
[ $? -eq 0 ] && RETVAL=$((RETVAL | 1))
|
[ $? -eq 0 ] && RETVAL=$((RETVAL | 1))
|
||||||
|
|
||||||
modules_loaded ipmi_watchdog
|
modules_loaded_verbose ipmi_watchdog
|
||||||
[ ${OnePlusLoaded} -eq 0 ] && RETVAL=$((RETVAL | 2))
|
[ ${OnePlusLoaded} -eq 0 ] && RETVAL=$((RETVAL | 2))
|
||||||
|
|
||||||
device_node_exists /dev/watchdog
|
device_node_exists /dev/watchdog
|
||||||
@ -295,11 +466,10 @@ status_watchdog()
|
|||||||
|
|
||||||
status_powercontrol()
|
status_powercontrol()
|
||||||
{
|
{
|
||||||
RETVAL=0
|
|
||||||
minimum_modules_loaded
|
minimum_modules_loaded
|
||||||
[ $? -eq 0 ] && RETVAL=$((RETVAL | 1))
|
[ $? -eq 0 ] && RETVAL=$((RETVAL | 1))
|
||||||
|
|
||||||
modules_loaded ipmi_powercontrol
|
modules_loaded_verbose ipmi_powercontrol
|
||||||
[ ${OnePlusLoaded} -eq 0 ] && RETVAL=$((RETVAL | 2))
|
[ ${OnePlusLoaded} -eq 0 ] && RETVAL=$((RETVAL | 2))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user