a5bd9f6
From 14589a819717d1d6614687202159a0070bba1f8f Mon Sep 17 00:00:00 2001
a5bd9f6
From: Vladimir 'phcoder' Serbinenko <phcoder@gmail.com>
a5bd9f6
Date: Sun, 22 Jul 2012 20:02:17 +0200
f74b50e
Subject: [PATCH 016/482] 	* util/grub-mkconfig_lib.in (grub_quote):
a5bd9f6
 Remove extra layer of escape. 	* util/grub.d/10_hurd.in: Add missing quoting.
a5bd9f6
 	* util/grub.d/10_illumos.in: Likewise. 	* util/grub.d/10_kfreebsd.in:
a5bd9f6
 Likewise. 	* util/grub.d/10_linux.in: Likewise. 	*
a5bd9f6
 util/grub.d/20_linux_xen.in: Likewise.
a5bd9f6
a5bd9f6
---
a5bd9f6
 ChangeLog                   |  9 +++++++++
a5bd9f6
 util/grub-mkconfig_lib.in   | 10 +++++-----
a5bd9f6
 util/grub.d/10_hurd.in      |  4 ++--
a5bd9f6
 util/grub.d/10_illumos.in   |  1 +
a5bd9f6
 util/grub.d/10_kfreebsd.in  |  2 +-
a5bd9f6
 util/grub.d/10_linux.in     |  4 ++--
a5bd9f6
 util/grub.d/20_linux_xen.in |  6 +++---
a5bd9f6
 7 files changed, 23 insertions(+), 13 deletions(-)
a5bd9f6
a5bd9f6
diff --git a/ChangeLog b/ChangeLog
a5bd9f6
index a21708c..0db6239 100644
a5bd9f6
--- a/ChangeLog
a5bd9f6
+++ b/ChangeLog
a5bd9f6
@@ -1,5 +1,14 @@
a5bd9f6
 2012-07-22  Vladimir Serbinenko  <phcoder@gmail.com>
a5bd9f6
 
a5bd9f6
+	* util/grub-mkconfig_lib.in (grub_quote): Remove extra layer of escape.
a5bd9f6
+	* util/grub.d/10_hurd.in: Add missing quoting.
a5bd9f6
+	* util/grub.d/10_illumos.in: Likewise.
a5bd9f6
+	* util/grub.d/10_kfreebsd.in: Likewise.
a5bd9f6
+	* util/grub.d/10_linux.in: Likewise.
a5bd9f6
+	* util/grub.d/20_linux_xen.in: Likewise.
a5bd9f6
+
a5bd9f6
+2012-07-22  Vladimir Serbinenko  <phcoder@gmail.com>
a5bd9f6
+
a5bd9f6
 	New command `lsefi'.
a5bd9f6
 
a5bd9f6
 	* grub-core/Makefile.core.def (lsefi): New module.
a5bd9f6
diff --git a/util/grub-mkconfig_lib.in b/util/grub-mkconfig_lib.in
a5bd9f6
index 76133b4..beb52ee 100644
a5bd9f6
--- a/util/grub-mkconfig_lib.in
a5bd9f6
+++ b/util/grub-mkconfig_lib.in
a5bd9f6
@@ -255,19 +255,19 @@ version_find_latest ()
a5bd9f6
   echo "$version_find_latest_a"
a5bd9f6
 }
a5bd9f6
 
a5bd9f6
-# One layer of quotation is eaten by "", the second by sed, and the third by
a5bd9f6
-# printf; so this turns ' into \'.  Note that you must use the output of
a5bd9f6
+# One layer of quotation is eaten by "" and the second by
a5bd9f6
+# sed; so this turns ' into \'.  Note that you must use the output of
a5bd9f6
 # this function in a printf format string.
a5bd9f6
 
a5bd9f6
 grub_quote () {
a5bd9f6
-  sed "s/'/'\\\\\\\\''/g"
a5bd9f6
+  sed "s/'/'\\\\''/g"
a5bd9f6
 }
a5bd9f6
 
a5bd9f6
 gettext_quoted () {
a5bd9f6
-  gettext "$@" | sed "s/'/'\\\\\\\\''/g"
a5bd9f6
+  gettext "$@" | grub_quote
a5bd9f6
 }
a5bd9f6
 
a5bd9f6
-# Run the first argument through gettext_quoted, and then pass that and all
a5bd9f6
+# Run the first argument through gettext, and then pass that and all
a5bd9f6
 # remaining arguments to printf.  This is a useful abbreviation and tends to
a5bd9f6
 # be easier to type.
a5bd9f6
 gettext_printf () {
a5bd9f6
diff --git a/util/grub.d/10_hurd.in b/util/grub.d/10_hurd.in
a5bd9f6
index 6451060..45f0ad3 100644
a5bd9f6
--- a/util/grub.d/10_hurd.in
a5bd9f6
+++ b/util/grub.d/10_hurd.in
a5bd9f6
@@ -117,7 +117,7 @@ EOF
a5bd9f6
       opts=
a5bd9f6
   fi
a5bd9f6
   sed "s/^/$submenu_indentation/" << EOF
a5bd9f6
-	echo		'$message'
a5bd9f6
+	echo		'$(echo "$message" | grub_quote)'
a5bd9f6
 	multiboot	${kernel} root=device:${GRUB_DEVICE#/dev/} $opts ${GRUB_CMDLINE_GNUMACH}
a5bd9f6
 EOF
a5bd9f6
 
a5bd9f6
@@ -133,7 +133,7 @@ EOF
a5bd9f6
   fi
a5bd9f6
 
a5bd9f6
   sed "s/^/$submenu_indentation/" << EOF
a5bd9f6
-	echo		'$message'
a5bd9f6
+	echo		'$(echo "$message" | grub_quote)'
a5bd9f6
 	module		/hurd/${hurd_fs}.static ${hurd_fs} $opts \\
a5bd9f6
 			--multiboot-command-line='\${kernel-command-line}' \\
a5bd9f6
 			--host-priv-port='\${host-port}' \\
a5bd9f6
diff --git a/util/grub.d/10_illumos.in b/util/grub.d/10_illumos.in
a5bd9f6
index 422d56f..2477466 100644
a5bd9f6
--- a/util/grub.d/10_illumos.in
a5bd9f6
+++ b/util/grub.d/10_illumos.in
a5bd9f6
@@ -46,6 +46,7 @@ message="$(gettext_printf "Loading kernel of Illumos ...")"
a5bd9f6
 		ISADIR=
a5bd9f6
 	fi
a5bd9f6
 	zfs-bootfs $($grub_mkrelpath /) ZFS_BOOTFS
a5bd9f6
+        echo '$(echo "$message" | grub_quote)'
a5bd9f6
 	multiboot $($grub_mkrelpath /platform/i86pc/kernel)/\$ISADIR/unix /platform/i86pc/kernel/\$ISADIR/unix -B \$ZFS_BOOTFS,console=text
a5bd9f6
 	module $($grub_mkrelpath /platform/i86pc)/\$ISADIR/boot_archive /platform/i86pc/\$ISADIR/boot_archive
a5bd9f6
 }
a5bd9f6
diff --git a/util/grub.d/10_kfreebsd.in b/util/grub.d/10_kfreebsd.in
a5bd9f6
index 93405a6..b0e84e2 100644
a5bd9f6
--- a/util/grub.d/10_kfreebsd.in
a5bd9f6
+++ b/util/grub.d/10_kfreebsd.in
a5bd9f6
@@ -100,7 +100,7 @@ kfreebsd_entry ()
a5bd9f6
   printf '%s\n' "${prepare_boot_cache}" | sed "s/^/$submenu_indentation/"
a5bd9f6
   message="$(gettext_printf "Loading kernel of FreeBSD %s ..." ${version})"
a5bd9f6
   sed "s/^/$submenu_indentation/" << EOF
a5bd9f6
-	echo			'$message'
a5bd9f6
+	echo			'$(echo "$message" | grub_quote)'
a5bd9f6
 	kfreebsd		${rel_dirname}/${basename} ${args}
a5bd9f6
 EOF
a5bd9f6
 
a5bd9f6
diff --git a/util/grub.d/10_linux.in b/util/grub.d/10_linux.in
a5bd9f6
index 14402e8..35f7a83 100644
a5bd9f6
--- a/util/grub.d/10_linux.in
a5bd9f6
+++ b/util/grub.d/10_linux.in
a5bd9f6
@@ -134,14 +134,14 @@ linux_entry ()
a5bd9f6
   fi
a5bd9f6
   message="$(gettext_printf "Loading Linux %s ..." ${version})"
a5bd9f6
   sed "s/^/$submenu_indentation/" << EOF
a5bd9f6
-	echo	'$message'
a5bd9f6
+	echo	'$(echo "$message" | grub_quote)'
a5bd9f6
 	linux	${rel_dirname}/${basename} root=${linux_root_device_thisversion} ro ${args}
a5bd9f6
 EOF
a5bd9f6
   if test -n "${initrd}" ; then
a5bd9f6
     # TRANSLATORS: ramdisk isn't identifier. Should be translated.
a5bd9f6
     message="$(gettext_printf "Loading initial ramdisk ...")"
a5bd9f6
     sed "s/^/$submenu_indentation/" << EOF
a5bd9f6
-	echo	'$message'
a5bd9f6
+	echo	'$(echo "$message" | grub_quote)'
a5bd9f6
 	initrd	${rel_dirname}/${initrd}
a5bd9f6
 EOF
a5bd9f6
   fi
a5bd9f6
diff --git a/util/grub.d/20_linux_xen.in b/util/grub.d/20_linux_xen.in
a5bd9f6
index 1d94502..33f1592 100644
a5bd9f6
--- a/util/grub.d/20_linux_xen.in
a5bd9f6
+++ b/util/grub.d/20_linux_xen.in
a5bd9f6
@@ -120,16 +120,16 @@ linux_entry ()
a5bd9f6
   xmessage="$(gettext_printf "Loading Xen %s ..." ${xen_version})"
a5bd9f6
   lmessage="$(gettext_printf "Loading Linux %s ..." ${version})"
a5bd9f6
   sed "s/^/$submenu_indentation/" << EOF
a5bd9f6
-	echo	'$xmessage'
a5bd9f6
+	echo	'$(echo "$xmessage" | grub_quote)'
a5bd9f6
 	multiboot	${rel_xen_dirname}/${xen_basename} placeholder ${xen_args}
a5bd9f6
-	echo	'$lmessage'
a5bd9f6
+	echo	'$(echo "$lmessage" | grub_quote)'
a5bd9f6
 	module	${rel_dirname}/${basename} placeholder root=${linux_root_device_thisversion} ro ${args}
a5bd9f6
 EOF
a5bd9f6
   if test -n "${initrd}" ; then
a5bd9f6
     # TRANSLATORS: ramdisk isn't identifier. Should be translated.
a5bd9f6
     message="$(gettext_printf "Loading initial ramdisk ...")"
a5bd9f6
     sed "s/^/$submenu_indentation/" << EOF
a5bd9f6
-	echo	'$message'
a5bd9f6
+	echo	'$(echo "$message" | grub_quote)'
a5bd9f6
 	module	${rel_dirname}/${initrd}
a5bd9f6
 EOF
a5bd9f6
   fi
a5bd9f6
-- 
31004e6
1.8.2.1
a5bd9f6