* util/grub-mkconfig_lib.in (grub_quote): Remove extra layer of escape.

* util/grub.d/10_hurd.in: Add missing quoting.
	* util/grub.d/10_illumos.in: Likewise.
	* util/grub.d/10_kfreebsd.in: Likewise.
	* util/grub.d/10_linux.in: Likewise.
	* util/grub.d/20_linux_xen.in: Likewise.
This commit is contained in:
Vladimir 'phcoder' Serbinenko 2012-07-22 20:02:17 +02:00
parent 7bd29c01f0
commit a885261b5d
7 changed files with 23 additions and 13 deletions

View file

@ -1,3 +1,12 @@
2012-07-22 Vladimir Serbinenko <phcoder@gmail.com>
* util/grub-mkconfig_lib.in (grub_quote): Remove extra layer of escape.
* util/grub.d/10_hurd.in: Add missing quoting.
* util/grub.d/10_illumos.in: Likewise.
* util/grub.d/10_kfreebsd.in: Likewise.
* util/grub.d/10_linux.in: Likewise.
* util/grub.d/20_linux_xen.in: Likewise.
2012-07-22 Vladimir Serbinenko <phcoder@gmail.com> 2012-07-22 Vladimir Serbinenko <phcoder@gmail.com>
New command `lsefi'. New command `lsefi'.

View file

@ -255,19 +255,19 @@ version_find_latest ()
echo "$version_find_latest_a" echo "$version_find_latest_a"
} }
# One layer of quotation is eaten by "", the second by sed, and the third by # One layer of quotation is eaten by "" and the second by
# printf; so this turns ' into \'. Note that you must use the output of # sed; so this turns ' into \'. Note that you must use the output of
# this function in a printf format string. # this function in a printf format string.
grub_quote () { grub_quote () {
sed "s/'/'\\\\\\\\''/g" sed "s/'/'\\\\''/g"
} }
gettext_quoted () { gettext_quoted () {
gettext "$@" | sed "s/'/'\\\\\\\\''/g" gettext "$@" | grub_quote
} }
# Run the first argument through gettext_quoted, and then pass that and all # Run the first argument through gettext, and then pass that and all
# remaining arguments to printf. This is a useful abbreviation and tends to # remaining arguments to printf. This is a useful abbreviation and tends to
# be easier to type. # be easier to type.
gettext_printf () { gettext_printf () {

View file

@ -117,7 +117,7 @@ EOF
opts= opts=
fi fi
sed "s/^/$submenu_indentation/" << EOF sed "s/^/$submenu_indentation/" << EOF
echo '$message' echo '$(echo "$message" | grub_quote)'
multiboot ${kernel} root=device:${GRUB_DEVICE#/dev/} $opts ${GRUB_CMDLINE_GNUMACH} multiboot ${kernel} root=device:${GRUB_DEVICE#/dev/} $opts ${GRUB_CMDLINE_GNUMACH}
EOF EOF
@ -133,7 +133,7 @@ EOF
fi fi
sed "s/^/$submenu_indentation/" << EOF sed "s/^/$submenu_indentation/" << EOF
echo '$message' echo '$(echo "$message" | grub_quote)'
module /hurd/${hurd_fs}.static ${hurd_fs} $opts \\ module /hurd/${hurd_fs}.static ${hurd_fs} $opts \\
--multiboot-command-line='\${kernel-command-line}' \\ --multiboot-command-line='\${kernel-command-line}' \\
--host-priv-port='\${host-port}' \\ --host-priv-port='\${host-port}' \\

View file

@ -46,6 +46,7 @@ message="$(gettext_printf "Loading kernel of Illumos ...")"
ISADIR= ISADIR=
fi fi
zfs-bootfs $($grub_mkrelpath /) ZFS_BOOTFS zfs-bootfs $($grub_mkrelpath /) ZFS_BOOTFS
echo '$(echo "$message" | grub_quote)'
multiboot $($grub_mkrelpath /platform/i86pc/kernel)/\$ISADIR/unix /platform/i86pc/kernel/\$ISADIR/unix -B \$ZFS_BOOTFS,console=text multiboot $($grub_mkrelpath /platform/i86pc/kernel)/\$ISADIR/unix /platform/i86pc/kernel/\$ISADIR/unix -B \$ZFS_BOOTFS,console=text
module $($grub_mkrelpath /platform/i86pc)/\$ISADIR/boot_archive /platform/i86pc/\$ISADIR/boot_archive module $($grub_mkrelpath /platform/i86pc)/\$ISADIR/boot_archive /platform/i86pc/\$ISADIR/boot_archive
} }

View file

@ -100,7 +100,7 @@ kfreebsd_entry ()
printf '%s\n' "${prepare_boot_cache}" | sed "s/^/$submenu_indentation/" printf '%s\n' "${prepare_boot_cache}" | sed "s/^/$submenu_indentation/"
message="$(gettext_printf "Loading kernel of FreeBSD %s ..." ${version})" message="$(gettext_printf "Loading kernel of FreeBSD %s ..." ${version})"
sed "s/^/$submenu_indentation/" << EOF sed "s/^/$submenu_indentation/" << EOF
echo '$message' echo '$(echo "$message" | grub_quote)'
kfreebsd ${rel_dirname}/${basename} ${args} kfreebsd ${rel_dirname}/${basename} ${args}
EOF EOF

View file

@ -134,14 +134,14 @@ linux_entry ()
fi fi
message="$(gettext_printf "Loading Linux %s ..." ${version})" message="$(gettext_printf "Loading Linux %s ..." ${version})"
sed "s/^/$submenu_indentation/" << EOF sed "s/^/$submenu_indentation/" << EOF
echo '$message' echo '$(echo "$message" | grub_quote)'
linux ${rel_dirname}/${basename} root=${linux_root_device_thisversion} ro ${args} linux ${rel_dirname}/${basename} root=${linux_root_device_thisversion} ro ${args}
EOF EOF
if test -n "${initrd}" ; then if test -n "${initrd}" ; then
# TRANSLATORS: ramdisk isn't identifier. Should be translated. # TRANSLATORS: ramdisk isn't identifier. Should be translated.
message="$(gettext_printf "Loading initial ramdisk ...")" message="$(gettext_printf "Loading initial ramdisk ...")"
sed "s/^/$submenu_indentation/" << EOF sed "s/^/$submenu_indentation/" << EOF
echo '$message' echo '$(echo "$message" | grub_quote)'
initrd ${rel_dirname}/${initrd} initrd ${rel_dirname}/${initrd}
EOF EOF
fi fi

View file

@ -120,16 +120,16 @@ linux_entry ()
xmessage="$(gettext_printf "Loading Xen %s ..." ${xen_version})" xmessage="$(gettext_printf "Loading Xen %s ..." ${xen_version})"
lmessage="$(gettext_printf "Loading Linux %s ..." ${version})" lmessage="$(gettext_printf "Loading Linux %s ..." ${version})"
sed "s/^/$submenu_indentation/" << EOF sed "s/^/$submenu_indentation/" << EOF
echo '$xmessage' echo '$(echo "$xmessage" | grub_quote)'
multiboot ${rel_xen_dirname}/${xen_basename} placeholder ${xen_args} multiboot ${rel_xen_dirname}/${xen_basename} placeholder ${xen_args}
echo '$lmessage' echo '$(echo "$lmessage" | grub_quote)'
module ${rel_dirname}/${basename} placeholder root=${linux_root_device_thisversion} ro ${args} module ${rel_dirname}/${basename} placeholder root=${linux_root_device_thisversion} ro ${args}
EOF EOF
if test -n "${initrd}" ; then if test -n "${initrd}" ; then
# TRANSLATORS: ramdisk isn't identifier. Should be translated. # TRANSLATORS: ramdisk isn't identifier. Should be translated.
message="$(gettext_printf "Loading initial ramdisk ...")" message="$(gettext_printf "Loading initial ramdisk ...")"
sed "s/^/$submenu_indentation/" << EOF sed "s/^/$submenu_indentation/" << EOF
echo '$message' echo '$(echo "$message" | grub_quote)'
module ${rel_dirname}/${initrd} module ${rel_dirname}/${initrd}
EOF EOF
fi fi