All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Call background_image after terminal_output gfxterm
@ 2010-07-05 15:24 Colin Watson
  2010-07-05 17:03 ` Colin Watson
  0 siblings, 1 reply; 3+ messages in thread
From: Colin Watson @ 2010-07-05 15:24 UTC (permalink / raw)
  To: grub-devel

GRUB_BACKGROUND doesn't work right now, as background_image only works
after 'terminal_output gfxterm' has been called.

I looked at lifting that restriction, but it seemed moderately complex
to do so and it wasn't clear what the semantics ought to be if you tear
down gfxterm and re-initialise it (would we need to have a new option to
background_image to delete the cached bitmap or something?); and after
all background_image is documented as loading the background image for
the *active* terminal, not for some future terminal.

Instead of all that, it seems best to just arrange not to run
background_image until gfxterm has been set as the active output
terminal.  This patch does that.  It means that several commands are now
unconditional at run-time when they were previously conditional on
loadfont succeeding, but I think that's OK; none of those commands will
result in different behaviour unless gfxterm is the active output
terminal anyway.

2010-07-05  Colin Watson  <cjwatson@ubuntu.com>

	* util/grub.d/00_header.in: Process GRUB_THEME and GRUB_BACKGROUND
	after setting gfxterm as the active terminal.  GRUB_BACKGROUND
	doesn't work otherwise.

=== modified file 'util/grub.d/00_header.in'
--- util/grub.d/00_header.in	2010-06-29 15:20:49 +0000
+++ util/grub.d/00_header.in	2010-07-05 15:15:51 +0000
@@ -127,40 +127,74 @@ if loadfont `make_system_path_relative_t
   set gfxmode=${GRUB_GFXMODE}
   load_video
   insmod gfxterm
+fi
 EOF
+fi
+
+case x${GRUB_TERMINAL_INPUT} in
+  x)
+    # Just use the native terminal
+  ;;
+  x*)
+    cat << EOF
+if terminal_input ${GRUB_TERMINAL_INPUT} ; then true ; else
+  # For backward compatibility with versions of terminal.mod that don't
+  # understand terminal_input
+  terminal ${GRUB_TERMINAL_INPUT}
+fi
+EOF
+  ;;
+esac
+
+case x${GRUB_TERMINAL_OUTPUT} in
+  x)
+    # Just use the native terminal
+  ;;
+  x*)
+    cat << EOF
+if terminal_output ${GRUB_TERMINAL_OUTPUT} ; then true ; else
+  # For backward compatibility with versions of terminal.mod that don't
+  # understand terminal_output
+  terminal ${GRUB_TERMINAL_OUTPUT}
+fi
+EOF
+  ;;
+esac
+
+if [ "x$gfxterm" = x1 ]; then
     if [ "x$GRUB_THEME" != x ] && [ -f "$GRUB_THEME" ] \
 	&& is_path_readable_by_grub "$GRUB_THEME"; then
 	echo "Found theme: $GRUB_THEME" >&2
 	prepare_grub_to_access_device `${grub_probe} --target=device "$GRUB_THEME"` | sed -e "s/^/  /"
 	cat << EOF
-  insmod gfxmenu
+insmod gfxmenu
 EOF
 	themedir="`dirname "$GRUB_THEME"`"
 	for x in "$themedir"/*.pf2 "$themedir"/f/*.pf2; do
 	    if [ -f "$x" ]; then
 		cat << EOF
-  loadfont (\$root)`make_system_path_relative_to_its_root $x`
+loadfont (\$root)`make_system_path_relative_to_its_root $x`
 EOF
 	    fi
 	done
 	if [ x"`echo "$themedir"/*.jpg`" != x"$themedir/*.jpg" ] || [ x"`echo "$themedir"/*.jpeg`" != x"$themedir/*.jpeg" ]; then
 	    cat << EOF
-  insmod jpeg
+insmod jpeg
 EOF
 	fi
 	if [ x"`echo "$themedir"/*.png`" != x"$themedir/*.png" ]; then
 	    cat << EOF
-  insmod png
+insmod png
 EOF
 	fi
 	if [ x"`echo "$themedir"/*.tga`" != x"$themedir/*.tga" ]; then
 	    cat << EOF
-  insmod tga
+insmod tga
 EOF
 	fi
 	    
 	cat << EOF
-  set theme=(\$root)`make_system_path_relative_to_its_root $GRUB_THEME`
+set theme=(\$root)`make_system_path_relative_to_its_root $GRUB_THEME`
 EOF
     elif [ "x$GRUB_BACKGROUND" != x ] && [ -f "$GRUB_BACKGROUND" ] \
 	    && is_path_readable_by_grub "$GRUB_BACKGROUND"; then
@@ -173,45 +207,12 @@ EOF
 	esac
 	prepare_grub_to_access_device `${grub_probe} --target=device "$GRUB_BACKGROUND"` | sed -e "s/^/  /"
 	cat << EOF
-  insmod $reader
-  background_image -m stretch `make_system_path_relative_to_its_root "$GRUB_BACKGROUND"`
+insmod $reader
+background_image -m stretch `make_system_path_relative_to_its_root "$GRUB_BACKGROUND"`
 EOF
     fi
-    cat << EOF
-fi
-EOF
 fi
 
-case x${GRUB_TERMINAL_INPUT} in
-  x)
-    # Just use the native terminal
-  ;;
-  x*)
-    cat << EOF
-if terminal_input ${GRUB_TERMINAL_INPUT} ; then true ; else
-  # For backward compatibility with versions of terminal.mod that don't
-  # understand terminal_input
-  terminal ${GRUB_TERMINAL_INPUT}
-fi
-EOF
-  ;;
-esac
-
-case x${GRUB_TERMINAL_OUTPUT} in
-  x)
-    # Just use the native terminal
-  ;;
-  x*)
-    cat << EOF
-if terminal_output ${GRUB_TERMINAL_OUTPUT} ; then true ; else
-  # For backward compatibility with versions of terminal.mod that don't
-  # understand terminal_output
-  terminal ${GRUB_TERMINAL_OUTPUT}
-fi
-EOF
-  ;;
-esac
-
 # Gettext variables and module
 if [ "x${LANG}" != "xC" ] && [ -d "${locale_dir}" ] ; then
     prepare_grub_to_access_device $(${grub_probe} --target=device ${locale_dir})

-- 
Colin Watson                                       [cjwatson@ubuntu.com]


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] Call background_image after terminal_output gfxterm
  2010-07-05 15:24 [PATCH] Call background_image after terminal_output gfxterm Colin Watson
@ 2010-07-05 17:03 ` Colin Watson
  2010-07-06  0:02   ` Vladimir 'φ-coder/phcoder' Serbinenko
  0 siblings, 1 reply; 3+ messages in thread
From: Colin Watson @ 2010-07-05 17:03 UTC (permalink / raw)
  To: grub-devel

On Mon, Jul 05, 2010 at 04:24:44PM +0100, Colin Watson wrote:
> 2010-07-05  Colin Watson  <cjwatson@ubuntu.com>
> 
> 	* util/grub.d/00_header.in: Process GRUB_THEME and GRUB_BACKGROUND
> 	after setting gfxterm as the active terminal.  GRUB_BACKGROUND
> 	doesn't work otherwise.

Slight tweak to fix output indentation.

=== modified file 'util/grub.d/00_header.in'
--- util/grub.d/00_header.in	2010-06-29 15:20:49 +0000
+++ util/grub.d/00_header.in	2010-07-05 16:57:28 +0000
@@ -127,40 +127,74 @@ if loadfont `make_system_path_relative_t
   set gfxmode=${GRUB_GFXMODE}
   load_video
   insmod gfxterm
+fi
 EOF
+fi
+
+case x${GRUB_TERMINAL_INPUT} in
+  x)
+    # Just use the native terminal
+  ;;
+  x*)
+    cat << EOF
+if terminal_input ${GRUB_TERMINAL_INPUT} ; then true ; else
+  # For backward compatibility with versions of terminal.mod that don't
+  # understand terminal_input
+  terminal ${GRUB_TERMINAL_INPUT}
+fi
+EOF
+  ;;
+esac
+
+case x${GRUB_TERMINAL_OUTPUT} in
+  x)
+    # Just use the native terminal
+  ;;
+  x*)
+    cat << EOF
+if terminal_output ${GRUB_TERMINAL_OUTPUT} ; then true ; else
+  # For backward compatibility with versions of terminal.mod that don't
+  # understand terminal_output
+  terminal ${GRUB_TERMINAL_OUTPUT}
+fi
+EOF
+  ;;
+esac
+
+if [ "x$gfxterm" = x1 ]; then
     if [ "x$GRUB_THEME" != x ] && [ -f "$GRUB_THEME" ] \
 	&& is_path_readable_by_grub "$GRUB_THEME"; then
 	echo "Found theme: $GRUB_THEME" >&2
-	prepare_grub_to_access_device `${grub_probe} --target=device "$GRUB_THEME"` | sed -e "s/^/  /"
+	prepare_grub_to_access_device `${grub_probe} --target=device "$GRUB_THEME"`
 	cat << EOF
-  insmod gfxmenu
+insmod gfxmenu
 EOF
 	themedir="`dirname "$GRUB_THEME"`"
 	for x in "$themedir"/*.pf2 "$themedir"/f/*.pf2; do
 	    if [ -f "$x" ]; then
 		cat << EOF
-  loadfont (\$root)`make_system_path_relative_to_its_root $x`
+loadfont (\$root)`make_system_path_relative_to_its_root $x`
 EOF
 	    fi
 	done
 	if [ x"`echo "$themedir"/*.jpg`" != x"$themedir/*.jpg" ] || [ x"`echo "$themedir"/*.jpeg`" != x"$themedir/*.jpeg" ]; then
 	    cat << EOF
-  insmod jpeg
+insmod jpeg
 EOF
 	fi
 	if [ x"`echo "$themedir"/*.png`" != x"$themedir/*.png" ]; then
 	    cat << EOF
-  insmod png
+insmod png
 EOF
 	fi
 	if [ x"`echo "$themedir"/*.tga`" != x"$themedir/*.tga" ]; then
 	    cat << EOF
-  insmod tga
+insmod tga
 EOF
 	fi
 	    
 	cat << EOF
-  set theme=(\$root)`make_system_path_relative_to_its_root $GRUB_THEME`
+set theme=(\$root)`make_system_path_relative_to_its_root $GRUB_THEME`
 EOF
     elif [ "x$GRUB_BACKGROUND" != x ] && [ -f "$GRUB_BACKGROUND" ] \
 	    && is_path_readable_by_grub "$GRUB_BACKGROUND"; then
@@ -171,47 +205,14 @@ EOF
 	    *.jpg|*.jpeg)  reader=jpeg ;;
 	    *)             echo "Unsupported image format" >&2; exit 1 ;;
 	esac
-	prepare_grub_to_access_device `${grub_probe} --target=device "$GRUB_BACKGROUND"` | sed -e "s/^/  /"
+	prepare_grub_to_access_device `${grub_probe} --target=device "$GRUB_BACKGROUND"`
 	cat << EOF
-  insmod $reader
-  background_image -m stretch `make_system_path_relative_to_its_root "$GRUB_BACKGROUND"`
+insmod $reader
+background_image -m stretch `make_system_path_relative_to_its_root "$GRUB_BACKGROUND"`
 EOF
     fi
-    cat << EOF
-fi
-EOF
 fi
 
-case x${GRUB_TERMINAL_INPUT} in
-  x)
-    # Just use the native terminal
-  ;;
-  x*)
-    cat << EOF
-if terminal_input ${GRUB_TERMINAL_INPUT} ; then true ; else
-  # For backward compatibility with versions of terminal.mod that don't
-  # understand terminal_input
-  terminal ${GRUB_TERMINAL_INPUT}
-fi
-EOF
-  ;;
-esac
-
-case x${GRUB_TERMINAL_OUTPUT} in
-  x)
-    # Just use the native terminal
-  ;;
-  x*)
-    cat << EOF
-if terminal_output ${GRUB_TERMINAL_OUTPUT} ; then true ; else
-  # For backward compatibility with versions of terminal.mod that don't
-  # understand terminal_output
-  terminal ${GRUB_TERMINAL_OUTPUT}
-fi
-EOF
-  ;;
-esac
-
 # Gettext variables and module
 if [ "x${LANG}" != "xC" ] && [ -d "${locale_dir}" ] ; then
     prepare_grub_to_access_device $(${grub_probe} --target=device ${locale_dir})

-- 
Colin Watson                                       [cjwatson@ubuntu.com]


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] Call background_image after terminal_output gfxterm
  2010-07-05 17:03 ` Colin Watson
@ 2010-07-06  0:02   ` Vladimir 'φ-coder/phcoder' Serbinenko
  0 siblings, 0 replies; 3+ messages in thread
From: Vladimir 'φ-coder/phcoder' Serbinenko @ 2010-07-06  0:02 UTC (permalink / raw)
  To: grub-devel

[-- Attachment #1: Type: text/plain, Size: 4677 bytes --]

On 07/05/2010 07:03 PM, Colin Watson wrote:
> On Mon, Jul 05, 2010 at 04:24:44PM +0100, Colin Watson wrote:
>   
>> 2010-07-05  Colin Watson  <cjwatson@ubuntu.com>
>>
>> 	* util/grub.d/00_header.in: Process GRUB_THEME and GRUB_BACKGROUND
>> 	after setting gfxterm as the active terminal.  GRUB_BACKGROUND
>> 	doesn't work otherwise.
>>     
> Slight tweak to fix output indentation.
>
>   
Go ahead for mainline.
> === modified file 'util/grub.d/00_header.in'
> --- util/grub.d/00_header.in	2010-06-29 15:20:49 +0000
> +++ util/grub.d/00_header.in	2010-07-05 16:57:28 +0000
> @@ -127,40 +127,74 @@ if loadfont `make_system_path_relative_t
>    set gfxmode=${GRUB_GFXMODE}
>    load_video
>    insmod gfxterm
> +fi
>  EOF
> +fi
> +
> +case x${GRUB_TERMINAL_INPUT} in
> +  x)
> +    # Just use the native terminal
> +  ;;
> +  x*)
> +    cat << EOF
> +if terminal_input ${GRUB_TERMINAL_INPUT} ; then true ; else
> +  # For backward compatibility with versions of terminal.mod that don't
> +  # understand terminal_input
> +  terminal ${GRUB_TERMINAL_INPUT}
> +fi
> +EOF
> +  ;;
> +esac
> +
> +case x${GRUB_TERMINAL_OUTPUT} in
> +  x)
> +    # Just use the native terminal
> +  ;;
> +  x*)
> +    cat << EOF
> +if terminal_output ${GRUB_TERMINAL_OUTPUT} ; then true ; else
> +  # For backward compatibility with versions of terminal.mod that don't
> +  # understand terminal_output
> +  terminal ${GRUB_TERMINAL_OUTPUT}
> +fi
> +EOF
> +  ;;
> +esac
> +
> +if [ "x$gfxterm" = x1 ]; then
>      if [ "x$GRUB_THEME" != x ] && [ -f "$GRUB_THEME" ] \
>  	&& is_path_readable_by_grub "$GRUB_THEME"; then
>  	echo "Found theme: $GRUB_THEME" >&2
> -	prepare_grub_to_access_device `${grub_probe} --target=device "$GRUB_THEME"` | sed -e "s/^/  /"
> +	prepare_grub_to_access_device `${grub_probe} --target=device "$GRUB_THEME"`
>  	cat << EOF
> -  insmod gfxmenu
> +insmod gfxmenu
>  EOF
>  	themedir="`dirname "$GRUB_THEME"`"
>  	for x in "$themedir"/*.pf2 "$themedir"/f/*.pf2; do
>  	    if [ -f "$x" ]; then
>  		cat << EOF
> -  loadfont (\$root)`make_system_path_relative_to_its_root $x`
> +loadfont (\$root)`make_system_path_relative_to_its_root $x`
>  EOF
>  	    fi
>  	done
>  	if [ x"`echo "$themedir"/*.jpg`" != x"$themedir/*.jpg" ] || [ x"`echo "$themedir"/*.jpeg`" != x"$themedir/*.jpeg" ]; then
>  	    cat << EOF
> -  insmod jpeg
> +insmod jpeg
>  EOF
>  	fi
>  	if [ x"`echo "$themedir"/*.png`" != x"$themedir/*.png" ]; then
>  	    cat << EOF
> -  insmod png
> +insmod png
>  EOF
>  	fi
>  	if [ x"`echo "$themedir"/*.tga`" != x"$themedir/*.tga" ]; then
>  	    cat << EOF
> -  insmod tga
> +insmod tga
>  EOF
>  	fi
>  	    
>  	cat << EOF
> -  set theme=(\$root)`make_system_path_relative_to_its_root $GRUB_THEME`
> +set theme=(\$root)`make_system_path_relative_to_its_root $GRUB_THEME`
>  EOF
>      elif [ "x$GRUB_BACKGROUND" != x ] && [ -f "$GRUB_BACKGROUND" ] \
>  	    && is_path_readable_by_grub "$GRUB_BACKGROUND"; then
> @@ -171,47 +205,14 @@ EOF
>  	    *.jpg|*.jpeg)  reader=jpeg ;;
>  	    *)             echo "Unsupported image format" >&2; exit 1 ;;
>  	esac
> -	prepare_grub_to_access_device `${grub_probe} --target=device "$GRUB_BACKGROUND"` | sed -e "s/^/  /"
> +	prepare_grub_to_access_device `${grub_probe} --target=device "$GRUB_BACKGROUND"`
>  	cat << EOF
> -  insmod $reader
> -  background_image -m stretch `make_system_path_relative_to_its_root "$GRUB_BACKGROUND"`
> +insmod $reader
> +background_image -m stretch `make_system_path_relative_to_its_root "$GRUB_BACKGROUND"`
>  EOF
>      fi
> -    cat << EOF
> -fi
> -EOF
>  fi
>  
> -case x${GRUB_TERMINAL_INPUT} in
> -  x)
> -    # Just use the native terminal
> -  ;;
> -  x*)
> -    cat << EOF
> -if terminal_input ${GRUB_TERMINAL_INPUT} ; then true ; else
> -  # For backward compatibility with versions of terminal.mod that don't
> -  # understand terminal_input
> -  terminal ${GRUB_TERMINAL_INPUT}
> -fi
> -EOF
> -  ;;
> -esac
> -
> -case x${GRUB_TERMINAL_OUTPUT} in
> -  x)
> -    # Just use the native terminal
> -  ;;
> -  x*)
> -    cat << EOF
> -if terminal_output ${GRUB_TERMINAL_OUTPUT} ; then true ; else
> -  # For backward compatibility with versions of terminal.mod that don't
> -  # understand terminal_output
> -  terminal ${GRUB_TERMINAL_OUTPUT}
> -fi
> -EOF
> -  ;;
> -esac
> -
>  # Gettext variables and module
>  if [ "x${LANG}" != "xC" ] && [ -d "${locale_dir}" ] ; then
>      prepare_grub_to_access_device $(${grub_probe} --target=device ${locale_dir})
>
>   


-- 
Regards
Vladimir 'φ-coder/phcoder' Serbinenko



[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 294 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2010-07-06  0:03 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-07-05 15:24 [PATCH] Call background_image after terminal_output gfxterm Colin Watson
2010-07-05 17:03 ` Colin Watson
2010-07-06  0:02   ` Vladimir 'φ-coder/phcoder' Serbinenko

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.