Guest User

grub smart configuration

a guest
Oct 4th, 2022
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 1.06 KB | None | 0 0
  1. #! /bin/bash
  2. #  https://www.gnu.org/software/grub/manual/grub/html_node/Simple-configuration.html
  3.  
  4.  
  5. GRUB_DISTRIBUTOR="$(
  6.     lsb_release --id --short 2> /dev/null |
  7.     sed --expression="s|Linux||g"
  8. )"
  9.  
  10.  
  11. MULTIPLE_OSES="$(
  12.     if [[ -f "/usr/bin/os-prober" ]] && [[ -n "$(os-prober 2>/dev/null)" ]]; then
  13.         echo x
  14.     fi
  15. )"
  16.  
  17.  
  18. GRUB_DISABLE_OS_PROBER="$(
  19.     if [[ -n "${MULTIPLE_OSES}" ]]; then
  20.         echo "false"
  21.     else
  22.         echo "true"
  23.     fi
  24. )"
  25.  
  26.  
  27. GRUB_TIMEOUT_STYLE="$(
  28.     if [[ -n "${MULTIPLE_OSES}" ]]; then
  29.         echo "menu"
  30.     else
  31.         echo "hidden"
  32.     fi
  33. )"
  34.  
  35.  
  36. GRUB_TIMEOUT="$(
  37.     if [[ -n "${MULTIPLE_OSES}" ]]; then
  38.         echo "20"
  39.     else
  40.         echo "0"
  41.     fi
  42. )"
  43.  
  44.  
  45. GRUB_CMDLINE_LINUX_DEFAULT="$(
  46.     if [[ -f "/usr/bin/plymouth" ]]; then
  47.         printf "splash "
  48.     fi
  49.  
  50.     echo "quiet loglevel=3 systemd.show_status=auto"
  51. )"
  52.  
  53.  
  54. GRUB_ENABLE_CRYPTODISK="$(
  55.     if lsblk --fs | grep --quiet "crypto_LUKS"; then
  56.         echo "y"
  57.     else
  58.         echo "n"
  59.     fi
  60. )"
  61.  
  62.  
  63. GRUB_GFXMODE=640x480
  64. GRUB_PRELOAD_MODULES="part_gpt part_msdos"
  65.  
  66. GRUB_SAVEDEFAULT=true
  67. GRUB_DEFAULT=saved
  68. GRUB_DISABLE_RECOVERY=true
  69.  
  70.  
Advertisement
Add Comment
Please, Sign In to add comment