grub2/0372-Move-directory-override-directorry-to-grub-install_h.patch
2013-06-07 14:03:56 -04:00

323 lines
14 KiB
Diff

From f954b11e777766356885f2958a556ebd3fcf2f25 Mon Sep 17 00:00:00 2001
From: Vladimir 'phcoder' Serbinenko <phcoder@gmail.com>
Date: Sun, 28 Apr 2013 13:35:51 +0200
Subject: [PATCH 372/471] Move --directory/--override-directorry to
grub-install_header and unify.
---
ChangeLog | 4 ++++
util/grub-install.in | 29 ++++++++++-----------------
util/grub-install_header | 14 +++++++++++++
util/grub-mknetdir.in | 8 --------
util/grub-mkrescue.in | 51 ++++++++++++++++++-----------------------------
util/grub-mkstandalone.in | 9 ---------
6 files changed, 48 insertions(+), 67 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 287770e..f058b20 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,9 @@
2013-04-28 Vladimir Serbinenko <phcoder@gmail.com>
+ Move --directory/--override-directorry to grub-install_header and unify.
+
+2013-04-28 Vladimir Serbinenko <phcoder@gmail.com>
+
* grub-core/term/morse.c: Macroify dih and dah.
2013-04-27 Paulo Flabiano Smorigo <pfsmorigo@br.ibm.com>
diff --git a/util/grub-install.in b/util/grub-install.in
index 271e447..d69ef3a 100644
--- a/util/grub-install.in
+++ b/util/grub-install.in
@@ -32,7 +32,6 @@ export TEXTDOMAIN=@PACKAGE@
export TEXTDOMAINDIR="@localedir@"
host_os=@host_os@
-source_dir=
target=
datadir="@datadir@"
if [ "x$pkgdatadir" = x ]; then
@@ -96,7 +95,6 @@ usage () {
target_trans="$(gettext "TARGET")"
# TRANSLATORS: "current" refers to the platform user's currently running on
print_option_help "--target=$target_trans" "$(gettext "install GRUB for TARGET platform [default=current]")"
- print_option_help "--directory=$(gettext "DIR")" "$(gettext "use GRUB images from DIR. Takes precedence over target")"
print_option_help "--grub-setup=$(gettext "FILE")" "$(gettext "use FILE as grub-setup")"
print_option_help "--grub-mkimage=$(gettext "FILE")" "$(gettext "use FILE as grub-mkimage")"
print_option_help "--grub-mkrelpath=$(gettext "FILE")" "$(gettext "use FILE as grub-mkrelpath")"
@@ -176,11 +174,6 @@ do
--efi-directory=*)
efidir="`echo "$option" | sed 's/--efi-directory=//'`" ;;
- --directory | -d)
- source_dir="`argument $option "$@"`"; shift;;
- --directory=*)
- source_dir="`echo "$option" | sed 's/--directory=//'`" ;;
-
--target)
target="`argument $option "$@"`"; shift;;
--target=*)
@@ -264,7 +257,7 @@ do
esac
done
-if [ x$source_dir = x ]; then
+if [ x$source_directory = x ]; then
if [ x$target = x ]; then
case x"`uname -m`" in
x"powerpc"* | x"ppc"*)
@@ -321,15 +314,15 @@ if [ x$source_dir = x ]; then
echo ;;
esac
fi
- source_dir="${libdir}/@PACKAGE@/$target"
+ source_directory="${libdir}/@PACKAGE@/$target"
fi
-if ! [ -d "$source_dir" ]; then
- gettext_printf "%s doesn't exist. Please specify --target or --directory\\n" "$source_dir"
+if ! [ -d "$source_directory" ]; then
+ gettext_printf "%s doesn't exist. Please specify --target or --directory\\n" "$source_directory"
exit 1
fi
-. "${source_dir}"/modinfo.sh
+. "${source_directory}"/modinfo.sh
if [ "${grub_modinfo_target_cpu}-${grub_modinfo_platform}" = "i386-pc" ] ; then
if [ x$disk_module = xunspecified ]; then
@@ -516,10 +509,10 @@ else
fi
# Copy the GRUB images to the GRUB directory.
-grub_install_files "${source_dir}" "${grubdir}" "${grub_modinfo_target_cpu}-$grub_modinfo_platform" all
+grub_install_files "${source_directory}" "${grubdir}" "${grub_modinfo_target_cpu}-$grub_modinfo_platform" all
if [ "${grub_modinfo_target_cpu}-${grub_modinfo_platform}" = "i386-pc" ] || [ "${grub_modinfo_target_cpu}-${grub_modinfo_platform}" = "sparc64-ieee1275" ] ; then
- for file in "${source_dir}"/*.img "${source_dir}"/efiemu??.o; do
+ for file in "${source_directory}"/*.img "${source_directory}"/efiemu??.o; do
if test -f "$file"; then
cp -f "$file" "${grubdir}/${grub_modinfo_target_cpu}-$grub_modinfo_platform" || exit 1
fi
@@ -685,9 +678,9 @@ case "${grub_modinfo_target_cpu}-${grub_modinfo_platform}" in
esac
if [ x"$config_opt_file" = x ]; then
- "$grub_mkimage" -d "${source_dir}" -O "${mkimage_target}" --output="${grubdir}/${grub_modinfo_target_cpu}-$grub_modinfo_platform/core.${imgext}" --prefix="${prefix_drive}${relative_grubdir}" $grub_decompression_module $modules || exit 1
+ "$grub_mkimage" -d "${source_directory}" -O "${mkimage_target}" --output="${grubdir}/${grub_modinfo_target_cpu}-$grub_modinfo_platform/core.${imgext}" --prefix="${prefix_drive}${relative_grubdir}" $grub_decompression_module $modules || exit 1
else
- "$grub_mkimage" -c "${config_opt_file}" -d "${source_dir}" -O "${mkimage_target}" --output="${grubdir}/${grub_modinfo_target_cpu}-$grub_modinfo_platform/core.${imgext}" --prefix="${prefix_drive}${relative_grubdir}" $grub_decompression_module $modules || exit 1
+ "$grub_mkimage" -c "${config_opt_file}" -d "${source_directory}" -O "${mkimage_target}" --output="${grubdir}/${grub_modinfo_target_cpu}-$grub_modinfo_platform/core.${imgext}" --prefix="${prefix_drive}${relative_grubdir}" $grub_decompression_module $modules || exit 1
fi
# Backward-compatibility kludges
@@ -698,9 +691,9 @@ elif [ "${grub_modinfo_target_cpu}-${grub_modinfo_platform}" = "i386-ieee1275" ]
elif [ "${grub_modinfo_target_cpu}-${grub_modinfo_platform}" = "i386-efi" ] || [ "${grub_modinfo_target_cpu}-${grub_modinfo_platform}" = "x86_64-efi" ]; then
if [ x"$config_opt_file" = x ]; then
- "$grub_mkimage" -d "${source_dir}" -O "${mkimage_target}" --output="${grubdir}/${grub_modinfo_target_cpu}-$grub_modinfo_platform/grub.efi" --prefix="" $grub_decompression_module $modules || exit 1
+ "$grub_mkimage" -d "${source_directory}" -O "${mkimage_target}" --output="${grubdir}/${grub_modinfo_target_cpu}-$grub_modinfo_platform/grub.efi" --prefix="" $grub_decompression_module $modules || exit 1
else
- "$grub_mkimage" -c "${config_opt_file}" -d "${source_dir}" -O "${mkimage_target}" --output="${grubdir}/${grub_modinfo_target_cpu}-$grub_modinfo_platform/grub.efi" --prefix="" $grub_decompression_module $modules || exit 1
+ "$grub_mkimage" -c "${config_opt_file}" -d "${source_directory}" -O "${mkimage_target}" --output="${grubdir}/${grub_modinfo_target_cpu}-$grub_modinfo_platform/grub.efi" --prefix="" $grub_decompression_module $modules || exit 1
fi
fi
diff --git a/util/grub-install_header b/util/grub-install_header
index 805fc4f..72d91e9 100644
--- a/util/grub-install_header
+++ b/util/grub-install_header
@@ -126,6 +126,9 @@ grub_print_install_files_help () {
print_option_help "--fonts=FONTS" "$(gettext_printf "install FONTS [default=%s]" "unicode")"
print_option_help "--locales=LOCALES" "$(gettext_printf "install only LOCALES [default=all]")"
print_option_help "--compress[=no,xz,gz,lzo]" "$(gettext "compress GRUB files [optional]")"
+ # TRANSLATORS: platform here isn't identifier. It can be translated.
+ dir_msg="$(gettext_printf "use images and modules under DIR [default=%s/<platform>]" "${libdir}/@PACKAGE@")"
+ print_option_help "-d, --directory=$(gettext "DIR")" "$dir_msg"
}
install_modules=all
@@ -136,6 +139,7 @@ compress=no
grub_decompression_module=""
compressor=""
compressor_opts=""
+source_directory=""
argument () {
opt=$1
@@ -198,6 +202,16 @@ grub_process_install_options () {
grub_parse_compress `argument $option "$@"`; grub_process_install_options_consumed=2; return ;;
--compress=*)
grub_parse_compress `echo "${option}" | sed 's/--compress=//'`; grub_process_install_options_consumed=1; return ;;
+ --directory | -d)
+ source_directory=`argument $option "$@"`; grub_process_install_options_consumed=2 ;;
+ --directory=*)
+ source_directory=`echo "$option" | sed 's/--directory=//'` grub_process_install_options_consumed=1;;
+
+ # For backwards compatibility
+ --override-directory)
+ source_directory=`argument $option "$@"`; grub_process_install_options_consumed=2 ;;
+ --override-directory=*)
+ source_directory=`echo "$option" | sed 's/--override-directory=//'` grub_process_install_options_consumed=1;;
esac
}
diff --git a/util/grub-mknetdir.in b/util/grub-mknetdir.in
index d32de46..051b985 100644
--- a/util/grub-mknetdir.in
+++ b/util/grub-mknetdir.in
@@ -66,9 +66,6 @@ usage () {
print_option_help "--net-directory=$(gettext "DIR")" "$(gettext "root directory of TFTP server")"
print_option_help "--subdir=$(gettext "DIR")" "$(gettext "relative subdirectory on network server")"
print_option_help "--grub-mkimage=$(gettext "FILE")" "$(gettext "use FILE as grub-mkimage")"
- # TRANSLATORS: platform here isn't identifier. It can be translated.
- dir_msg="$(gettext_printf "use images and modules under DIR [default=%s/<platform>]" "${libdir}/@PACKAGE@")"
- print_option_help "-d, --directory=$(gettext "DIR")" "$dir_msg"
echo
gettext_printf "%s copies GRUB images into net_directory/subdir/target_cpu-platform\n" "$self"
echo
@@ -123,11 +120,6 @@ do
--debug-image=*)
debug_image=`echo "$option" | sed 's/--debug-image=//'` ;;
- --directory | -d)
- source_directory=`argument $option "$@"`; shift ;;
- --directory=*)
- source_directory=`echo "$option" | sed 's/--directory=//'` ;;
-
-*)
gettext_printf "Unrecognized option \`%s'\n" "$option" 1>&2
usage
diff --git a/util/grub-mkrescue.in b/util/grub-mkrescue.in
index eab621e..a8d492e 100644
--- a/util/grub-mkrescue.in
+++ b/util/grub-mkrescue.in
@@ -1,3 +1,4 @@
+#!/bin/sh
# Make GRUB rescue image
# Copyright (C) 1999,2000,2001,2002,2003,2004,2005,2006,2007,2008,2009,2010 Free Software Foundation, Inc.
@@ -49,7 +50,6 @@ arcs_dir="${libdir}/@PACKAGE@/mips-arc"
arc_dir="${libdir}/@PACKAGE@/mipsel-arc"
ppc_dir="${libdir}/@PACKAGE@/powerpc-ieee1275"
rom_directory=
-override_dir=
grub_mkimage="${bindir}/@grub_mkimage@"
grub_render_label="${bindir}/@grub_render_label@"
grub_glue_efi="${bindir}/@grub_glue_efi@"
@@ -143,19 +143,6 @@ do
rom_directory=`echo "$option" | sed 's/--rom-directory=//'` ;;
# Intentionally undocumented
- --override-directory)
- override_dir=`argument $option "$@"`
- shift
- PATH=${override_dir}:$PATH
- export PATH
- ;;
- --override-directory=*)
- override_dir=`echo "${option}/" | sed 's/--override-directory=//'`
- PATH=${override_dir}:$PATH
- export PATH
- ;;
-
- # Intentionally undocumented
--grub-mkimage-extra)
mkimage_extra_arg="$mkimage_extra_arg `argument $option "$@"`"; shift ;;
--grub-mkimage-extra=*)
@@ -280,7 +267,7 @@ make_image_fwdisk ()
$grub_decompression_module iso9660 $4
}
-if [ "${override_dir}" = "" ] ; then
+if [ "${source_directory}" = "" ] ; then
if [ "$system_area" = auto ]; then
if test -e "${pc_dir}" || test -e "${ppc_dir}" \
|| test -e "${efi32_dir}" || test -e "${efi64_dir}"; then
@@ -337,8 +324,8 @@ if [ "${override_dir}" = "" ] ; then
process_input_dir "${arc_dir}" mipsel-arc
fi
else
- . "${override_dir}"/modinfo.sh
- process_input_dir "${override_dir}" ${grub_modinfo_target_cpu}-${grub_modinfo_platform}
+ . "${source_directory}"/modinfo.sh
+ process_input_dir "${source_directory}" ${grub_modinfo_target_cpu}-${grub_modinfo_platform}
multiboot_dir=
pc_dir=
efi32_dir=
@@ -355,21 +342,21 @@ else
arcs_dir=
arc_dir=
case "${grub_modinfo_target_cpu}-${grub_modinfo_platform}" in
- i386-multiboot) multiboot_dir="${override_dir}" ;;
- i386-coreboot) coreboot_dir="${override_dir}" ;;
- i386-qemu) qemu_dir="${override_dir}" ;;
- i386-pc) pc_dir="${override_dir}"; system_area=common;;
- i386-efi) efi32_dir="${override_dir}"; system_area=common ;;
- x86_64-efi) efi64_dir="${override_dir}"; system_area=common ;;
- ia64-efi) ia64_dir="${override_dir}" ;;
- mipsel-qemu_mips) mipsel_qemu_dir="${override_dir}" ;;
- mipsel-loongson) loongson_dir="${override_dir}" ;;
- mips-qemu_mips) mips_qemu_dir="${override_dir}" ;;
- powerpc-ieee1275) ppc_dir="${override_dir}"; system_area=common ;;
- sparc64-ieee1275) sparc64_dir="${override_dir}"; system_area=sparc64 ;;
- mips-arc) arcs_dir="${override_dir}"; system_area=arcs ;;
- mipsel-arc) arc_dir="${override_dir}" ;;
- i386-ieee1275) i386_ieee1275_dir="${override_dir}" ;;
+ i386-multiboot) multiboot_dir="${source_directory}" ;;
+ i386-coreboot) coreboot_dir="${source_directory}" ;;
+ i386-qemu) qemu_dir="${source_directory}" ;;
+ i386-pc) pc_dir="${source_directory}"; system_area=common;;
+ i386-efi) efi32_dir="${source_directory}"; system_area=common ;;
+ x86_64-efi) efi64_dir="${source_directory}"; system_area=common ;;
+ ia64-efi) ia64_dir="${source_directory}" ;;
+ mipsel-qemu_mips) mipsel_qemu_dir="${source_directory}" ;;
+ mipsel-loongson) loongson_dir="${source_directory}" ;;
+ mips-qemu_mips) mips_qemu_dir="${source_directory}" ;;
+ powerpc-ieee1275) ppc_dir="${source_directory}"; system_area=common ;;
+ sparc64-ieee1275) sparc64_dir="${source_directory}"; system_area=sparc64 ;;
+ mips-arc) arcs_dir="${source_directory}"; system_area=arcs ;;
+ mipsel-arc) arc_dir="${source_directory}" ;;
+ i386-ieee1275) i386_ieee1275_dir="${source_directory}" ;;
esac
fi
diff --git a/util/grub-mkstandalone.in b/util/grub-mkstandalone.in
index 927075b..30dd90f 100644
--- a/util/grub-mkstandalone.in
+++ b/util/grub-mkstandalone.in
@@ -33,7 +33,6 @@ fi
self=`basename $0`
-source_directory=
compression=auto
format=
grub_mkimage="${bindir}/@grub_mkimage@"
@@ -54,9 +53,6 @@ usage () {
print_option_help "-h, --help" "$(gettext "print this message and exit")"
print_option_help "-v, --version" "$(gettext "print the version information and exit")"
print_option_help "-o, --output=$(gettext FILE)" "$(gettext "save output in FILE [required]")"
- # TRANSLATORS: platform here isn't identifier. It can be translated.
- dir_msg="$(gettext_printf "use images and modules under DIR [default=%s/<platform>]" "${libdir}/@PACKAGE@")"
- print_option_help "-d, --directory=$(gettext "DIR")" "$dir_msg"
print_option_help "-O, --format=$(gettext "FORMAT")" "$(gettext "generate an image in FORMAT")"; echo
print_option_help "" "$(gettext "available formats:") $formats"
echo
@@ -98,11 +94,6 @@ do
--output=*)
output_image=`echo "$option" | sed 's/--output=//'` ;;
- --directory | -d)
- source_directory=`argument $option "$@"`; shift ;;
- --directory=*)
- source_directory=`echo "$option" | sed 's/--directory=//'` ;;
-
--grub-mkimage)
grub_mkimage=`argument $option "$@"`; shift ;;
--grub-mkimage=*)
--
1.8.2.1