Cleanup of openipmi-helper script
Removed some legacy stuff including branches handling systems with no udev. Resolves: #1579773
This commit is contained in:
parent
5d7705c6c3
commit
89be3f89ee
@ -4,7 +4,7 @@ Summary: IPMI (Intelligent Platform Management Interface) library and tools
|
||||
Name: OpenIPMI
|
||||
|
||||
Version: 2.0.28
|
||||
Release: 2%{?dist}
|
||||
Release: 3%{?dist}
|
||||
License: LGPLv2+ and GPLv2+ or BSD
|
||||
URL: http://sourceforge.net/projects/openipmi/
|
||||
Source: http://downloads.sourceforge.net/openipmi/%{name}-%{version}.tar.gz
|
||||
@ -198,6 +198,9 @@ echo ".so man1/openipmish.1" > %{buildroot}%{_mandir}/man1/ipmish.1
|
||||
%{_mandir}/man5/ipmi_sim_cmd.5*
|
||||
|
||||
%changelog
|
||||
* Mon Feb 03 2020 Vaclav Dolezal <vdolezal@redhat.com> - 2.0.28-3
|
||||
- Cleanup of openipmi-helper script; removed no-udev branch (#1579773)
|
||||
|
||||
* Tue Jan 28 2020 Fedora Release Engineering <releng@fedoraproject.org> - 2.0.28-2
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_32_Mass_Rebuild
|
||||
|
||||
|
@ -4,6 +4,7 @@
|
||||
# ipmi: OpenIPMI Driver helper script
|
||||
#
|
||||
# Authors: Jan Safranek <jsafrane@redhat.com>
|
||||
# Václav Doležal <vdolezal@redhat.com>
|
||||
#
|
||||
# Based on IPMI init script by:
|
||||
# Matt Domsch <Matt_Domsch@dell.com>
|
||||
@ -30,11 +31,6 @@ INTF_NUM=0
|
||||
|
||||
IPMI_SMB_MODULE_NAME="ipmi_smb"
|
||||
IPMI_SI_MODULE_NAME="ipmi_si"
|
||||
kernel=`uname -r | cut -d. -f1-2`
|
||||
if [ "${kernel}" == "2.4" ]; then
|
||||
IPMI_SMB_MODULE_NAME="ipmi_smb_intf"
|
||||
IPMI_SI_MODULE_NAME="ipmi_si_drv"
|
||||
fi
|
||||
|
||||
MODULES_INTERFACES=""
|
||||
[ "${DEV_IPMI}" = "yes" ] && MODULES_INTERFACES="${MODULES_INTERFACES} ipmi_devintf"
|
||||
@ -55,17 +51,6 @@ RETVAL=0
|
||||
LOCKFILE=/var/lock/subsys/ipmi
|
||||
DEV_IPMI_TIMEOUT=150
|
||||
|
||||
UDEV_EXISTS=0
|
||||
if [ -e /sbin/udev -o -e /sbin/udevd ]; then
|
||||
UDEV_EXISTS=1
|
||||
fi
|
||||
|
||||
#############################################################################
|
||||
# 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()
|
||||
@ -73,7 +58,7 @@ modules_loaded_verbose()
|
||||
OnePlusLoaded=0
|
||||
OnePlusUnloaded=0
|
||||
for m in $@; do
|
||||
if /sbin/lsmod | grep $m >/dev/null 2>&1 ; then
|
||||
if /sbin/lsmod | grep -q $m ; then
|
||||
echo "$m module loaded."
|
||||
OnePlusLoaded=1
|
||||
else
|
||||
@ -88,7 +73,7 @@ modules_loaded()
|
||||
OnePlusLoaded=0
|
||||
OnePlusUnloaded=0
|
||||
for m in $@; do
|
||||
if /sbin/lsmod | grep $m >/dev/null 2>&1 ; then
|
||||
if /sbin/lsmod | grep -q $m ; then
|
||||
OnePlusLoaded=1
|
||||
else
|
||||
OnePlusUnloaded=1
|
||||
@ -154,13 +139,6 @@ start_watchdog_common()
|
||||
RETVAL=$((RETVAL | 2)) &&
|
||||
echo "Watchdog startup failed: cannot load ipmi_watchdog module" &&
|
||||
return
|
||||
if [ ${UDEV_EXISTS} -eq 0 -a ! -e /dev/watchdog ]; then
|
||||
mknod -m 0600 /dev/watchdog c 10 130
|
||||
[ $? -ne 0 ] &&
|
||||
RETVAL=$((RETVAL | 8)) &&
|
||||
echo "Watchdog startup failed: cannot create /dev/watchdog" &&
|
||||
return
|
||||
fi
|
||||
}
|
||||
|
||||
start_watchdog_quiet()
|
||||
@ -186,10 +164,6 @@ stop_watchdog()
|
||||
if [ ${OnePlusLoaded} -ne 0 ]; then
|
||||
RETVAL=$((RETVAL | 32))
|
||||
echo "Watchog shutdown failed: cannot unload ipmi_watchdog module"
|
||||
else
|
||||
if [ "${IPMI_WATCHDOG}" = "yes" ]; then
|
||||
[ ${UDEV_EXISTS} -eq 0 ] && rm -f /dev/watchdog
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
@ -199,10 +173,6 @@ stop_watchdog_quiet()
|
||||
modules_loaded ipmi_watchdog
|
||||
if [ ${OnePlusLoaded} -ne 0 ]; then
|
||||
RETVAL=$((RETVAL | 32))
|
||||
else
|
||||
if [ "${IPMI_WATCHDOG}" = "yes" ]; then
|
||||
[ ${UDEV_EXISTS} -eq 0 ] && rm -f /dev/watchdog
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
@ -211,9 +181,9 @@ start_powercontrol_common()
|
||||
local poweroff_opts=""
|
||||
load_hw_modules
|
||||
if [ "${IPMI_POWERCYCLE}" == "yes" ]; then
|
||||
modinfo ipmi_poweroff 2>/dev/null | grep poweroff_control > /dev/null 2>&1 && \
|
||||
modinfo ipmi_poweroff 2>/dev/null | grep -q poweroff_control && \
|
||||
poweroff_opts="poweroff_control=2"
|
||||
modinfo ipmi_poweroff 2>/dev/null | grep poweroff_powercycle > /dev/null 2>&1 && \
|
||||
modinfo ipmi_poweroff 2>/dev/null | grep -q poweroff_powercycle && \
|
||||
poweroff_opts="poweroff_powercycle=1"
|
||||
fi
|
||||
modprobe ipmi_poweroff "${poweroff_opts}" > /dev/null 2>&1
|
||||
@ -265,9 +235,6 @@ unload_all_ipmi_modules()
|
||||
for m in ${MODULES}; do
|
||||
modprobe -q -r ${m} > /dev/null 2>&1
|
||||
done
|
||||
# delete interface node ONLY if ipmi_devintf is unloaded
|
||||
[ `lsmod | grep -c "ipmi_devintf"` -eq 0 ] &&
|
||||
rm -f "/dev/ipmi${INTF_NUM}"
|
||||
}
|
||||
|
||||
unload_ipmi_modules_leave_features()
|
||||
@ -275,10 +242,7 @@ unload_ipmi_modules_leave_features()
|
||||
for m in ${MODULES_INTERFACES}; do
|
||||
modprobe -q -r ${m} > /dev/null 2>&1
|
||||
done
|
||||
# delete interface node ONLY if ipmi_devintf is unloaded
|
||||
[ `lsmod | grep -c "ipmi_devintf"` -eq 0 ] &&
|
||||
rm -f "/dev/ipmi${INTF_NUM}"
|
||||
lsmod | egrep -q "ipmi_(poweroff|watchdog)" > /dev/null 2>&1
|
||||
lsmod | grep -Eq "ipmi_(poweroff|watchdog)"
|
||||
if [ "$?" -ne "0" ]; then
|
||||
stop_watchdog_quiet
|
||||
stop_powercontrol_quiet
|
||||
@ -302,14 +266,7 @@ load_ipmi_modules ()
|
||||
modprobe ipmi_devintf > /dev/null 2>&1
|
||||
modules_loaded ipmi_devintf
|
||||
RETVAL=$((RETVAL & ~2))
|
||||
[ ${OnePlusLoaded} -eq 0 ] && RETVAL=$((RETVAL | 2))
|
||||
if [ ${OnePlusLoaded} -eq 1 ]; then
|
||||
if [ ${UDEV_EXISTS} -eq 0 ]; then
|
||||
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=$((RETVAL | 4))
|
||||
fi
|
||||
|
||||
# udev can take several seconds to create /dev/ipmi0,
|
||||
# but it happens asynchronously, so delay here
|
||||
locdelay=${DEV_IPMI_TIMEOUT}
|
||||
@ -317,6 +274,8 @@ load_ipmi_modules ()
|
||||
locdelay=$((locdelay - 1))
|
||||
sleep 0.1
|
||||
done
|
||||
else
|
||||
RETVAL=$((RETVAL | 2))
|
||||
fi
|
||||
fi
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user