nalika / rpms / grub2

Forked from rpms/grub2 2 years ago
Clone

Blame SOURCES/0372-Move-directory-override-directorry-to-grub-install_h.patch

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