summaryrefslogtreecommitdiff
path: root/bin/updatekernel.sh
diff options
context:
space:
mode:
authorHorus32014-03-08 19:58:06 +0100
committerHorus32014-03-08 19:58:06 +0100
commit9f4b3494700eeb2061dfd840e8d030f66088b173 (patch)
tree248d041cb87ddb2debd2b926e2d095144a719b80 /bin/updatekernel.sh
parent2c0e3234808dccbd7c622be7c4250ea405f3e166 (diff)
downloaddotfiles-9f4b3494700eeb2061dfd840e8d030f66088b173.tar.gz
structure
Diffstat (limited to 'bin/updatekernel.sh')
-rwxr-xr-xbin/updatekernel.sh50
1 files changed, 50 insertions, 0 deletions
diff --git a/bin/updatekernel.sh b/bin/updatekernel.sh
new file mode 100755
index 0000000..ac2b579
--- /dev/null
+++ b/bin/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