- Updated initscript to latest version from Dell

This commit is contained in:
Phil Knirsch 2005-09-01 17:04:50 +00:00
parent e94f0b1f8d
commit 4b715b9d3d
2 changed files with 182 additions and 81 deletions

View File

@ -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: 7 Release: 8
License: GPL License: GPL
Group: System Environment/Base Group: System Environment/Base
URL: http://sourceforge.net/projects/openipmi/ URL: http://sourceforge.net/projects/openipmi/
@ -124,6 +124,9 @@ rm -rf $RPM_BUILD_ROOT
%{_libdir}/*.a %{_libdir}/*.a
%changelog %changelog
* Thu Sep 01 2005 Phil Knirsch <pknirsch@redhat.com> 1.4.14-8
- Updated initscript to latest version from Dell
* Fri Aug 12 2005 Phil Knirsch <pknirsch@redhat.com> 1.4.14-7 * Fri Aug 12 2005 Phil Knirsch <pknirsch@redhat.com> 1.4.14-7
- Fixed the unwanted output of failed module loading of the initscript. Behaves - Fixed the unwanted output of failed module loading of the initscript. Behaves
now like all our other initscripts (#165476) now like all our other initscripts (#165476)

View File

@ -18,6 +18,15 @@
# Short-Description: OpenIPMI Driver init script # Short-Description: OpenIPMI Driver init script
# Description: OpenIPMI Driver init script # Description: OpenIPMI Driver init script
### END INIT INFO ### END INIT INFO
#
# Exit Status values
# from start:
# 0 = no errors
# 1 = a necessary requested module did not load (error)
# 2 = an optional but requested module did not load (warning)
# 2 = could not create the proper /dev device node (warning)
# #
############################################################################# #############################################################################
# for log_success_msg and friends # for log_success_msg and friends
@ -77,7 +86,7 @@ start_watchdog()
load_hw_modules load_hw_modules
modprobe ipmi_watchdog ${IPMI_WATCHDOG_OPTIONS} || RETVAL=2 modprobe ipmi_watchdog ${IPMI_WATCHDOG_OPTIONS} || RETVAL=2
if [ ! -x /sbin/udev -a ! -e /dev/watchdog ]; then if [ ! -x /sbin/udev -a ! -e /dev/watchdog ]; then
mknod -m 0600 /dev/watchdog 10 130 || RETVAL=2 mknod -m 0600 /dev/watchdog c 10 130 || RETVAL=2
fi fi
fi fi
} }
@ -85,7 +94,7 @@ start_watchdog()
stop_watchdog() stop_watchdog()
{ {
modprobe -q -r ipmi_watchdog modprobe -q -r ipmi_watchdog
[ ! -x /sbin/udev ] && rm /dev/watchdog [ ! -x /sbin/udev ] && rm -f /dev/watchdog
} }
start_powercontrol() start_powercontrol()
@ -119,7 +128,7 @@ unload_ipmi_modules_leave_features()
for m in ${MODULES_INTERFACES}; do for m in ${MODULES_INTERFACES}; do
modprobe -q -r ${m} modprobe -q -r ${m}
done done
lsmod | egrep -q "ipmi_poweroff|ipmi_watchdog" lsmod | egrep -q "ipmi_(poweroff|watchdog)"
if [ "$?" -ne "0" ]; then if [ "$?" -ne "0" ]; then
stop_watchdog stop_watchdog
for m in ${MODULES}; do for m in ${MODULES}; do
@ -128,7 +137,6 @@ unload_ipmi_modules_leave_features()
fi fi
} }
############################################################################# #############################################################################
load_ipmi_modules () load_ipmi_modules ()
{ {
@ -144,6 +152,7 @@ load_ipmi_modules ()
if [ "${RETVAL}" != "2" ]; then if [ "${RETVAL}" != "2" ]; 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}
mknod -m 0600 /dev/ipmi${INTF_NUM} c ${DEVMAJOR} 0 || RETVAL=2 mknod -m 0600 /dev/ipmi${INTF_NUM} c ${DEVMAJOR} 0 || RETVAL=2
fi fi
fi fi
@ -153,6 +162,7 @@ load_ipmi_modules ()
modprobe ipmi_imb || RETVAL=2 modprobe ipmi_imb || RETVAL=2
if [ "${RETVAL}" != "2" ]; then if [ "${RETVAL}" != "2" ]; then
DEVMAJOR=`cat /proc/devices | awk '/imb/{print $1}'` DEVMAJOR=`cat /proc/devices | awk '/imb/{print $1}'`
rm -f /dev/imb
mknod -m 0600 /dev/imb c ${DEVMAJOR} 0 || RETVAL=2 mknod -m 0600 /dev/imb c ${DEVMAJOR} 0 || RETVAL=2
fi fi
fi fi
@ -167,7 +177,7 @@ 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 > /dev/null 2>&1
[ "${RETVAL}" = "1" ] && log_failure_msg && return [ "${RETVAL}" = "1" ] && log_failure_msg && return
[ "${RETVAL}" = "2" ] && touch ${LOCKFILE} && log_warning_msg [ "${RETVAL}" = "2" ] && touch ${LOCKFILE} && log_warning_msg
[ "${RETVAL}" = "0" ] && touch ${LOCKFILE} && log_success_msg [ "${RETVAL}" = "0" ] && touch ${LOCKFILE} && log_success_msg
@ -184,7 +194,7 @@ stop()
stop_all() stop_all()
{ {
echo -n $"Stopping ${MODULE_NAME} drivers: " echo -n $"Stopping all ${MODULE_NAME} drivers: "
unload_all_ipmi_modules unload_all_ipmi_modules
rm -f ${LOCKFILE} rm -f ${LOCKFILE}
log_success_msg log_success_msg
@ -198,23 +208,108 @@ restart()
} }
############################################################################# #############################################################################
status ()
modules_loaded()
{ {
for m in ${MODULES}; do OnePlusLoaded=0
OnePlusUnloaded=0
for m in $@; do
if /sbin/lsmod | grep $m >/dev/null 2>&1 ; then if /sbin/lsmod | grep $m >/dev/null 2>&1 ; then
echo "$m module loaded" echo "$m module loaded."
OnePlusLoaded=1
else else
echo "$m module not loaded" echo "$m module not loaded."
OnePlusUnLoaded=1
fi fi
done 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()
{
RETVAL=0
modules_loaded ${MODULES}
[ ${OnePlusUnloaded} -ne 0 ] && RETVAL=$((RETVAL | 2))
device_node_exists /dev/ipmi${INTF_NUM}
[ $? -eq 0 ] && RETVAL=$((RETVAL | 4))
device_node_exists /dev/watchdog
[ $? -eq 0 ] && RETVAL=$((RETVAL | 8))
[ ! -e ${LOCKFILE} ] && RETVAL=$((RETVAL | 16))
}
status()
{
RETVAL=0
minimum_modules_loaded
[ $? -eq 0 ] && RETVAL=$((RETVAL | 1))
modules_loaded ipmi_devintf
[ ${OnePlusLoaded} -eq 0 ] && RETVAL=$((RETVAL | 2))
device_node_exists /dev/ipmi${INTF_NUM}
[ $? -eq 0 ] && RETVAL=$((RETVAL | 4))
}
status_watchdog()
{
RETVAL=0
minimum_modules_loaded
[ $? -eq 0 ] && RETVAL=$((RETVAL | 1))
modules_loaded ipmi_watchdog
[ ${OnePlusLoaded} -eq 0 ] && RETVAL=$((RETVAL | 2))
device_node_exists /dev/watchdog
[ $? -eq 0 ] && RETVAL=$((RETVAL | 8))
}
status_powercontrol()
{
RETVAL=0
minimum_modules_loaded
[ $? -eq 0 ] && RETVAL=$((RETVAL | 1))
modules_loaded ipmi_powercontrol
[ ${OnePlusLoaded} -eq 0 ] && RETVAL=$((RETVAL | 2))
}
#############################################################################
usage () usage ()
{ {
echo $"Usage: $0 {start|stop|status|restart|condrestart|" 1>&2 echo $"Usage: $0 {start|stop|status|restart|condrestart|" 1>&2
echo $" start-watchdog|stop-watchdog|" 1>&2 echo $" start-watchdog|stop-watchdog|status-watchdog" 1>&2
echo $" start-powercontrol|stop-powercontrol|" 1>&2 echo $" start-powercontrol|stop-powercontrol|status-powercontrol" 1>&2
echo $" stop-all}" 1>&2 echo $" stop-all|status-all}" 1>&2
RETVAL=1 RETVAL=1
} }
@ -231,11 +326,14 @@ case "$1" in
stop) stop ;; stop) stop ;;
restart) restart ;; restart) restart ;;
status) status ;; status) status ;;
status-all) status_all ;;
condrestart) condrestart ;; condrestart) condrestart ;;
start-watchdog) start_watchdog ;; start-watchdog) start_watchdog ;;
stop-watchdog) stop_watchdog ;; stop-watchdog) stop_watchdog ;;
status-watchdog) status_watchdog ;;
start-powercontrol) start_powercontrol ;; start-powercontrol) start_powercontrol ;;
stop-powercontrol) stop_powercontrol ;; stop-powercontrol) stop_powercontrol ;;
status-powercontrol) status_powercontrol ;;
stop-all) stop_all ;; stop-all) stop_all ;;
*) usage ;; *) usage ;;
esac esac