kernel-updt.sh 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. #!/bin/bash
  2. red='\e[1;31m'
  3. green='\e[0;32m'
  4. NC='\e[0m'
  5. clear
  6. source /etc/os-release
  7. OS=$ID
  8. # Memulai Update Kernel
  9. echo "Start Updating Kernel"
  10. # Ubuntu Version
  11. if [[ $OS == 'ubuntu' ]]; then
  12. wget https://raw.githubusercontent.com/pimlie/ubuntu-mainline-kernel.sh/master/ubuntu-mainline-kernel.sh
  13. install ubuntu-mainline-kernel.sh /usr/local/bin/
  14. rm -f ubuntu-mainline-kernel.sh
  15. ubuntu-mainline-kernel.sh -c
  16. # Checking Version
  17. if [ $ver == $now ]; then
  18. echo "Your Kernel Is The Latest Version"A
  19. rm -f /usr/bin/ubuntu-mainline-kernel.sh
  20. exit 0
  21. else
  22. printf "y" | ubuntu-mainline-kernel.sh -i
  23. rm -f /usr/bin/ubuntu-mainline-kernel.sh
  24. fi
  25. # Debian Version
  26. elif [[ $OS == "debian" ]]; then
  27. ver=(`apt-cache search linux-image | grep "^linux-image" | cut -d'-' -f 3-4 |tail -n1`)
  28. now=$(uname -r | cut -d "-" -f 1-2)
  29. # Checking Kernel
  30. if [ $ver == $now ]; then
  31. echo "Your Kernel Is The Latest Version"
  32. exit 0
  33. else
  34. apt install linux-image-$ver-amd64
  35. fi
  36. # Other OS Check
  37. elif [[ $OS == "centos" ]]; then
  38. echo "Not Supported For Centos!"
  39. exit 1
  40. elif [[ $OS == "fedora" ]]; then
  41. echo "Not Supported For Fedora"
  42. exit 1
  43. else
  44. echo "Your OS Not Support"
  45. exit 1
  46. fi
  47. # Done
  48. echo "Your VPS Will Be Reboot In 5s"
  49. sleep 5
  50. reboot