#!/bin/sh ### run: sh updatekernel.sh #download amd64|i386 DownInstall() { wget $(lynx -dump -listonly $link | egrep 'all|'$@ ) ; echo dpkg -i *.deb ; } link=$(lynx --dump http://kernel.ubuntu.com/~kernel-ppa/mainline/ | awk '/http/{print $2}' | grep -v rc | tail -n 1) KVERSION=$(echo $link | cut -d "/" -f 6) LastKernelInstalled=$(ls /boot/ | grep img | cut -d "-" -f2 | tail -n 1) LastKernelAvaliable=$(echo $KVERSION | sed -e "s/v//g" | cut -d "-" -f1 ) LastKernelRC=$(lynx --dump http://kernel.ubuntu.com/~kernel-ppa/mainline/ | awk '/http/{print $2}' | grep rc | tail -n 1 | cut -d "/" -f 6) echo "\n\n\t\t[UBUNTU KERNELS] \ \n\n\tLast installed :\t $LastKernelInstalled \ \n\tLast Stable online :\t $LastKernelAvaliable \n\tLast RC online :\t $LastKernelRC" if [ $LastKernelInstalled = $LastKernelAvaliable ] then echo "\n\n\t already updated to version" $KVERSION "\n\n" # non serve "echo -e" exit else echo "\n\n\t upgrading to version" $KVERSION "\n\n" fi ######################## echo "$(tput setaf 3)---kernel $KVERSION will be installed in an `uname -i` system---$(tput sgr0)" sleep 2 read -p "Press Enter to continue, or abort by pressing CTRL+C" nothing echo "/n/n" DownloadFolder=$HOME/.kernel_update/kernel_$KVERSION echo $DownloadFolder mkdir -p $DownloadFolder cd $DownloadFolder #System architecture arch=`uname -m` if [ $arch = i686 ] || [ $arch = i386 ]; then DownInstall i386 elif [ $arch = "x86_64" ]; then DownInstall amd64 else echo "Unsupported Architecture" fi dpkg -i *.deb apt-get install -f rm -Rf $DownloadFolder