The Linux Kernel 3.16.3 is now available for the users, announced Linus Torvalds. This Linux Kernel version comes with plenty of fixes and improvements. The following BASH script, when executed, despite of the system architecture (valid only for i386, i686 and x86_64 based systems), installs Linux kernel 3.16.3 in your Linux systems.
Note: Make sure that you execute this script as a ROOT user.
Usage:
./script_name.sh
Script:#!/bin/sh
# Check if the user is ROOT
if [ $(id -u) -ne 0 ]
then
echo "You are not ROOT! Please login as ROOT."
exit
fi
# Latest Available Kernel version
LatestKernel="3.16.3-031603-generic"
# Required Packages
Headers_All="http://kernel.ubuntu.com/~kernel-ppa/mainline/v3.16.3-utopic/linux-headers-3.16.3-031603_3.16.3-031603.201409171435_all.deb"
Headers_i386="http://kernel.ubuntu.com/~kernel-ppa/mainline/v3.16.3-utopic/linux-headers-3.16.3-031603-generic_3.16.3-031603.201409171435_i386.deb"
Image_i386="http://kernel.ubuntu.com/~kernel-ppa/mainline/v3.16.3-utopic/linux-image-3.16.3-031603-generic_3.16.3-031603.201409171435_i386.deb"
Headers_amd64="http://kernel.ubuntu.com/~kernel-ppa/mainline/v3.16.3-utopic/linux-headers-3.16.3-031603-generic_3.16.3-031603.201409171435_amd64.deb"
Image_amd64="http://kernel.ubuntu.com/~kernel-ppa/mainline/v3.16.3-utopic/linux-image-3.16.3-031603-generic_3.16.3-031603.201409171435_amd64.deb"
# Debian Packages
DEB="linux-headers-3.16.3*.deb linux-image-3.16.3*.deb"
# Currently Installed Kernel Version
CurrentKernel_release=$(uname -r)
# System Architecture
SystemArch=$(uname -i)
# Check if System already has latest kernel installed
if [ "$CurrentKernel" = "$LatestKernel" ]
then
echo "Wow! Your System is Already Updated to Latest Available Kernel Version!"
echo "Program will now exit..."
sleep 2s
exit
fi
# If latest kernel is not available, then check the system architecture and download necessary packages
# For 32-bit Systems
if [ $SystemArch = "i386" ] || [ $SystemArch = "i686" ]
then
echo "Kernel upgrade process for 32-bit systems will now start..."
sleep 2s
echo "Downloading required packages.."
sleep 2s
wget $Headers_All
wget $Headers_i386
wget $Image_i386
echo "Download process completed. Packages are present in $(pwd) directory"
sleep 2s
echo "Installing the packages..."
dpkg -i $DEB
# For 64-bit Systems
elif [ $SystemArch = "x86_64" ]
then
echo "Kernel upgrade process for 64-bit systems will now start..."
sleep 2s
wget $Headers_All
wget $Headers_amd64
wget $Image_amd64
echo "Download process completed. Packages are present in $(pwd) directory"
sleep 2s
echo "Installing the packages..."
dpkg -i $DEB
# If system architecture is not compatible
else
echo "Packages for following system architecture not found : $SystemArch"
echo "Program will now exit..."
sleep 2s
exit
fi
echo "Your system has been successfully upgraded to latest kernel version $(LatestKernel)."
echo "System will now reboot."
sleep 5s
shutdown -r now
NOTE: Above script worked perfectly on my i386 system. I need confirmation from i686 and x86_64 users, if it works fine for them. Please suggest any changes to be incorporated.
Cool as always! :)
ReplyDeletethx man
ReplyDelete