daily pastebin goal
3%
SHARE
TWEET

dan

a guest Aug 20th, 2010 28 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #!/bin/bash -e
  2.  
  3. source /usr/lib/grub/grub-mkconfig_lib
  4.  
  5. # this allows desktop-base to override our settings
  6. f=/usr/share/desktop-base/grub_background.sh
  7. if test -e ${f} ; then
  8.   source ${f}
  9. else
  10.   WALLPAPER="/usr/share/images/desktop-base/moreblue-orbit-grub.png"
  11.   COLOR_NORMAL="black/black"
  12.   COLOR_HIGHLIGHT="magenta/black"
  13. fi
  14.  
  15. set_mono_theme()
  16. {
  17.   cat << EOF
  18. set menu_color_normal=white/black
  19. set menu_color_highlight=black/light-gray
  20. EOF
  21. }
  22.  
  23. # check for usable backgrounds
  24. use_bg=false
  25. if [ "$GRUB_TERMINAL_OUTPUT" = "gfxterm" ] ; then
  26.   for i in /boot/grub/`basename ${WALLPAPER}` ${WALLPAPER} ; do
  27.     if is_path_readable_by_grub $i ; then
  28.       bg=$i
  29.       case ${bg} in
  30.         *.png)          reader=png ;;
  31.         *.tga)          reader=tga ;;
  32.         *.jpg|*.jpeg)   reader=jpeg ;;
  33.       esac
  34.       if test -e /boot/grub/${reader}.mod ; then
  35.         echo "Found background image: `basename ${bg}`" >&2
  36.         use_bg=true
  37.         break
  38.       fi
  39.     fi
  40.   done
  41. fi
  42.  
  43. # set the background if possible
  44. if ${use_bg} ; then
  45.   prepare_grub_to_access_device `${grub_probe} --target=device ${bg}`
  46.   cat << EOF
  47. insmod ${reader}
  48. if background_image `make_system_path_relative_to_its_root ${bg}` ; then
  49.   set color_normal=${COLOR_NORMAL}
  50.   set color_highlight=${COLOR_HIGHLIGHT}
  51. else
  52. EOF
  53. fi
  54.  
  55. # otherwise, set a monochromatic theme for Ubuntu
  56. if ${use_bg} ; then
  57.   set_mono_theme | sed -e "s/^/  /g"
  58.   echo "fi"
  59. else
  60.   set_mono_theme
  61. fi
RAW Paste Data
Top