Hi,

I have a new set of patches only touch under debian/* ;-)

Now even plain Debian GRUB without desktop-base can be set as you wish.

These patch applied to stretch source is build ... too slow.

I am going to sleep ;-)  But sending updated patches anyway.

Regards,

Osamu
>From fd64f566670a8d27e60afc39a48344f68c78801f Mon Sep 17 00:00:00 2001
From: Osamu Aoki <os...@debian.org>
Date: Sun, 2 Jul 2017 22:35:46 +0900
Subject: [PATCH 1/2] Enable manual overrides of menu background image and
 colors

Manual setting of the GRUB background image used to be done by setting
${WALLPAPER}" "${COLOR_NORMAL}" "${COLOR_HIGHLIGHT} variables in
/etc/grub.d/05_debian_theme.

But these variable setting lines have been moved to
/usr/share/desktop-base/grub_background.sh which is provided by the
desktop-base package.  It is managed by the alternatives system and the pointed
file is not in /etc and isn't user editable file.  Adding extra lines to set
the GRUB background image in 05_debian_theme isn't an intuitive solution.

This changes caused bugs reported to grub2-splashimages:
 https://bugs.debian.org/613724
 https://bugs.debian.org/635545
 https://bugs.debian.org/673088

Adding alternatives may be a solution for images provided by
grub2-splashimages.  Even then, we still don't have an intuitive way to
manually set them.

We already had a not-so-advertised feature of ${GRUB_BACKGROUND} in
/etc/default/grub.  So I propose to make this feature more visible and extend
it to set menu colors.
---
 debian/default/grub           |  5 +++++
 debian/default/grub.md5sum    |  2 ++
 debian/grub.d/05_debian_theme | 27 +++++++++++++++++++++------
 3 files changed, 28 insertions(+), 6 deletions(-)

diff --git a/debian/default/grub b/debian/default/grub
index 7617f0131..5078972da 100644
--- a/debian/default/grub
+++ b/debian/default/grub
@@ -30,3 +30,8 @@ GRUB_CMDLINE_LINUX=""
 
 # Uncomment to get a beep at grub start
 #GRUB_INIT_TUNE="480 440 1"
+
+# Uncomment to override the GRUB background and menu color settings
+#GRUB_BACKGROUND="/full/path/to/image.{jpeg|jpg|png|tga}"
+#GRUB_COLOR_NORMAL="white/black"
+#GRUB_COLOR_HIGHLIGHT="black/white"
diff --git a/debian/default/grub.md5sum b/debian/default/grub.md5sum
index e8265dc68..b582a5fc5 100644
--- a/debian/default/grub.md5sum
+++ b/debian/default/grub.md5sum
@@ -1,3 +1,5 @@
 dfad90339e4227d432636ed7d4483744  experimental_1.96+20081129-1
 e916b60d7de71969dd7bad5a809fb9dc  lenny_1.96+20080724-16
 965e5137eff659cded3adb640357c33d  maverick_1.98+20100705-1ubuntu1
+b7d2e3ca5347d4be304223c2115d9127  stretch_2.02-1
+
diff --git a/debian/grub.d/05_debian_theme b/debian/grub.d/05_debian_theme
index 717258444..53f6d988e 100755
--- a/debian/grub.d/05_debian_theme
+++ b/debian/grub.d/05_debian_theme
@@ -27,6 +27,10 @@ test -d /boot/grub; cd /boot/grub
 # NOTE: This MUST BE A DOTFILE to avoid confusing it with user-defined images.
 BACKGROUND_CACHE=".background_cache"
 
+# Set the traditional Debian blue theme as default
+COLOR_NORMAL="cyan/blue"
+COLOR_HIGHLIGHT="white/blue"
+
 set_default_theme(){
 	case $GRUB_DISTRIBUTOR in
 		Tanglu|Ubuntu|Kubuntu)
@@ -45,8 +49,8 @@ set_default_theme(){
 			;;
 		*)
 			# Set the traditional Debian blue theme.
-			echo "${1}set menu_color_normal=cyan/blue"
-			echo "${1}set menu_color_highlight=white/blue"
+			echo "${1}set menu_color_normal=${COLOR_NORMAL}"
+			echo "${1}set menu_color_highlight=${COLOR_HIGHLIGHT}"
 			;;
 	esac
 }
@@ -161,17 +165,26 @@ fi
 # If so, try to use it. Don't try the other possibilities in that case
 # (#608263).
 if [ -n "${GRUB_BACKGROUND+x}" ]; then
-	set_background_image "${GRUB_BACKGROUND}" || set_default_theme
+	set_background_image "${GRUB_BACKGROUND}" "${GRUB_COLOR_NORMAL}" \
+		"${GRUB_COLOR_HIGHLIGHT}" || set_default_theme
 	exit 0
 fi
 
 # Next search for pictures the user put into /boot/grub/ and use the first one.
 for background in *.jpg *.JPG *.jpeg *.JPEG *.png *.PNG *.tga *.TGA; do
-	if set_background_image "${background}"; then
+	if set_background_image "${background}" "${GRUB_COLOR_NORMAL}" \
+		"${GRUB_COLOR_HIGHLIGHT}"; then
 		exit 0
 	fi
 done
 
+if [ -n "${GRUB_COLOR_NORMAL}" ]; then
+	COLOR_NORMAL="${GRUB_COLOR_NORMAL}"
+fi
+if [ -n "${GRUB_COLOR_HIGHLIGHT}" ]; then
+	COLOR_HIGHLIGHT="${GRUB_COLOR_HIGHLIGHT}"
+fi
+
 # Next try to use the background image and colors specified by desktop-base.
 if set_background_image "${WALLPAPER}" "${COLOR_NORMAL}" "${COLOR_HIGHLIGHT}"; then
 	exit 0
@@ -182,12 +195,14 @@ case $GRUB_DISTRIBUTOR in
 	Ubuntu|Kubuntu)
 		;;
 	Tanglu)
-		if set_background_image "/usr/share/images/grub/grub.png"; then
+		if set_background_image "/usr/share/images/grub/grub.png" \
+			"${COLOR_NORMAL}" "${COLOR_HIGHLIGHT}"; then
 			exit 0
 		fi
 		;;
 	*)
-		if set_background_image "/usr/share/images/desktop-base/desktop-grub.png"; then
+		if set_background_image "/usr/share/images/desktop-base/desktop-grub.png" \
+			"${COLOR_NORMAL}" "${COLOR_HIGHLIGHT}"; then
 			exit 0
 		fi
 		;;
-- 
2.11.0

>From 9535c107dc5fe3075a391436d26d5f8e5f68fd20 Mon Sep 17 00:00:00 2001
From: Osamu Aoki <os...@debian.org>
Date: Mon, 3 Jul 2017 23:15:02 +0900
Subject: [PATCH 2/2] export GRUB_COLOR_*

---
 ...xport-GRUB_COLOR_-to-enable-configuration.patch | 25 ++++++++++++++++++++++
 debian/patches/series                              |  1 +
 2 files changed, 26 insertions(+)
 create mode 100644 debian/patches/export-GRUB_COLOR_-to-enable-configuration.patch

diff --git a/debian/patches/export-GRUB_COLOR_-to-enable-configuration.patch b/debian/patches/export-GRUB_COLOR_-to-enable-configuration.patch
new file mode 100644
index 000000000..17f010619
--- /dev/null
+++ b/debian/patches/export-GRUB_COLOR_-to-enable-configuration.patch
@@ -0,0 +1,25 @@
+From 5f8d13b638ba482fc245d7b920f710bfdbfef5a9 Mon Sep 17 00:00:00 2001
+From: Osamu Aoki <os...@debian.org>
+Date: Mon, 3 Jul 2017 23:09:25 +0900
+Subject: [PATCH] Export GRUB_COLOR_* to enable configuration
+
+---
+ util/grub-mkconfig.in | 2 ++
+ 1 file changed, 2 insertions(+)
+
+diff --git a/util/grub-mkconfig.in b/util/grub-mkconfig.in
+index ad716384b..2e9029a9e 100644
+--- a/util/grub-mkconfig.in
++++ b/util/grub-mkconfig.in
+@@ -235,6 +235,8 @@ export GRUB_DEFAULT \
+   GRUB_VIDEO_BACKEND \
+   GRUB_GFXMODE \
+   GRUB_BACKGROUND \
++  GRUB_COLOR_NORMAL \
++  GRUB_COLOR_HIGHLIGHT \
+   GRUB_THEME \
+   GRUB_GFXPAYLOAD_LINUX \
+   GRUB_DISABLE_OS_PROBER \
+-- 
+2.11.0
+
diff --git a/debian/patches/series b/debian/patches/series
index 970a8fdf9..b15803976 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -57,3 +57,4 @@ bootp_process_dhcpack_http_boot.patch
 efinet_set_network_from_uefi_devpath.patch
 efinet_set_dns_from_uefi_proto.patch
 grub-install-efibootmgr-check.patch
+export-GRUB_COLOR_-to-enable-configuration.patch
-- 
2.11.0

Reply via email to