RH6.X: Fix for LIS driver getting reverted to inbox driver when

kernel module package is installed

This fix also address the LIS driver compatibility issue when errata
kernel is updated/installed.
This commit is contained in:
Johnson 2019-05-15 13:27:18 -07:00 коммит произвёл johnsongeorge-w
Родитель 8b2a588d77
Коммит ff3fafc245
4 изменённых файлов: 25 добавлений и 23 удалений

Просмотреть файл

@ -85,6 +85,7 @@ if [ $? -eq 0 ];then
fi
if [[ $distro_version != "5"* ]]; then
export no_initramfs=1
latestkernel=(`rpm -q kernel | tail -n1 | cut -c 8-`)
runningkernel=(`uname -r`)
if [ ${latestkernel} != ${runningkernel} ] ; then

Просмотреть файл

@ -11,14 +11,14 @@ if [ ${#lisarr[@]} -gt 0 ]; then
echo "Uninstalling the Linux Integration Services for Microsoft Hyper-V..."
rpm -e ${lisarr[@]}
exit=$?
if [ $exit -eq 0 ]; then
echo "Uninstalled Linux Integration Services for Microsoft Hyper-V. Please reboot your system."
rm -f /etc/depmod.d/hyperv.conf.rpmsave
if [ $exit -eq 0 ]; then
echo "Uninstalled Linux Integration Services for Microsoft Hyper-V. Please reboot your system."
else
echo "Uninstallation of Linux Integration Services for Microsoft Hyper-V failed , Exiting"
exit 1
fi
echo "Uninstallation of Linux Integration Services for Microsoft Hyper-V failed , Exiting"
exit 1
fi
else
echo "No LIS RPM's are present"
fi

Просмотреть файл

@ -92,6 +92,9 @@ export INSTALL_MOD_PATH=$RPM_BUILD_ROOT
export INSTALL_MOD_DIR=extra/%{name}
for flavor in %flavors_to_build; do
make -C %{kernel_source $flavor} M=$PWD/obj/$flavor modules_install
export KMOD_INSTALL_DIR="$INSTALL_MOD_PATH/lib/modules/%{latest_kernel}/$INSTALL_MOD_DIR"
export WEAK_UPDATE_DIR="weak-updates/%{name}"
find $KMOD_INSTALL_DIR -name "*.ko" -exec bash -c 'kmodn=`basename {} | cut -d'.' -f1`; printf "override %s %{kverrel} $WEAK_UPDATE_DIR\n" $kmodn' \; > source/hyperv.conf
done
install -d -m0755 $RPM_BUILD_ROOT/etc/udev/rules.d/
install -m0644 source/100-balloon.rules $RPM_BUILD_ROOT/etc/udev/rules.d/
@ -145,6 +148,13 @@ if [ ! `grep -q -E "6.0|6.1|6.2|6.3" /etc/*-release` ] ; then
fi
%post
sed -i "s/%kverrel/$(uname -r)/g" -i /etc/depmod.d/hyperv.conf
# Update module dependency
if [ -e "/boot/System.map-$(uname -r)" ]; then
/sbin/depmod -aeF "/boot/System.map-$(uname -r)" "$(uname -r)" > /dev/null || :
else
/sbin/depmod -a
fi
# Update initrd
dracut --force "initramfs-$(uname -r).img" $(uname -r)
@ -158,15 +168,10 @@ cp -f "initramfs-$(uname -r).img" /boot/"initramfs-$(uname -r).img"
# If this is an upgrade, put new initrd into /tmp so postrans can
# copy it over to fix the fact that the postun from the previous package
# version will overwrite the updated initrd.
cp /etc/depmod.d/hyperv.conf /opt/files/
if [ $1 -eq 2 ]; then
cp -f "initramfs-$(uname -r).img" /opt/files/"initramfs-$(uname -r).img"
fi
if [ $1 -eq 1 ]; then
rm -rf /etc/depmod.d/hyperv.conf
fi
/sbin/chkconfig --add hv_kvp_daemon
echo "Adding KVP Daemon to Chkconfig...."
/etc/init.d/hv_kvp_daemon start >/dev/null
@ -209,8 +214,6 @@ else # package is being erased, not upgraded
dracut --force "initramfs-$(uname -r).img" $(uname -r)
cp -f "initramfs-$(uname -r).img" /boot/"initramfs-$(uname -r).img"
rm -rf /opt/files/"initramfs-$(uname -r).img"
cp /opt/files/hyperv.conf /etc/depmod.d/
rm -rf /opt/files/hyperv.conf
echo "Linux Integration Services for Hyper-V has been removed."
fi
@ -218,7 +221,6 @@ fi
if [ -e /opt/files/"initramfs-$(uname -r).img" ]; then #Recopying new initrd , as it got replaced because postun of old package
cp -f /opt/files/"initramfs-$(uname -r).img" /boot/"initramfs-$(uname -r).img"
echo "Upgrading RPMs Completed"
rm -rf /etc/depmod.d/hyperv.conf
fi
%files

Просмотреть файл

@ -117,7 +117,7 @@ for flavor in %flavors_to_build; do
fi
export KMOD_INSTALL_DIR="$INSTALL_MOD_PATH/lib/modules/%{latest_kernel}/$INSTALL_MOD_DIR"
export WEAK_UPDATE_DIR="weak-updates/%{name}"
find $KMOD_INSTALL_DIR -name "*.ko" -exec bash -c 'kmodn=`basename {} | cut -d'.' -f1`; printf "override %s * $WEAK_UPDATE_DIR\n" $kmodn' \; > source/hyperv.conf
find $KMOD_INSTALL_DIR -name "*.ko" -exec bash -c 'kmodn=`basename {} | cut -d'.' -f1`; printf "override %s %{kverrel} $WEAK_UPDATE_DIR\n" $kmodn' \; > source/hyperv.conf
done
install -d -m0755 $RPM_BUILD_ROOT/etc/udev/rules.d/
install -m0644 source/100-balloon.rules $RPM_BUILD_ROOT/etc/udev/rules.d/
@ -189,6 +189,13 @@ if [ $1 -eq 2 ]; then
fi
fi
%post
sed -i "s/%kverrel/$(uname -r)/g" -i /etc/depmod.d/hyperv.conf
# Update module dependency
if [ -e "/boot/System.map-$(uname -r)" ]; then
/usr/sbin/depmod -aeF "/boot/System.map-$(uname -r)" "$(uname -r)" > /dev/null || :
else
/usr/sbin/depmod -a
fi
# Update initrd
dracut --force "initramfs-$(uname -r).img" $(uname -r)
@ -202,16 +209,11 @@ cp -f "initramfs-$(uname -r).img" /boot/"initramfs-$(uname -r).img"
# If this is an upgrade, put new initrd into /tmp so postrans can
# copy it over to fix the fact that the postun from the previous package
# version will overwrite the updated initrd.
cp /etc/depmod.d/hyperv.conf /opt/files/
if [ $1 -eq 2 ]; then
cp -f "initramfs-$(uname -r).img" /opt/files/"initramfs-$(uname -r).img"
fi
if [ $1 -eq 1 ]; then
rm -rf /etc/depmod.d/hyperv.conf
fi
echo "Starting KVP Daemon...."
systemctl daemon-reload
systemctl enable hv_kvp_daemon.service > /dev/null 2>&1
@ -246,8 +248,6 @@ else # package is being erased, not upgraded
dracut --force "initramfs-$(uname -r).img" $(uname -r)
cp -f "initramfs-$(uname -r).img" /boot/"initramfs-$(uname -r).img"
rm -rf /opt/files/"initramfs-$(uname -r).img"
cp /opt/files/hyperv.conf /etc/depmod.d/
rm -rf /opt/files/hyperv.conf
echo "Linux Integration Services for Hyper-V has been removed."
fi
@ -255,7 +255,6 @@ fi
if [ -e /opt/files/"initramfs-$(uname -r).img" ]; then #Recopying new initrd , as it got replaced because postun of old package
cp -f /opt/files/"initramfs-$(uname -r).img" /boot/"initramfs-$(uname -r).img"
echo "Upgrading RPMs Completed"
rm -rf /etc/depmod.d/hyperv.conf
fi
if [ -e /etc/modprobe.d/hyperv_pvdrivers.conf ] ; then