├── .gitignore ├── LICENSE ├── README.md └── ukupgrade /.gitignore: -------------------------------------------------------------------------------- 1 | *~ 2 | .DS_Store -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2020 Mustafa Hastürk 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ukupgrade 2 | ========= 3 | 4 | Linux Logo 5 | 6 | 7 | Stands for "*Ubuntu Kernel Upgrade*" 8 | 9 | ## Why? 10 | It provides us to upgrade linux kernel to latest version for Ubuntu/Mint and derivatives. Based on [this archive](http://kernel.ubuntu.com/~kernel-ppa/mainline/) 11 | 12 | ----------------------------------------- 13 | 14 | ## 😳 Help Wanted! 15 | I do not have enough time to resolve [issues](https://github.com/muhasturk/ukupgrade/issues). PR's are welcome. 16 | 17 | ## 🔥 Usage 18 | 19 | * Download latest script 20 | ``` 21 | curl https://raw.githubusercontent.com/muhasturk/ukupgrade/master/ukupgrade > ukupgrade 22 | ``` 23 | 24 | * Give executable permission 25 | ``` 26 | chmod +x ./ukupgrade 27 | ``` 28 | 29 | * Call the script 30 | ``` 31 | ./ukupgrade 32 | ``` 33 | 34 | #### Shell Commannd 35 | 36 | * Run 37 | ``` 38 | sudo cp ./ukupgrade /usr/bin/do-kernel-upgrade 39 | ``` 40 | * Now you can call the script whereever you are 41 | ``` 42 | do-kernel-upgrade 43 | ``` 44 | 45 | ## 👨🏻‍💻 Author 46 | [Mustafa Hasturk](https://www.linkedin.com/in/muhasturk) 47 | mustafa[at]hasturk.dev 48 | 49 | ## ❤️ Contributing 50 | Bug reports and pull requests are welcome. 51 | [Thank you](https://github.com/muhasturk/ukupgrade/graphs/contributors) 52 | 53 | ## 👮🏻‍♂️ License 54 | 55 | ukupgrade is released under the MIT license. See [LICENSE](https://github.com/muhasturk/ukupgrade/blob/master/LICENSE) for more information. 56 | 57 | -------------------------------------------------------------------------------- /ukupgrade: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # @author Mustafa Hasturk 4 | # @mail hi [at] mustafahasturk [dot] com 5 | # @link https://github.com/muhasturk/ukupgrade 6 | # 7 | # v2.0: Allan Brazute - ethraza [at] gmail [dot] com 8 | 9 | kernelMirror="https://kernel.ubuntu.com/~kernel-ppa/mainline/" 10 | 11 | echo 12 | echo "Ubuntu Kernel Upgrade" 13 | echo 14 | 15 | cd /tmp 16 | 17 | if ! which lynx > /dev/null; then sudo apt-get install lynx -y; fi 18 | 19 | if [ "$(getconf LONG_BIT)" == "64" ]; then arch=amd64; else arch=i386; fi 20 | 21 | function download() { 22 | wget $(lynx -dump -listonly -dont-wrap-pre $kernelURL | grep "$1" | grep "$2" | grep "$arch" | cut -d ' ' -f 4) 23 | checkdownload=`echo $?` 24 | if [ "$checkdownload" == "1" ]; then echo "Download failed!"; rm -f linux*.deb; exit; fi 25 | } 26 | 27 | # Kernel URL 28 | echo "Fetching latest versions information..." 29 | ltv=$(lynx -dump -nonumbers $kernelMirror | grep -v rc | tail -1 | cut -d "/" -f6) 30 | ltvd=$(lynx -dump -nonumbers $kernelMirror$ltv | grep $arch | tail -1 | cut -d "_" -f2) 31 | rcv=$(lynx -dump -nonumbers $kernelMirror | tail -1 | cut -d "/" -f6) 32 | rcvd=$(lynx -dump -nonumbers $kernelMirror$rcv | grep $arch | tail -1 | cut -d "_" -f2) 33 | echo "************************************" 34 | echo "* Stable: $ltvd" 35 | echo "* RC: $rcvd" 36 | echo "* Using: $(uname -rv | cut -d" " -f1,2)" 37 | echo "************************************" 38 | echo 39 | read -p "Do you want the latest Release Candidate (RC) kernel? (y/n): " -n 1 -s rc 40 | case "$rc" in 41 | y | Y) echo "$rc - Release Candidate"; kernelVersion="$rcv" ;; 42 | n | N) echo "$rc - Stable"; kernelVersion=$ltv ;; 43 | *) echo "Leaving..."; exit ;; 44 | esac 45 | kernelURL="$kernelMirror$kernelVersion" 46 | 47 | read -p "Do you want the Low Latency kernel? (y/n): " -n 1 -s km 48 | case "$km" in 49 | y | Y) echo "$km - Low Latency"; kernelMode="lowlatency" ;; 50 | n | n) echo "$km - Generic"; kernelMode="generic" ;; 51 | *) echo "Leaving..."; exit ;; 52 | esac 53 | 54 | read -p "Ready to download and install kernel $kernelVersion $kernelMode? (y/n): " -n 1 -s km 55 | case "$km" in 56 | y | Y) echo "Go Go Go..." ;; 57 | *) echo "Leaving..."; exit ;; 58 | esac 59 | 60 | # Download Kernel 61 | echo 62 | echo "Downloading the latest $kernelVersion $kernelMode kernel image..." 63 | download $kernelMode image 64 | echo 65 | echo "Downloading the latest $kernelVersion $kernelMode kernel header..." 66 | download $kernelMode header 67 | echo 68 | echo "Downloading the latest $kernelVersion $kernelMode kernel modules..." 69 | download $kernelMode modules 70 | echo 71 | echo "Downloading the shared $kernelVersion $kernelMode kernel header..." 72 | wget $(lynx -dump -listonly -dont-wrap-pre $kernelURL | grep all | cut -d ' ' -f 4 | uniq) 73 | checkdownload=`echo $?` 74 | if [ "$checkdownload" == "1" ]; then echo "Download failed!"; rm -f linux*.deb; exit; fi 75 | 76 | # Install Kernel 77 | echo 78 | echo "Installing Linux Kernel..." 79 | sudo dpkg -i linux*.deb 80 | 81 | echo 82 | read -p "Done. Should we reboot the machine now? (y/n): " -n 1 -s rb 83 | case "$rb" in 84 | y | Y) echo "$rb - Rebooting"; rm -f linux*.deb; sudo reboot ;; 85 | *) echo "$rb - Do not forget to reboot to start using the latest kernel" ;; 86 | esac 87 | 88 | rm -f linux*.deb 89 | --------------------------------------------------------------------------------