merge with mainline

This commit is contained in:
BVK Chaitanya 2010-06-12 16:32:06 +05:30
commit 95af254928
133 changed files with 4222 additions and 1605 deletions

View file

@ -33,6 +33,7 @@
#include <grub/util/deviceiter.h>
#include <grub/list.h>
#include <grub/misc.h>
#include <grub/emu/misc.h>
#ifdef __linux__
# if !defined(__GLIBC__) || \
@ -676,112 +677,114 @@ grub_util_iterate_devices (int NESTED_FUNC_ATTR (*hook) (const char *, int),
}
/* DM-RAID. */
{
struct dm_tree *tree = NULL;
struct dm_task *task = NULL;
struct dm_names *names = NULL;
unsigned int next = 0;
void *top_handle, *second_handle;
struct dm_tree_node *root, *top, *second;
struct dmraid_seen *seen = NULL;
if (grub_device_mapper_supported ())
{
struct dm_tree *tree = NULL;
struct dm_task *task = NULL;
struct dm_names *names = NULL;
unsigned int next = 0;
void *top_handle, *second_handle;
struct dm_tree_node *root, *top, *second;
struct dmraid_seen *seen = NULL;
/* Build DM tree for all devices. */
tree = dm_tree_create ();
dmraid_check (tree, "dm_tree_create failed\n");
task = dm_task_create (DM_DEVICE_LIST);
dmraid_check (task, "dm_task_create failed\n");
dmraid_check (dm_task_run (task), "dm_task_run failed\n");
names = dm_task_get_names (task);
dmraid_check (names, "dm_task_get_names failed\n");
dmraid_check (names->dev, "No DM devices found\n");
do
{
names = (void *) names + next;
dmraid_check (dm_tree_add_dev (tree, MAJOR (names->dev),
MINOR (names->dev)),
"dm_tree_add_dev (%s) failed\n", names->name);
next = names->next;
}
while (next);
/* Build DM tree for all devices. */
tree = dm_tree_create ();
dmraid_check (tree, "dm_tree_create failed\n");
task = dm_task_create (DM_DEVICE_LIST);
dmraid_check (task, "dm_task_create failed\n");
dmraid_check (dm_task_run (task), "dm_task_run failed\n");
names = dm_task_get_names (task);
dmraid_check (names, "dm_task_get_names failed\n");
dmraid_check (names->dev, "No DM devices found\n");
do
{
names = (void *) names + next;
dmraid_check (dm_tree_add_dev (tree, MAJOR (names->dev),
MINOR (names->dev)),
"dm_tree_add_dev (%s) failed\n", names->name);
next = names->next;
}
while (next);
/* Walk the second-level children of the inverted tree; that is, devices
which are directly composed of non-DM devices such as hard disks.
This class includes all DM-RAID disks and excludes all DM-RAID
partitions. */
root = dm_tree_find_node (tree, 0, 0);
top_handle = NULL;
top = dm_tree_next_child (&top_handle, root, 1);
while (top)
{
second_handle = NULL;
second = dm_tree_next_child (&second_handle, top, 1);
while (second)
{
const char *node_name, *node_uuid;
char *name;
struct dmraid_seen *seen_elt;
/* Walk the second-level children of the inverted tree; that is, devices
which are directly composed of non-DM devices such as hard disks.
This class includes all DM-RAID disks and excludes all DM-RAID
partitions. */
root = dm_tree_find_node (tree, 0, 0);
top_handle = NULL;
top = dm_tree_next_child (&top_handle, root, 1);
while (top)
{
second_handle = NULL;
second = dm_tree_next_child (&second_handle, top, 1);
while (second)
{
const char *node_name, *node_uuid;
char *name;
struct dmraid_seen *seen_elt;
node_name = dm_tree_node_get_name (second);
dmraid_check (node_name, "dm_tree_node_get_name failed\n");
node_uuid = dm_tree_node_get_uuid (second);
dmraid_check (node_uuid, "dm_tree_node_get_uuid failed\n");
if (strncmp (node_uuid, "DMRAID-", 7) != 0)
{
grub_dprintf ("deviceiter", "%s is not DM-RAID\n", node_name);
goto dmraid_next_child;
}
node_name = dm_tree_node_get_name (second);
dmraid_check (node_name, "dm_tree_node_get_name failed\n");
node_uuid = dm_tree_node_get_uuid (second);
dmraid_check (node_uuid, "dm_tree_node_get_uuid failed\n");
if (strncmp (node_uuid, "DMRAID-", 7) != 0)
{
grub_dprintf ("deviceiter", "%s is not DM-RAID\n", node_name);
goto dmraid_next_child;
}
/* Have we already seen this node? There are typically very few
DM-RAID disks, so a list should be fast enough. */
if (grub_named_list_find (GRUB_AS_NAMED_LIST (seen), node_name))
{
grub_dprintf ("deviceiter", "Already seen DM device %s\n",
node_name);
goto dmraid_next_child;
}
/* Have we already seen this node? There are typically very few
DM-RAID disks, so a list should be fast enough. */
if (grub_named_list_find (GRUB_AS_NAMED_LIST (seen), node_name))
{
grub_dprintf ("deviceiter", "Already seen DM device %s\n",
node_name);
goto dmraid_next_child;
}
name = xasprintf ("/dev/mapper/%s", node_name);
if (check_device (name))
{
if (hook (name, 0))
{
free (name);
while (seen)
{
struct dmraid_seen *seen_elt =
grub_list_pop (GRUB_AS_LIST_P (&seen));
free (seen_elt);
}
if (task)
dm_task_destroy (task);
if (tree)
dm_tree_free (tree);
return;
}
}
free (name);
name = xasprintf ("/dev/mapper/%s", node_name);
if (check_device (name))
{
if (hook (name, 0))
{
free (name);
while (seen)
{
struct dmraid_seen *seen_elt = seen;
seen = seen->next;
free (seen_elt);
}
if (task)
dm_task_destroy (task);
if (tree)
dm_tree_free (tree);
return;
}
}
free (name);
seen_elt = xmalloc (sizeof *seen_elt);
seen_elt->name = node_name;
grub_list_push (GRUB_AS_LIST_P (&seen), GRUB_AS_LIST (seen_elt));
seen_elt = xmalloc (sizeof *seen_elt);
seen_elt->name = node_name;
grub_list_push (GRUB_AS_LIST_P (&seen), GRUB_AS_LIST (seen_elt));
dmraid_next_child:
second = dm_tree_next_child (&second_handle, top, 1);
}
top = dm_tree_next_child (&top_handle, root, 1);
}
second = dm_tree_next_child (&second_handle, top, 1);
}
top = dm_tree_next_child (&top_handle, root, 1);
}
dmraid_end:
while (seen)
{
struct dmraid_seen *seen_elt = grub_list_pop (GRUB_AS_LIST_P (&seen));
free (seen_elt);
}
if (task)
dm_task_destroy (task);
if (tree)
dm_tree_free (tree);
}
while (seen)
{
struct dmraid_seen *seen_elt = seen;
seen = seen->next;
free (seen_elt);
}
if (task)
dm_task_destroy (task);
if (tree)
dm_tree_free (tree);
}
# endif /* HAVE_DEVICE_MAPPER */
#endif /* __linux__ */
}

View file

@ -21,7 +21,6 @@
#include <grub/types.h>
#include <grub/util/misc.h>
#include <grub/lib/envblk.h>
#include <grub/handler.h>
#include <grub/i18n.h>
#include <stdio.h>

View file

@ -55,9 +55,6 @@ grub_getkey (void)
return -1;
}
struct grub_handler_class grub_term_input_class;
struct grub_handler_class grub_term_output_class;
void
grub_refresh (void)
{

View file

@ -34,6 +34,8 @@ font=@datadir@/@PACKAGE_TARNAME@/ascii.pf2
pkglibdir=${libdir}/`echo ${PACKAGE_TARNAME}/${target_cpu}-${platform} | sed ${transform}`
localedir=@datadir@/locale
self=`basename $0`
grub_setup=${sbindir}/`echo grub-setup | sed ${transform}`
grub_mkimage=${bindir}/`echo grub-mkimage | sed ${transform}`
grub_mkdevicemap=${sbindir}/`echo grub-mkdevicemap | sed ${transform}`
@ -61,7 +63,7 @@ fi
# Print the usage.
usage () {
cat <<EOF
Usage: grub-install [OPTION] install_device
Usage: $self [OPTION] install_device
Install GRUB on your drive.
-h, --help print this message and exit
@ -91,10 +93,10 @@ fi
INSTALL_DEVICE can be a GRUB device name or a system device filename.
grub-install copies GRUB images into /boot/grub (or /grub on NetBSD and
$self copies GRUB images into /boot/grub (or /grub on NetBSD and
OpenBSD), and uses grub-setup to install grub into the boot sector.
If the --root-directory option is used, then grub-install will copy
If the --root-directory option is used, then $self will copy
images into the operating system installation rooted at that directory.
Report bugs to <bug-grub@gnu.org>.
@ -108,7 +110,7 @@ for option in "$@"; do
usage
exit 0 ;;
-v | --version)
echo "grub-install (GNU GRUB ${PACKAGE_VERSION})"
echo "$self (${PACKAGE_NAME}) ${PACKAGE_VERSION}"
exit 0 ;;
--modules=*)
modules=`echo "$option" | sed 's/--modules=//'` ;;

View file

@ -23,7 +23,8 @@ exec_prefix=@exec_prefix@
sbindir=@sbindir@
libdir=@libdir@
sysconfdir=@sysconfdir@
package_version=@PACKAGE_VERSION@
PACKAGE_NAME=@PACKAGE_NAME@
PACKAGE_VERSION=@PACKAGE_VERSION@
host_os=@host_os@
datarootdir=@datarootdir@
datadir=@datadir@
@ -31,6 +32,8 @@ pkgdatadir=${datadir}/`echo @PACKAGE_TARNAME@ | sed "${transform}"`
grub_cfg=""
grub_mkconfig_dir=${sysconfdir}/grub.d
self=`basename $0`
grub_mkdevicemap=${sbindir}/`echo grub-mkdevicemap | sed ${transform}`
grub_probe=${sbindir}/`echo grub-probe | sed ${transform}`
@ -38,7 +41,7 @@ grub_probe=${sbindir}/`echo grub-probe | sed ${transform}`
# Print the usage.
usage () {
cat <<EOF
Usage: $0 [OPTION]
Usage: $self [OPTION]
Generate a grub config file
-o, --output=FILE output generated config to FILE [default=stdout]
@ -50,17 +53,22 @@ EOF
}
# Check the arguments.
next_grub_cfg=false
for option in "$@"; do
if $next_grub_cfg; then
grub_cfg=$option
next_grub_cfg=false
continue
fi
case "$option" in
-h | --help)
usage
exit 0 ;;
-v | --version)
echo "$0 (GNU GRUB ${package_version})"
echo "$self (${PACKAGE_NAME}) ${PACKAGE_VERSION}"
exit 0 ;;
-o)
shift
grub_cfg=$1
next_grub_cfg=:
;;
--output=*)
grub_cfg=`echo "$option" | sed 's/--output=//'`
@ -72,6 +80,11 @@ for option in "$@"; do
;;
esac
done
if $next_grub_cfg; then
echo "Missing argument to \`-o'" 1>&2
usage
exit 1
fi
. ${libdir}/grub/grub-mkconfig_lib
@ -103,7 +116,7 @@ if [ "$EUID" != 0 ] ; then
done ;;
esac
if [ $root != t ] ; then
echo "$0: You must run this as root" >&2
echo "$self: You must run this as root" >&2
exit 1
fi
fi
@ -236,6 +249,10 @@ export GRUB_DEFAULT \
GRUB_HIDDEN_TIMEOUT \
GRUB_HIDDEN_TIMEOUT_QUIET \
GRUB_TIMEOUT \
GRUB_DEFAULT_BUTTON \
GRUB_HIDDEN_TIMEOUT_BUTTON \
GRUB_TIMEOUT_BUTTON \
GRUB_BUTTON_CMOS_ADDRESS \
GRUB_DISTRIBUTOR \
GRUB_CMDLINE_LINUX \
GRUB_CMDLINE_LINUX_DEFAULT \
@ -270,7 +287,7 @@ cat << EOF
#
# DO NOT EDIT THIS FILE
#
# It is automatically generated by $0 using templates
# It is automatically generated by $self using templates
# from ${grub_mkconfig_dir} and settings from ${sysconfdir}/default/grub
#
EOF

View file

@ -105,6 +105,11 @@ prepare_grub_to_access_device ()
echo "insmod ${module}"
done
partmap="`${grub_probe} --device ${device} --target=partmap`"
for module in ${partmap} ; do
echo "insmod part_${module}"
done
fs="`${grub_probe} --device ${device} --target=fs`"
for module in ${fs} ; do
echo "insmod ${module}"

View file

@ -1253,7 +1253,7 @@ main (int argc, char *argv[])
image_target = &image_targets[i];
if (!image_target)
{
printf ("unknown target %s\n", optarg);
printf ("unknown target format %s\n", optarg);
usage (1);
}
break;
@ -1307,7 +1307,7 @@ main (int argc, char *argv[])
break;
case 'V':
printf ("grub-mkimage (%s) %s\n", PACKAGE_NAME, PACKAGE_VERSION);
printf ("%s (%s) %s\n", program_name, PACKAGE_NAME, PACKAGE_VERSION);
return 0;
case 'v':
@ -1322,7 +1322,7 @@ main (int argc, char *argv[])
if (!image_target)
{
printf ("Target not specified.\n");
printf ("Target format not specified (use the -O option).\n");
usage (1);
}

View file

@ -112,7 +112,7 @@ hexify (char *hex, grub_uint8_t *bin, grub_size_t n)
int
main (int argc, char *argv[])
{
unsigned int c = 10000, buflen = 64, saltlen = 64;
unsigned int count = 10000, buflen = 64, saltlen = 64;
char *pass1, *pass2;
char *bufhex, *salthex;
gcry_err_code_t gcry_err;
@ -137,7 +137,7 @@ main (int argc, char *argv[])
switch (c)
{
case 'c':
c = strtoul (optarg, NULL, 0);
count = strtoul (optarg, NULL, 0);
break;
case 'l':
@ -307,7 +307,7 @@ main (int argc, char *argv[])
gcry_err = grub_crypto_pbkdf2 (GRUB_MD_SHA512,
(grub_uint8_t *) pass1, strlen (pass1),
salt, saltlen,
c, buf, buflen);
count, buf, buflen);
memset (pass1, 0, strlen (pass1));
free (pass1);
@ -327,7 +327,8 @@ main (int argc, char *argv[])
hexify (bufhex, buf, buflen);
hexify (salthex, salt, saltlen);
printf ("Your PBKDF2 is grub.pbkdf2.sha512.%d.%s.%s\n", c, salthex, bufhex);
printf ("Your PBKDF2 is grub.pbkdf2.sha512.%d.%s.%s\n",
count, salthex, bufhex);
memset (buf, 0, buflen);
memset (bufhex, 0, 2 * buflen);
free (buf);

View file

@ -41,7 +41,7 @@ usage (int status)
printf ("\
Usage: %s [OPTIONS] PATH\n\
\n\
Make a system path relative to it's root.\n\
Make a system path relative to its root.\n\
\n\
Options:\n\
-h, --help display this message and exit\n\

View file

@ -30,6 +30,8 @@ target_cpu=@target_cpu@
native_platform=@platform@
pkglib_DATA="@pkglib_DATA@"
self=`basename $0`
multiboot_dir=${libdir}/$(echo ${PACKAGE_TARNAME} | sed ${transform})/i386-multiboot
coreboot_dir=${libdir}/$(echo ${PACKAGE_TARNAME} | sed ${transform})/i386-coreboot
qemu_dir=${libdir}/$(echo ${PACKAGE_TARNAME} | sed ${transform})/i386-qemu
@ -37,13 +39,14 @@ pc_dir=${libdir}/$(echo ${PACKAGE_TARNAME} | sed ${transform})/i386-pc
efi32_dir=${libdir}/$(echo ${PACKAGE_TARNAME} | sed ${transform})/i386-efi
efi64_dir=${libdir}/$(echo ${PACKAGE_TARNAME} | sed ${transform})/x86_64-efi
rom_directory=
override_dir=
grub_mkimage=${bindir}/`echo grub-mkimage | sed ${transform}`
# Usage: usage
# Print the usage.
usage () {
cat <<EOF
Usage: $0 [OPTION] SOURCE...
Usage: $self [OPTION] SOURCE...
Make GRUB rescue image.
-h, --help print this message and exit
@ -53,7 +56,7 @@ Make GRUB rescue image.
--rom-directory=DIR save rom images in DIR [optional]
--grub-mkimage=FILE use FILE as grub-mkimage
$0 generates a bootable rescue image with specified source files or directories.
$self generates a bootable rescue image with specified source files or directories.
Report bugs to <bug-grub@gnu.org>.
EOF
@ -66,7 +69,7 @@ for option in "$@"; do
usage
exit 0 ;;
-v | --version)
echo "$0 (GNU GRUB ${PACKAGE_VERSION})"
echo "$self (${PACKAGE_NAME}) ${PACKAGE_VERSION}"
exit 0 ;;
--modules=*)
modules=`echo "$option" | sed 's/--modules=//'` ;;

View file

@ -71,9 +71,6 @@ grub_getkey (void)
return -1;
}
struct grub_handler_class grub_term_input_class;
struct grub_handler_class grub_term_output_class;
void
grub_refresh (void)
{

View file

@ -22,6 +22,10 @@ transform="@program_transform_name@"
prefix=@prefix@
exec_prefix=@exec_prefix@
bindir=@bindir@
PACKAGE_NAME=@PACKAGE_NAME@
PACKAGE_VERSION=@PACKAGE_VERSION@
self=`basename $0`
grub_editenv=${bindir}/`echo grub-editenv | sed ${transform}`
rootdir=
@ -30,7 +34,7 @@ rootdir=
# Print the usage.
usage () {
cat <<EOF
Usage: $0 [OPTION] entry
Usage: $self [OPTION] entry
Set the default boot entry for GRUB, for the next boot only.
-h, --help print this message and exit
@ -51,7 +55,7 @@ for option in "$@"; do
usage
exit 0 ;;
-v | --version)
echo "grub-reboot (GNU GRUB ${PACKAGE_VERSION})"
echo "$self (${PACKAGE_NAME}) ${PACKAGE_VERSION}"
exit 0 ;;
--root-directory=*)
rootdir=`echo "$option" | sed 's/--root-directory=//'` ;;

View file

@ -26,8 +26,6 @@
#include <grub/parser.h>
#include <grub/script_sh.h>
#include <grub_script_check_init.h>
#define _GNU_SOURCE 1
#include <ctype.h>
@ -145,7 +143,8 @@ main (int argc, char *argv[])
char *input;
FILE *file = 0;
int verbose = 0;
struct grub_script *script;
int found_input = 0;
struct grub_script *script = NULL;
auto grub_err_t get_config_line (char **line, int cont);
grub_err_t get_config_line (char **line, int cont __attribute__ ((unused)))
@ -238,15 +237,13 @@ main (int argc, char *argv[])
}
}
/* Initialize all modules. */
grub_init_all ();
do
{
input = 0;
get_config_line(&input, 0);
if (! input)
break;
found_input = 1;
script = grub_script_parse (input, get_config_line);
if (script)
@ -258,9 +255,7 @@ main (int argc, char *argv[])
grub_free (input);
} while (script != 0);
/* Free resources. */
grub_fini_all ();
if (file) fclose (file);
return (script == 0);
return (found_input && script == 0);
}

View file

@ -22,6 +22,10 @@ transform="@program_transform_name@"
prefix=@prefix@
exec_prefix=@exec_prefix@
bindir=@bindir@
PACKAGE_NAME=@PACKAGE_NAME@
PACKAGE_VERSION=@PACKAGE_VERSION@
self=`basename $0`
grub_editenv=${bindir}/`echo grub-editenv | sed ${transform}`
rootdir=
@ -30,7 +34,7 @@ rootdir=
# Print the usage.
usage () {
cat <<EOF
Usage: $0 [OPTION] entry
Usage: $self [OPTION] entry
Set the default boot entry for GRUB.
-h, --help print this message and exit
@ -51,7 +55,7 @@ for option in "$@"; do
usage
exit 0 ;;
-v | --version)
echo "grub-set-default (GNU GRUB ${PACKAGE_VERSION})"
echo "$self (${PACKAGE_NAME}) ${PACKAGE_VERSION}"
exit 0 ;;
--root-directory=*)
rootdir=`echo "$option" | sed 's/--root-directory=//'` ;;

View file

@ -38,13 +38,31 @@ if [ "x${GRUB_DEFAULT}" = "xsaved" ] ; then GRUB_DEFAULT='${saved_entry}' ; fi
if [ "x${GRUB_TIMEOUT}" = "x" ] ; then GRUB_TIMEOUT=5 ; fi
if [ "x${GRUB_GFXMODE}" = "x" ] ; then GRUB_GFXMODE=640x480 ; fi
if [ "x${GRUB_DEFAULT_BUTTON}" = "x" ] ; then GRUB_DEFAULT_BUTTON="$GRUB_DEFAULT" ; fi
if [ "x${GRUB_DEFAULT_BUTTON}" = "xsaved" ] ; then GRUB_DEFAULT_BUTTON='${saved_entry}' ; fi
if [ "x${GRUB_TIMEOUT_BUTTON}" = "x" ] ; then GRUB_TIMEOUT_BUTTON="$GRUB_TIMEOUT" ; fi
cat << EOF
if [ -s \$prefix/grubenv ]; then
load_env
fi
EOF
if [ "x$GRUB_BUTTON_CMOS_ADDRESS" != "x" ]; then
cat <<EOF
if cmostest $GRUB_BUTTON_CMOS_ADDRESS ; then
set default="${GRUB_DEFAULT_BUTTON}"
else
set default="${GRUB_DEFAULT}"
fi
EOF
else
cat <<EOF
set default="${GRUB_DEFAULT}"
if [ \${prev_saved_entry} ]; then
set saved_entry=\${prev_saved_entry}
EOF
fi
cat <<EOF
if [ "\${prev_saved_entry}" ]; then
set saved_entry="\${prev_saved_entry}"
save_env saved_entry
set prev_saved_entry=
save_env prev_saved_entry
@ -52,8 +70,8 @@ if [ \${prev_saved_entry} ]; then
fi
function savedefault {
if [ -z \${boot_once} ]; then
saved_entry=\${chosen}
if [ -z "\${boot_once}" ]; then
saved_entry="\${chosen}"
save_env saved_entry
fi
}
@ -177,7 +195,7 @@ EOF
esac
# Gettext variables and module
if [ "x${LANG}" != "xC" ] ; then
if [ "x${LANG}" != "xC" ] && [ -d "${locale_dir}" ] ; then
prepare_grub_to_access_device $(${grub_probe} --target=device ${locale_dir})
cat << EOF
set locale_dir=(\$root)$(make_system_path_relative_to_its_root ${locale_dir})
@ -186,21 +204,36 @@ insmod gettext
EOF
fi
if [ "x${GRUB_HIDDEN_TIMEOUT}" != "x" ] ; then
if [ "x${GRUB_HIDDEN_TIMEOUT_QUIET}" = "xtrue" ] ; then
verbose=
else
verbose=" --verbose"
fi
cat << EOF
if sleep$verbose --interruptible ${GRUB_HIDDEN_TIMEOUT} ; then
set timeout=${GRUB_TIMEOUT}
make_timeout ()
{
if [ "x${1}" != "x" ] ; then
if [ "x${GRUB_HIDDEN_TIMEOUT_QUIET}" = "xtrue" ] ; then
verbose=
else
verbose=" --verbose"
fi
cat << EOF
if sleep$verbose --interruptible ${1} ; then
set timeout=${2}
fi
EOF
else
cat << EOF
set timeout=${GRUB_TIMEOUT}
else
cat << EOF
set timeout=${2}
EOF
fi
}
if [ "x$GRUB_BUTTON_CMOS_ADDRESS" != "x" ]; then
cat <<EOF
if cmostest $GRUB_BUTTON_CMOS_ADDRESS ; then
EOF
make_timeout "${GRUB_HIDDEN_TIMEOUT_BUTTON}" "${GRUB_TIMEOUT_BUTTON}"
echo else
make_timeout "${GRUB_HIDDEN_TIMEOUT}" "${GRUB_TIMEOUT}"
echo fi
else
make_timeout "${GRUB_HIDDEN_TIMEOUT}" "${GRUB_TIMEOUT}"
fi
# Play an initial tune

View file

@ -97,7 +97,7 @@ EOF
EOF
}
list=`for i in /boot/vmlinu[xz]-* /vmlinu[xz]-* ; do
list=`for i in /boot/vmlinu[zx]-* /vmlinu[zx]-* ; do
if grub_file_is_not_garbage "$i" ; then echo -n "$i " ; fi
done`
prepare_boot_cache=

View file

@ -33,6 +33,8 @@ host_os=@host_os@
pkglibdir=${libdir}/`echo ${PACKAGE_TARNAME}/${target_cpu}-${platform} | sed ${transform}`
localedir=@datadir@/locale
self=`basename $0`
grub_mkimage=${bindir}/`echo grub-mkimage | sed ${transform}`
grub_mkdevicemap=${sbindir}/`echo grub-mkdevicemap | sed ${transform}`
grub_probe=${sbindir}/`echo grub-probe | sed ${transform}`
@ -50,7 +52,7 @@ debug=no
# Print the usage.
usage () {
cat <<EOF
Usage: grub-install [OPTION]
Usage: $self [OPTION]
Install GRUB on your EFI partition.
-h, --help print this message and exit
@ -64,7 +66,7 @@ Install GRUB on your EFI partition.
--no-floppy do not probe any floppy drive
--recheck probe a device map even if it already exists
grub-install copies GRUB images into the DIR/boot directory specified by
$self copies GRUB images into the DIR/boot directory specified by
--root-directory.
Report bugs to <bug-grub@gnu.org>.
@ -78,7 +80,7 @@ for option in "$@"; do
usage
exit 0 ;;
-v | --version)
echo "grub-install (GNU GRUB ${PACKAGE_VERSION})"
echo "$self (${PACKAGE_NAME}) ${PACKAGE_VERSION}"
exit 0 ;;
--modules=*)
modules=`echo "$option" | sed 's/--modules=//'` ;;
@ -219,7 +221,7 @@ $grub_mkimage -O ${target_cpu}-efi --output=${grubdir}/grub.efi $modules || exit
echo "Installation finished. No error reported."
echo "This is the contents of the device map $device_map."
echo "Check if this is correct or not. If any of the lines is incorrect,"
echo "fix it and re-run the script \`grub-install'."
echo "fix it and re-run the script \`$self'."
echo
cat $device_map

View file

@ -76,9 +76,6 @@ grub_getkey (void)
return -1;
}
struct grub_handler_class grub_term_input_class;
struct grub_handler_class grub_term_output_class;
void
grub_refresh (void)
{
@ -126,8 +123,8 @@ setup (const char *dir,
/* There's always an embed region, and it starts right after the MBR. */
embed_region.start = 1;
if (embed_region.end > p->start)
embed_region.end = p->start;
if (embed_region.end > grub_partition_get_start (p))
embed_region.end = grub_partition_get_start (p);
return 0;
}
@ -147,8 +144,8 @@ setup (const char *dir,
/* If there's an embed region, it is in a dedicated partition. */
if (! memcmp (&gptdata.type, &grub_gpt_partition_type_bios_boot, 16))
{
embed_region.start = p->start;
embed_region.end = p->start + p->len;
embed_region.start = grub_partition_get_start (p);
embed_region.end = grub_partition_get_start (p) + grub_partition_get_len (p);
return 1;
}
@ -361,7 +358,7 @@ setup (const char *dir,
else
grub_util_error (_("No DOS-style partitions found"));
if (embed_region.end == embed_region.start)
if (embed_region.end <= embed_region.start)
{
if (! strcmp (dest_partmap, "msdos"))
grub_util_warn (_("This msdos-style partition label has no post-MBR gap; embedding won't be possible!"));
@ -702,7 +699,7 @@ main (int argc, char *argv[])
break;
case 'V':
printf ("grub-setup (%s) %s\n", PACKAGE_NAME, PACKAGE_VERSION);
printf ("%s (%s) %s\n", program_name, PACKAGE_NAME, PACKAGE_VERSION);
return 0;
case 'v':

View file

@ -34,6 +34,8 @@ target_cpu=@target_cpu@
platform=@platform@
pkglibdir=${libdir}/`echo ${PACKAGE_TARNAME}/${target_cpu}-${platform} | sed ${transform}`
self=`basename $0`
grub_mkimage=${bindir}/`echo grub-mkimage | sed ${transform}`
grub_mkdevicemap=${sbindir}/`echo grub-mkdevicemap | sed ${transform}`
grub_probe=${sbindir}/`echo grub-probe | sed ${transform}`
@ -53,7 +55,7 @@ nvsetenv=`which nvsetenv`
# Print the usage.
usage () {
cat <<EOF
Usage: grub-install [OPTION] [install_device]
Usage: $self [OPTION] [install_device]
Install GRUB on your drive.
-h, --help print this message and exit
@ -66,7 +68,7 @@ Install GRUB on your drive.
--grub-probe=FILE use FILE as grub-probe
--no-nvram don't update the boot-device NVRAM variable
grub-install copies GRUB images into the DIR/boot directory specified by
$self copies GRUB images into the DIR/boot directory specified by
--root-directory, and uses nvsetenv to set the Open Firmware boot-device
variable.
@ -81,7 +83,7 @@ for option in "$@"; do
usage
exit 0 ;;
-v | --version)
echo "grub-install (GNU GRUB ${PACKAGE_VERSION})"
echo "$self (${PACKAGE_NAME}) ${PACKAGE_VERSION}"
exit 0 ;;
--modules=*)
modules=`echo "$option" | sed 's/--modules=//'` ;;
@ -231,7 +233,7 @@ fi
echo "Installation finished. No error reported."
echo "This is the contents of the device map $device_map."
echo "Check if this is correct or not. If any of the lines is incorrect,"
echo "fix it and re-run the script \`grub-install'."
echo "fix it and re-run the script \`$self'."
echo
cat $device_map

View file

@ -30,9 +30,6 @@
#include <sys/time.h>
#include <unistd.h>
#include <time.h>
#ifdef HAVE_LIMITS_H
#include <limits.h>
#endif
#include <grub/kernel.h>
#include <grub/dl.h>

View file

@ -30,13 +30,15 @@ target_cpu=@target_cpu@
platform=@platform@
pkglibdir=${libdir}/`echo ${PACKAGE_TARNAME}/${target_cpu}-${platform} | sed ${transform}`
self=`basename $0`
grub_mkimage=${bindir}/`echo grub-mkimage | sed ${transform}`
# Usage: usage
# Print the usage.
usage () {
cat <<EOF
Usage: grub-mkrescue [OPTION] output_image
Usage: $self [OPTION] output_image
Make GRUB rescue image.
-h, --help print this message and exit
@ -46,7 +48,7 @@ Make GRUB rescue image.
default: ${pkglibdir}
--grub-mkimage=FILE use FILE as grub-mkimage
grub-mkimage generates a bootable rescue CD image for PowerMac and CHRP.
$self generates a bootable rescue CD image for PowerMac and CHRP.
Report bugs to <bug-grub@gnu.org>.
EOF
@ -61,7 +63,7 @@ for option in "$@"; do
usage
exit 0 ;;
-v | --version)
echo "grub-mkrescue (GNU GRUB ${PACKAGE_VERSION})"
echo "$self (${PACKAGE_NAME}) ${PACKAGE_VERSION}"
exit 0 ;;
--modules=*)
modules=`echo "$option" | sed 's/--modules=//'` ;;

View file

@ -102,9 +102,6 @@ grub_getkey (void)
return -1;
}
struct grub_handler_class grub_term_input_class;
struct grub_handler_class grub_term_output_class;
void
grub_refresh (void)
{
@ -503,7 +500,7 @@ parse_options (struct grub_setup_info *gp, int argc, char *argv[])
break;
case 'V':
printf ("grub-setup (%s) %s\n", PACKAGE_NAME, PACKAGE_VERSION);
printf ("%s (%s) %s\n", program_name, PACKAGE_NAME, PACKAGE_VERSION);
return 0;
case 'v':