diff options
| author | Horus3 | 2014-03-02 12:14:44 +0100 |
|---|---|---|
| committer | Horus3 | 2014-03-02 12:14:44 +0100 |
| commit | f18234fc7f2946a3d7cd0d8341c7d98f05e5e484 (patch) | |
| tree | 4a9b7572f29529be4b47fa016a791195f9421be2 /updatekernel.sh | |
| download | dotfiles-f18234fc7f2946a3d7cd0d8341c7d98f05e5e484.tar.gz | |
init
Diffstat (limited to 'updatekernel.sh')
| -rwxr-xr-x | updatekernel.sh | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/updatekernel.sh b/updatekernel.sh new file mode 100755 index 0000000..ac2b579 --- /dev/null +++ b/updatekernel.sh @@ -0,0 +1,50 @@ +#!/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 |
