Cool Solutions

OES: Apply Patches Without New Kernel Patches Being Applied


April 26, 2007 12:40 pm





If you have a need in your OES Linux environment to apply patches without having a new Kernel being applied, then the following should help you accomplish this goal.


This script checks for available patches and removes any kernel related patch and applies the rest, and if there are no updates then it will exit with “No Updates Available”.


Copy the text below into a file preferably named or download it here.

#Install Patches without installing the kernel 

RUGBIN=`which rug`
TMPPatches=`mktemp -t patches.XXXXXXXXXX` || exit 1

#Begin Patch Section
if [ -e $RUGBIN ]; then
$RUGBIN pl oes | sed -e '/^i/ d' -e '/--/ d' -e '/Name/ d' | awk '{ print $2 }' >> $TMPPatches

PATCH_ARRAY=( `cat $TMPPatches | tr '\n' ' '` )
KERN_Patches=`mktemp -t kern_patches.XXXXXXXXXX` || exit 1

#Check for Kernel Patches and remove them from the list of Patches to be installed
echo "Checking for Kernel patches..."
for i in ${PATCH_ARRAY[@]}; do
$RUGBIN pi $i | grep -iq "update for Linux kernel"
	if [ $? -eq 0 ]; then
		echo "                                    $i is a kernel patch"
		echo $i >> $KERN_Patches
		cat $TMPPatches | sed "/$i/ d" > $TMPPatches
		echo "$i is NOT a kernel patch"

#Format Patches in a line to install with rug pin
cat $TMPPatches | tr '\n' ' ' > $TMPPatches 

#Install Patches
if [ "$update" != "" ]; then
echo "Executing rug to patch your system..."

$RUGBIN pin $update

echo " "
echo "Summary:"
echo "Patches have been installed"
echo "The following Kernel Patches have not been installed."
echo "Install these patches individually with the following command."
echo "rug pin patch_name"
echo " "
echo "Kernel patch list:"
echo "$LEFTOVER"
echo " "
echo "Enjoy!!"
echo " "

echo "No Updates Available."

#Remove temp files
rm $TMPPatches
rm $KERN_Patches

Once you have this shell script created you can save it in /root/bin or something with the chmod 755 permissions on it. Now you are ready to set it up to run as a Cron Job or use it as you desire.


0 votes, average: 0.00 out of 50 votes, average: 0.00 out of 50 votes, average: 0.00 out of 50 votes, average: 0.00 out of 50 votes, average: 0.00 out of 5 (0 votes, average: 0.00 out of 5)
You need to be a registered member to rate this post.
Loading ... Loading ...

Categories: Uncategorized

Disclaimer: This content is not supported by Novell. It was contributed by a community member and is published "as is." It seems to have worked for at least one person, and might work for you. But please be sure to test it thoroughly before using it in a production environment.