Created
May 9, 2015 18:43
-
-
Save non7top/8f26b37144349a13a81d to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Get the latest kernel installed | |
NEW_VERSION=`ls -tA1 /lib/modules | head -n 1` | |
# Check if the module is already present, if not- continue | |
if [ ! -e /lib/modules/$NEW_VERSION/misc/pvscsi.ko ]; then | |
# Log output to show version we're fixing | |
echo "Fixing VMware Paravirtual Drivers for reboot. Kernel: $NEW_VERSION" | |
# Find the current running kernel | |
OLD_VERSION=`uname -r` | |
if [ -f /lib/modules/$OLD_VERSION/pvscsi.ko ]; then | |
# Copy the existing module to new kernel tree | |
cp /lib/modules/$OLD_VERSION/pvscsi.ko /lib/modules/$NEW_VERSION -v | |
elif [ -f /lib/modules/$OLD_VERSION/misc/pvscsi.ko ]; then | |
# Copy the existing module to new kernel tree | |
mkdir /lib/modules/$NEW_VERSION/misc | |
cp /lib/modules/$OLD_VERSION/misc/pvscsi.ko /lib/modules/$NEW_VERSION/misc -v | |
else | |
echo "Old pvsci module not found, please install VMware tools" | |
fi | |
# Rebuild our modules cache | |
depmod -a $NEW_VERSION | |
# Create a new initrd, including the new pvscsi module | |
mkinitrd -f --with=pvscsi /boot/initrd-$NEW_VERSION.img $NEW_VERSION | |
else | |
# This would occur when module is already present | |
echo "VMware Paravirtual Drivers Fix Installed" | |
fi | |
exit 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment