|
View:
New views
1 Messages
—
Rating Filter:
Alert me
|
|
|
shell glue for configuration of bgimage, colors, superusers, and passwords via /etc/default/grubhi!
i'm sorry but i'm not sure what files in my /etc/grub.d/ are distribution-specific, so (some (parts) of) these might be specific. i guess it might still help for some copy+paste. it's nothing special anyway, i'm just submitting this here because obviously nobody else has done so yet and it might have the potential to save somebody some typing work. :) you can find all the new variable names for /etc/default/grub at the end of the grub-mkconfig diff (last diff). what should be noted is that $ in md5 crypt strings (GRUB_PASSWORD_*) have to be escaped with a \. to add the superusers with passwords from /etc/default/grub: ----- snip ----- --- /etc/grub.d.orig/00_header 2009-11-02 19:44:07.000000000 +0100 +++ /etc/grub.d/00_header 2009-11-02 19:21:03.000000000 +0100 @@ -39,6 +39,18 @@ cat << EOF set default=${GRUB_DEFAULT} EOF +if [ "x${GRUB_SUPERUSERS}" != "x" ] ; then + cat << EOF +set superusers="${GRUB_SUPERUSERS}" +EOF + for i in ${GRUB_SUPERUSERS}; do + eval "GRUB_PASSWORD=\$GRUB_PASSWORD_$i" + cat << EOF +password ${i} ${GRUB_PASSWORD} +EOF + done +fi + case ${GRUB_TERMINAL_INPUT}:${GRUB_TERMINAL_OUTPUT} in serial:* | *:serial) if ! test -e ${grub_prefix}/serial.mod ; then ----- snap ----- to use image and color config from /etc/default/grub: ----- snip ----- --- /etc/grub.d.orig/05_debian_theme 2009-09-28 18:47:32.000000000 +0200 +++ /etc/grub.d/05_debian_theme 2009-09-28 20:22:17.000000000 +0200 @@ -5,30 +5,46 @@ source /usr/lib/grub/grub-mkconfig_lib set_blue_theme() { cat << EOF -set menu_color_normal=cyan/blue -set menu_color_highlight=white/blue +set menu_color_normal=$GRUB_MENU_COLOR_NORMAL +set menu_color_highlight=$GRUB_MENU_COLOR_HIGHLIGHT EOF } +# set menu colors if unset +if test -z "$GRUB_MENU_COLOR_NORMAL"; then + GRUB_MENU_COLOR_NORMAL="cyan/blue" +fi +if test -z "$GRUB_MENU_COLOR_HIGHLIGHT"; then + GRUB_MENU_COLOR_HIGHLIGHT="white/blue" +fi +if test -z "$GRUB_COLOR_NORMAL"; then + GRUB_COLOR_NORMAL="black/black" +fi +if test -z "$GRUB_COLOR_HIGHLIGHT"; then + GRUB_COLOR_HIGHLIGHT="magenta/black" +fi + # check for usable backgrounds use_bg=false -if [ "$GRUB_TERMINAL_OUTPUT" = "gfxterm" ] ; then - for i in {/boot/grub,/usr/share/images/desktop-base}/moreblue-orbit-grub.{png,tga} ; do - if is_path_readable_by_grub $i ; then - bg=$i - case ${bg} in - *.png) reader=png ;; - *.tga) reader=tga ;; - *.jpg|*.jpeg) reader=jpeg ;; - esac - if test -e /boot/grub/${reader}.mod ; then - echo "Found Debian background: `basename ${bg}`" >&2 - use_bg=true - break +for f in $GRUB_BACKGROUND_IMAGE moreblue-orbit-grub; do + if [ "$GRUB_TERMINAL_OUTPUT" = "gfxterm" ] ; then + for i in {/boot/grub,/usr/share/images/desktop-base}/$f.{png,tga} ; do + if is_path_readable_by_grub $i ; then + bg=$i + case ${bg} in + *.png) reader=png ;; + *.tga) reader=tga ;; + *.jpg|*.jpeg) reader=jpeg ;; + esac + if test -e /boot/grub/${reader}.mod ; then + echo "Found Debian background: `basename ${bg}`" >&2 + use_bg=true + break 2 + fi fi - fi - done -fi + done + fi +done # set the background if possible if ${use_bg} ; then @@ -36,8 +52,8 @@ if ${use_bg} ; then cat << EOF insmod ${reader} if background_image `make_system_path_relative_to_its_root ${bg}` ; then - set color_normal=black/black - set color_highlight=magenta/black + set color_normal=$GRUB_COLOR_NORMAL + set color_highlight=$GRUB_COLOR_HIGHLIGHT else EOF fi ----- snap ----- to make all of the above work with grub-mkconfig: ----- snip ----- --- /usr/sbin/grub-mkconfig.orig 2009-09-28 18:40:53.000000000 +0200 +++ /usr/sbin/grub-mkconfig 2009-11-02 19:14:08.000000000 +0100 @@ -224,7 +224,16 @@ export GRUB_DEFAULT \ GRUB_DISABLE_LINUX_UUID \ GRUB_DISABLE_LINUX_RECOVERY \ GRUB_GFXMODE \ - GRUB_DISABLE_OS_PROBER + GRUB_BACKGROUND_IMAGE \ + GRUB_COLOR_NORMAL \ + GRUB_COLOR_HIGHLIGHT \ + GRUB_MENU_COLOR_NORMAL \ + GRUB_MENU_COLOR_HIGHLIGHT \ + GRUB_DISABLE_OS_PROBER \ + GRUB_SUPERUSERS +for i in ${GRUB_SUPERUSERS}; do + export GRUB_PASSWORD_$i +done if test "x${grub_cfg}" != "x"; then rm -f ${grub_cfg}.new ----- snap ----- i don't quite understand the color syntax. i didn't manage yet e.g. to set the text foreground color without a text background color (to prevent wiping the background image with the text background color)... hints very welcome. regards, Chris _______________________________________________ Bug-grub mailing list Bug-grub@... http://lists.gnu.org/mailman/listinfo/bug-grub |
| Free embeddable forum powered by Nabble | Forum Help |