Script to download the latest linux kernel

Here is a script that will download the latest kernel source kernel.org. THe script works on the current html page of kernel.org and might break if anything is changed in the page of kernel.org.

latest_kernel:

#!/bin/bash latest_kernel () { latest_link=$(grep -A 1 “latest_link” page | tail -1 | cut -d “\”” -f 2 | cut -d “.” -f 2-) prefix=https://www.kernel.org link=$prefix$latest_link for((i=0;i] 17,430 27.8K/s in 0.6s 2013-08-01 22:23:20 (27.8 KB/s) – “page” saved [17430/17430] FINISHED –2013-08-01 22:23:20– Downloaded: 1 files, 17K in 0.6s (27.8 KB/s) downloading from https://www.kernel.org/pub/linux/kernel/v3.x/linux-3.10.4.tar.xz –2013-08-01 22:23:20– https://www.kernel.org/pub/linux/kernel/v3.x/linux-3.10.4.tar.xz Resolving www.kernel.org… 149.20.4.69, 198.145.20.140 Connecting to www.kernel.org|149.20.4.69|:443… connected. HTTP request sent, awaiting response… 200 OK Length: 73187712 (70M) [application/x-xz] Saving to: “linux-3.10.4.tar.xz” 100%[===================================================================================>] 73,187,712 97.3K/s in 11m 18s 2013-08-01 22:34:40 (105 KB/s) – “linux-3.10.4.tar.xz” saved [73187712/73187712] Download complete

Thus we can see from the ouput that the latest kernel 3.10.4 has been downloaded. In case the download gets interrupted then the script will retry the download 3 times before quitting with the message of “Download Failed”.


Tags: , ,
Copyright 2017. All rights reserved.

Posted August 1, 2013 by Tux Think in category "Linux