merge trunk

This commit is contained in:
Colin Watson 2011-01-05 11:57:17 +00:00
commit 80e9f2bce8
88 changed files with 5729 additions and 258 deletions

View file

@ -485,12 +485,15 @@ compare_devices (const void *a, const void *b)
{
const struct device *left = (const struct device *) a;
const struct device *right = (const struct device *) b;
int ret;
ret = strcmp (left->kernel, right->kernel);
if (ret)
return ret;
else
return strcmp (left->stable, right->stable);
if (left->kernel && right->kernel)
{
int ret = strcmp (left->kernel, right->kernel);
if (ret)
return ret;
}
return strcmp (left->stable, right->stable);
}
#endif /* __linux__ */
@ -533,6 +536,10 @@ grub_util_iterate_devices (int NESTED_FUNC_ATTR (*hook) (const char *, int),
necessary. */
for (entry = readdir (dir); entry; entry = readdir (dir))
{
/* Skip current and parent directory entries. */
if (strcmp (entry->d_name, ".") == 0 ||
strcmp (entry->d_name, "..") == 0)
continue;
/* Skip partition entries. */
if (strstr (entry->d_name, "-part"))
continue;

View file

@ -56,9 +56,6 @@ debug_image=
update_nvram=yes
ofpathname="`which ofpathname`"
nvsetenv="`which nvsetenv`"
efibootmgr="`which efibootmgr 2>/dev/null || true`"
removable=no
efi_quiet=
@ -585,6 +582,8 @@ if [ "${target_cpu}-${platform}" = "i386-pc" ] || [ "${target_cpu}-${platform}"
--device-map="${device_map}" "${install_device}" || exit 1
elif [ "${target_cpu}-${platform}" = "i386-ieee1275" ] || [ "${target_cpu}-${platform}" = "powerpc-ieee1275" ]; then
if [ x"$update_nvram" = xyes ]; then
ofpathname="`which ofpathname`"
nvsetenv="`which nvsetenv`"
set "$ofpathname" dummy
if test -f "$1"; then
:
@ -621,6 +620,7 @@ elif [ x"$platform" = xefi ]; then
cp "${grubdir}/core.${imgext}" "${efidir}/${efi_file}"
# Try to make this image bootable using the EFI Boot Manager, if available.
efibootmgr="`which efibootmgr`"
if test "$removable" = no && test -n "$efi_distributor" && \
test -n "$efibootmgr"; then
# On Linux, we need the efivars kernel modules.
@ -648,7 +648,7 @@ elif [ x"$platform" = xefi ]; then
efidir_disk="$(echo "$clean_devmap" | grep "^$(echo "$efidir_drive" | sed 's/,[^)]*//')" | cut -f2)"
efidir_part="$(echo "$efidir_drive" | sed 's/^([^,]*,[^0-9]*//; s/[^0-9].*//')"
efibootmgr $efi_quiet -c -d "$efidir_disk" -p "$efidir_part" -w \
-L "$GRUB_DISTRIBUTOR" -l "\\EFI\\$efi_distributor\\$efi_file"
-L "$bootloader_id" -l "\\EFI\\$efi_distributor\\$efi_file"
fi
fi
fi

View file

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

View file

@ -1146,11 +1146,18 @@ main (int argc, char *argv[])
{
FT_Face ft_face;
int size;
FT_Error err;
if (FT_New_Face (ft_lib, argv[optind], font_index, &ft_face))
err = FT_New_Face (ft_lib, argv[optind], font_index, &ft_face);
if (err)
{
grub_util_info ("can't open file %s, index %d", argv[optind],
font_index);
grub_printf ("can't open file %s, index %d: error %d", argv[optind],
font_index, err);
if (err > 0 && err < (signed) ARRAY_SIZE (ft_errmsgs))
printf (": %s\n", ft_errmsgs[err]);
else
printf ("\n");
continue;
}
@ -1170,7 +1177,8 @@ main (int argc, char *argv[])
font_info.style = ft_face->style_flags;
font_info.size = size;
FT_Set_Pixel_Sizes (ft_face, size, size);
if (FT_Set_Pixel_Sizes (ft_face, size, size))
grub_util_error ("can't set %dx%d font size", size, size);
add_font (&font_info, ft_face, file_format != PF2);
FT_Done_Face (ft_face);
}

View file

@ -142,6 +142,7 @@ probe (const char *path, char *device_name)
int is_raid5 = 0;
int is_raid6 = 0;
int raid_level;
grub_disk_t raid_disk;
raid_level = probe_raid_level (dev->disk);
if (raid_level >= 0)
@ -149,6 +150,7 @@ probe (const char *path, char *device_name)
is_raid = 1;
is_raid5 |= (raid_level == 5);
is_raid6 |= (raid_level == 6);
raid_disk = dev->disk;
}
if ((is_lvm) && (dev->disk->dev->memberlist))
@ -161,6 +163,7 @@ probe (const char *path, char *device_name)
is_raid = 1;
is_raid5 |= (raid_level == 5);
is_raid6 |= (raid_level == 6);
raid_disk = list->disk;
}
tmp = list->next;
@ -175,8 +178,8 @@ probe (const char *path, char *device_name)
printf ("raid5rec ");
if (is_raid6)
printf ("raid6rec ");
if (dev->disk->dev->raidname)
printf ("%s ", dev->disk->dev->raidname (dev->disk));
if (raid_disk->dev->raidname)
printf ("%s ", raid_disk->dev->raidname (raid_disk));
}
if (is_lvm)

View file

@ -73,6 +73,7 @@ main (int argc, char *argv[])
{
char *argument;
char *input;
int lineno = 0;
FILE *file = 0;
int verbose = 0;
int found_input = 0;
@ -111,6 +112,7 @@ main (int argc, char *argv[])
cmdline[i] = '\0';
}
lineno++;
*line = grub_strdup (cmdline);
free (cmdline);
@ -189,5 +191,11 @@ main (int argc, char *argv[])
if (file) fclose (file);
return (found_input && script == 0);
if (found_input && script == 0)
{
fprintf (stderr, "error: line no: %u\n", lineno);
return 1;
}
return 0;
}

View file

@ -493,7 +493,7 @@ unable_to_embed:
"setup by using blocklists. However, blocklists are UNRELIABLE and "
"their use is discouraged."));
if (! force)
grub_util_error (_("if you really want blocklists, use --force"));
grub_util_error (_("will not proceed with blocklists"));
/* The core image must be put on a filesystem unfortunately. */
grub_util_info ("will leave the core image on the filesystem");

View file

@ -23,7 +23,7 @@ prefix=@prefix@
exec_prefix=@exec_prefix@
libdir=@libdir@
locale_dir=`echo ${GRUB_PREFIX}/locale | sed ${transform}`
grub_lang=`echo $LANG | cut -d _ -f 1`
grub_lang=`echo $LANG | cut -d . -f 1`
. ${libdir}/grub/grub-mkconfig_lib

View file

@ -81,14 +81,16 @@ do
menuentry "${OS} ${KERNEL}" ${CLASS} {
EOF
prepare_grub_to_access_device ${GRUB_DEVICE_BOOT} | sed -e "s/^/\t/"
message="$(gettext_printf "Loading GNU Mach ...")"
cat << EOF
echo '$(gettext_quoted "Loading GNU Mach ...")'
echo '$message'
multiboot ${kernel} root=device:${GRUB_DEVICE#/dev/}
EOF
save_default_entry | sed -e "s/^/\t/"
prepare_grub_to_access_device ${GRUB_DEVICE} | sed -e "s/^/\t/"
message="$(gettext_printf "Loading the Hurd ...")"
cat << EOF
echo '$(gettext_quoted "Loading the Hurd ...")'
echo '$message'
module /hurd/${hurd_fs}.static ${hurd_fs} --readonly \\
--multiboot-command-line='\${kernel-command-line}' \\
--host-priv-port='\${host-port}' \\
@ -103,13 +105,15 @@ EOF
menuentry "${OS} ${KERNEL} (recovery mode)" ${CLASS} {
EOF
prepare_grub_to_access_device ${GRUB_DEVICE_BOOT} | sed -e "s/^/\t/"
message="$(gettext_printf "Loading GNU Mach ...")"
cat << EOF
echo '$(gettext_quoted "Loading GNU Mach ...")'
echo '$message'
multiboot ${kernel} root=device:${GRUB_DEVICE#/dev/} -s
EOF
prepare_grub_to_access_device ${GRUB_DEVICE} | sed -e "s/^/\t/"
message="$(gettext_printf "Loading the Hurd ...")"
cat << EOF
echo '$(gettext_quoted "Loading the Hurd ...")'
echo '$message'
module /hurd/${hurd_fs}.static ${hurd_fs} \\
--multiboot-command-line='\${kernel-command-line}' \\
--host-priv-port='\${host-port}' \\

View file

@ -84,8 +84,9 @@ kfreebsd_entry ()
fi
printf '%s\n' "${prepare_boot_cache}"
message="$(gettext_printf "Loading kernel of FreeBSD %s ..." ${version})"
cat << EOF
echo '$(printf "$(gettext_quoted "Loading kernel of FreeBSD %s ...")" ${version})'
echo '$message'
kfreebsd ${rel_dirname}/${basename} ${args}
EOF

View file

@ -94,13 +94,15 @@ EOF
prepare_boot_cache="$(prepare_grub_to_access_device ${GRUB_DEVICE_BOOT} | sed -e "s/^/\t/")"
fi
printf '%s\n' "${prepare_boot_cache}"
message="$(gettext_printf "Loading Linux %s ..." ${version})"
cat << EOF
echo '$(printf "$(gettext_quoted "Loading Linux %s ...")" ${version})'
echo '$message'
linux ${rel_dirname}/${basename} root=${linux_root_device_thisversion} ro ${args}
EOF
if test -n "${initrd}" ; then
message="$(gettext_printf "Loading initial ramdisk ...")"
cat << EOF
echo '$(gettext_quoted "Loading initial ramdisk ...")'
echo '$message'
initrd ${rel_dirname}/${initrd}
EOF
fi

View file

@ -60,11 +60,11 @@ linux_entry ()
args="$5"
xen_args="$6"
if ${recovery} ; then
title="$(gettext_quoted "%s, with Linux %s and XEN %s (recovery mode)")"
title="$(gettext_quoted "%s, with Xen %s and Linux %s (recovery mode)")"
else
title="$(gettext_quoted "%s, with Linux %s and XEN %s")"
title="$(gettext_quoted "%s, with Xen %s and Linux %s")"
fi
printf "menuentry '${title}' ${CLASS} {\n" "${os}" "${version}" "${xen_version}"
printf "menuentry '${title}' ${CLASS} {\n" "${os}" "${xen_version}" "${version}"
if ! ${recovery} ; then
save_default_entry | sed -e "s/^/\t/"
fi
@ -73,14 +73,18 @@ linux_entry ()
prepare_boot_cache="$(prepare_grub_to_access_device ${GRUB_DEVICE_BOOT} | sed -e "s/^/\t/")"
fi
printf '%s\n' "${prepare_boot_cache}"
xmessage="$(gettext_printf "Loading Xen %s ..." ${xen_version})"
lmessage="$(gettext_printf "Loading Linux %s ..." ${version})"
cat << EOF
echo '$(printf "$(gettext_quoted "Loading Linux %s ...")" ${version})'
echo '$xmessage'
multiboot ${rel_xen_dirname}/${xen_basename} placeholder ${xen_args}
echo '$lmessage'
module ${rel_dirname}/${basename} placeholder root=${linux_root_device_thisversion} ro ${args}
EOF
if test -n "${initrd}" ; then
message="$(gettext_printf "Loading initial ramdisk ...")"
cat << EOF
echo '$(gettext_quoted "Loading initial ramdisk ...")'
echo '$message'
module ${rel_dirname}/${initrd}
EOF
fi

View file

@ -111,7 +111,7 @@ EOF
prepare_grub_to_access_device ${DEVICE} | sed -e "s/^/\t/"
case ${LONGNAME} in
Windows\ Vista*|Windows\ 7*)
Windows\ Vista*|Windows\ 7*|Windows\ Server\ 2008*)
;;
*)
cat << EOF