merge mainline into nested
This commit is contained in:
commit
dedb5f9be2
125 changed files with 7481 additions and 1152 deletions
|
@ -107,6 +107,7 @@ read_file (char *pathname, int (*hook) (grub_off_t ofs, char *buf, int len))
|
|||
return;
|
||||
}
|
||||
|
||||
grub_file_filter_disable_compression ();
|
||||
file = grub_file_open (pathname);
|
||||
if (!file)
|
||||
{
|
||||
|
|
|
@ -41,7 +41,8 @@ grub_mkdevicemap=${sbindir}/`echo grub-mkdevicemap | sed ${transform}`
|
|||
grub_probe=${sbindir}/`echo grub-probe | sed ${transform}`
|
||||
grub_editenv=${bindir}/`echo grub-editenv | sed ${transform}`
|
||||
rootdir=
|
||||
grub_prefix=`echo /boot/grub | sed ${transform}`
|
||||
bootdir=
|
||||
grubdir=`echo "/@bootdirname@/@grubdirname@" | sed 's,//*,/,g'`
|
||||
modules=
|
||||
|
||||
install_device=
|
||||
|
@ -69,8 +70,8 @@ Install GRUB on your drive.
|
|||
-h, --help print this message and exit
|
||||
-v, --version print the version information and exit
|
||||
--modules=MODULES pre-load specified modules MODULES
|
||||
--root-directory=DIR install GRUB images under the directory DIR
|
||||
instead of the root directory
|
||||
--boot-directory=DIR install GRUB images under the directory DIR/@grubdirname@
|
||||
instead of the $grubdir directory
|
||||
--grub-setup=FILE use FILE as grub-setup
|
||||
--grub-mkimage=FILE use FILE as grub-mkimage
|
||||
--grub-mkdevicemap=FILE use FILE as grub-mkdevicemap
|
||||
|
@ -88,11 +89,8 @@ fi
|
|||
|
||||
INSTALL_DEVICE can be a GRUB device name or a system device filename.
|
||||
|
||||
$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 $self will copy
|
||||
images into the operating system installation rooted at that directory.
|
||||
$self copies GRUB images into $grubdir, and uses grub-setup
|
||||
to install grub into the boot sector.
|
||||
|
||||
Report bugs to <bug-grub@gnu.org>.
|
||||
EOF
|
||||
|
@ -134,11 +132,17 @@ do
|
|||
--font=*)
|
||||
;;
|
||||
|
||||
# Accept for compatibility
|
||||
--root-directory)
|
||||
rootdir=`argument $option "$@"`; shift;;
|
||||
--root-directory=*)
|
||||
rootdir=`echo "$option" | sed 's/--root-directory=//'` ;;
|
||||
|
||||
--boot-directory)
|
||||
bootdir=`argument $option "$@"`; shift;;
|
||||
--boot-directory=*)
|
||||
bootdir=`echo "$option" | sed 's/--boot-directory=//'` ;;
|
||||
|
||||
--grub-setup)
|
||||
grub_setup=`argument $option "$@"`; shift;;
|
||||
--grub-setup=*)
|
||||
|
@ -215,23 +219,18 @@ if test $debug = yes; then
|
|||
setup_verbose="--verbose"
|
||||
fi
|
||||
|
||||
# Initialize these directories here, since ROOTDIR was initialized.
|
||||
case "$host_os" in
|
||||
netbsd* | openbsd*)
|
||||
# Because /boot is used for the boot block in NetBSD and OpenBSD, use /grub
|
||||
# instead of /boot/grub.
|
||||
grub_prefix=`echo /grub | sed ${transform}`
|
||||
bootdir=${rootdir}
|
||||
;;
|
||||
*)
|
||||
# Use /boot/grub by default.
|
||||
bootdir=${rootdir}/boot
|
||||
;;
|
||||
esac
|
||||
if [ -z "$bootdir" ]; then
|
||||
# Default bootdir if bootdir not initialized.
|
||||
bootdir=/@bootdirname@
|
||||
|
||||
grubdir=${bootdir}/`echo grub | sed ${transform}`
|
||||
if [ -n "$rootdir" ] ; then
|
||||
# Initialize bootdir if rootdir was initialized.
|
||||
bootdir=${rootdir}/@bootdirname@
|
||||
fi
|
||||
fi
|
||||
|
||||
grubdir=`echo "${bootdir}/@grubdirname@" | sed 's,//*,/,g'`
|
||||
device_map=${grubdir}/device.map
|
||||
|
||||
grub_probe="${grub_probe} --device-map=${device_map}"
|
||||
|
||||
# Check if GRUB is installed.
|
||||
|
|
|
@ -38,6 +38,8 @@ self=`basename $0`
|
|||
grub_mkdevicemap=${sbindir}/`echo grub-mkdevicemap | sed ${transform}`
|
||||
grub_probe=${sbindir}/`echo grub-probe | sed ${transform}`
|
||||
|
||||
GRUB_PREFIX=`echo '/@bootdirname@/@grubdirname@' | sed "s,//*,/,g"`
|
||||
|
||||
# Usage: usage
|
||||
# Print the usage.
|
||||
usage () {
|
||||
|
@ -93,18 +95,6 @@ done
|
|||
|
||||
. ${libdir}/grub/grub-mkconfig_lib
|
||||
|
||||
case "$host_os" in
|
||||
netbsd* | openbsd*)
|
||||
# Because /boot is used for the boot block in NetBSD and OpenBSD, use /grub
|
||||
# instead of /boot/grub.
|
||||
GRUB_PREFIX=`echo /grub | sed ${transform}`
|
||||
;;
|
||||
*)
|
||||
# Use /boot/grub by default.
|
||||
GRUB_PREFIX=`echo /boot/grub | sed ${transform}`
|
||||
;;
|
||||
esac
|
||||
|
||||
if [ "x$EUID" = "x" ] ; then
|
||||
EUID=`id -u`
|
||||
fi
|
||||
|
@ -158,7 +148,7 @@ GRUB_DEVICE_BOOT_UUID="`${grub_probe} --device ${GRUB_DEVICE_BOOT} --target=fs_u
|
|||
|
||||
# Filesystem for the device containing our userland. Used for stuff like
|
||||
# choosing Hurd filesystem module.
|
||||
GRUB_FS="`${grub_probe} --target=fs / 2> /dev/null || echo unknown`"
|
||||
GRUB_FS="`${grub_probe} --device ${GRUB_DEVICE} --target=fs 2> /dev/null || echo unknown`"
|
||||
|
||||
if test -f ${sysconfdir}/default/grub ; then
|
||||
. ${sysconfdir}/default/grub
|
||||
|
@ -200,7 +190,7 @@ for x in ${GRUB_TERMINAL_OUTPUT}; do
|
|||
exit 1
|
||||
fi
|
||||
else
|
||||
for dir in ${pkgdatadir} /boot/grub /usr/share/grub ; do
|
||||
for dir in ${pkgdatadir} ${GRUB_PREFIX} /usr/share/grub ; do
|
||||
for basename in unicode unifont ascii; do
|
||||
path="${dir}/${basename}.pf2"
|
||||
if is_path_readable_by_grub ${path} > /dev/null ; then
|
||||
|
|
|
@ -30,6 +30,9 @@ fi
|
|||
if test "x$grub_mkrelpath" = x; then
|
||||
grub_mkrelpath=${bindir}/`echo grub-mkrelpath | sed ${transform}`
|
||||
fi
|
||||
if test "x$grub_fstest" = x; then
|
||||
grub_fstest=${bindir}/`echo grub-fstest | sed ${transform}`
|
||||
fi
|
||||
|
||||
if $(which gettext >/dev/null 2>/dev/null) ; then
|
||||
gettext="gettext"
|
||||
|
@ -56,8 +59,11 @@ is_path_readable_by_grub ()
|
|||
return 1
|
||||
fi
|
||||
|
||||
# abort if file is in a filesystem we can't read
|
||||
if ${grub_probe} -t fs $path > /dev/null 2>&1 ; then : ; else
|
||||
# abort if file read through GRUB doesn't match file read through system
|
||||
# facilities
|
||||
device=$(${grub_probe} --target=device $path)
|
||||
relpath=$(${grub_mkrelpath} $path)
|
||||
if ${grub_fstest} $device cmp $relpath $path > /dev/null 2>&1 ; then : ; else
|
||||
return 1
|
||||
fi
|
||||
|
||||
|
|
|
@ -226,42 +226,9 @@ probe (const char *path, char *device_name)
|
|||
|
||||
if (print == PRINT_FS)
|
||||
{
|
||||
if (path)
|
||||
{
|
||||
struct stat st;
|
||||
|
||||
stat (path, &st);
|
||||
|
||||
if (S_ISREG (st.st_mode))
|
||||
{
|
||||
/* Regular file. Verify that we can read it properly. */
|
||||
|
||||
grub_file_t file;
|
||||
char *rel_path;
|
||||
grub_util_info ("reading %s via OS facilities", path);
|
||||
filebuf_via_sys = grub_util_read_image (path);
|
||||
|
||||
rel_path = grub_make_system_path_relative_to_its_root (path);
|
||||
grub_path = xasprintf ("(%s)%s", drive_name, rel_path);
|
||||
free (rel_path);
|
||||
grub_util_info ("reading %s via GRUB facilities", grub_path);
|
||||
file = grub_file_open (grub_path);
|
||||
if (! file)
|
||||
grub_util_error ("cannot open %s via GRUB facilities", grub_path);
|
||||
filebuf_via_grub = xmalloc (file->size);
|
||||
grub_file_read (file, filebuf_via_grub, file->size);
|
||||
|
||||
grub_util_info ("comparing");
|
||||
|
||||
if (memcmp (filebuf_via_grub, filebuf_via_sys, file->size))
|
||||
grub_util_error ("files differ");
|
||||
}
|
||||
}
|
||||
|
||||
printf ("%s\n", fs->name);
|
||||
}
|
||||
|
||||
if (print == PRINT_FS_UUID)
|
||||
else if (print == PRINT_FS_UUID)
|
||||
{
|
||||
char *uuid;
|
||||
if (! fs->uuid)
|
||||
|
@ -421,6 +388,13 @@ main (int argc, char *argv[])
|
|||
/* Initialize all modules. */
|
||||
grub_init_all ();
|
||||
|
||||
grub_lvm_fini ();
|
||||
grub_mdraid_fini ();
|
||||
grub_raid_fini ();
|
||||
grub_raid_init ();
|
||||
grub_mdraid_init ();
|
||||
grub_lvm_init ();
|
||||
|
||||
/* Do it. */
|
||||
if (argument_is_device)
|
||||
probe (NULL, argument);
|
||||
|
|
|
@ -29,6 +29,8 @@ self=`basename $0`
|
|||
|
||||
grub_editenv=${bindir}/`echo grub-editenv | sed ${transform}`
|
||||
rootdir=
|
||||
bootdir=
|
||||
grubdir=`echo "/@bootdirname@/@grubdirname@" | sed 's,//*,/,g'`
|
||||
|
||||
# Usage: usage
|
||||
# Print the usage.
|
||||
|
@ -39,8 +41,8 @@ Set the default boot entry for GRUB, for the next boot only.
|
|||
|
||||
-h, --help print this message and exit
|
||||
-v, --version print the version information and exit
|
||||
--root-directory=DIR expect GRUB images under the directory DIR
|
||||
instead of the root directory
|
||||
--boot-directory=DIR expect GRUB images under the directory DIR/@grubdirname@
|
||||
instead of the $grubdir directory
|
||||
|
||||
ENTRY is a number or a menu item title.
|
||||
|
||||
|
@ -73,11 +75,17 @@ do
|
|||
echo "$self (${PACKAGE_NAME}) ${PACKAGE_VERSION}"
|
||||
exit 0 ;;
|
||||
|
||||
# Accept for compatibility
|
||||
--root-directory)
|
||||
rootdir=`argument $option "$@"`; shift ;;
|
||||
--root-directory=*)
|
||||
rootdir=`echo "$option" | sed 's/--root-directory=//'` ;;
|
||||
|
||||
--boot-directory)
|
||||
bootdir=`argument $option "$@"`; shift;;
|
||||
--boot-directory=*)
|
||||
bootdir=`echo "$option" | sed 's/--boot-directory=//'` ;;
|
||||
|
||||
-*)
|
||||
echo "Unrecognized option \`$option'" 1>&2
|
||||
usage
|
||||
|
@ -99,21 +107,17 @@ if test "x$entry" = x; then
|
|||
exit 1
|
||||
fi
|
||||
|
||||
# Initialize these directories here, since ROOTDIR was initialized.
|
||||
case "$host_os" in
|
||||
netbsd* | openbsd*)
|
||||
# Because /boot is used for the boot block in NetBSD and OpenBSD, use /grub
|
||||
# instead of /boot/grub.
|
||||
grub_prefix=`echo /grub | sed ${transform}`
|
||||
bootdir=${rootdir}
|
||||
;;
|
||||
*)
|
||||
# Use /boot/grub by default.
|
||||
bootdir=${rootdir}/boot
|
||||
;;
|
||||
esac
|
||||
if [ -z "$bootdir" ]; then
|
||||
# Default bootdir if bootdir not initialized.
|
||||
bootdir=/@bootdirname@
|
||||
|
||||
grubdir=${bootdir}/`echo grub | sed ${transform}`
|
||||
if [ -n "$rootdir" ] ; then
|
||||
# Initialize bootdir if rootdir was initialized.
|
||||
bootdir=${rootdir}/@bootdirname@
|
||||
fi
|
||||
fi
|
||||
|
||||
grubdir=`echo "${bootdir}/@grubdirname@" | sed 's,//*,/,g'`
|
||||
|
||||
prev_saved_entry=`$grub_editenv ${grubdir}/grubenv list | sed -n 's/^saved_entry=//p'`
|
||||
if [ "$prev_saved_entry" ]; then
|
||||
|
|
|
@ -29,6 +29,8 @@ self=`basename $0`
|
|||
|
||||
grub_editenv=${bindir}/`echo grub-editenv | sed ${transform}`
|
||||
rootdir=
|
||||
bootdir=
|
||||
grubdir=`echo "/@bootdirname@/@grubdirname@" | sed 's,//*,/,g'`
|
||||
|
||||
# Usage: usage
|
||||
# Print the usage.
|
||||
|
@ -39,8 +41,8 @@ Set the default boot entry for GRUB.
|
|||
|
||||
-h, --help print this message and exit
|
||||
-v, --version print the version information and exit
|
||||
--root-directory=DIR expect GRUB images under the directory DIR
|
||||
instead of the root directory
|
||||
--boot-directory=DIR expect GRUB images under the directory DIR/@grubdirname@
|
||||
instead of the $grubdir directory
|
||||
|
||||
ENTRY is a number or a menu item title.
|
||||
|
||||
|
@ -73,11 +75,17 @@ do
|
|||
echo "$self (${PACKAGE_NAME}) ${PACKAGE_VERSION}"
|
||||
exit 0 ;;
|
||||
|
||||
# Accept for compatibility
|
||||
--root-directory)
|
||||
rootdir=`argument $option "$@"`; shift ;;
|
||||
--root-directory=*)
|
||||
rootdir=`echo "$option" | sed 's/--root-directory=//'` ;;
|
||||
|
||||
--boot-directory)
|
||||
bootdir=`argument $option "$@"`; shift;;
|
||||
--boot-directory=*)
|
||||
bootdir=`echo "$option" | sed 's/--boot-directory=//'` ;;
|
||||
|
||||
-*)
|
||||
echo "Unrecognized option \`$option'" 1>&2
|
||||
usage
|
||||
|
@ -99,21 +107,17 @@ if test "x$entry" = x; then
|
|||
exit 1
|
||||
fi
|
||||
|
||||
# Initialize these directories here, since ROOTDIR was initialized.
|
||||
case "$host_os" in
|
||||
netbsd* | openbsd*)
|
||||
# Because /boot is used for the boot block in NetBSD and OpenBSD, use /grub
|
||||
# instead of /boot/grub.
|
||||
grub_prefix=`echo /grub | sed ${transform}`
|
||||
bootdir=${rootdir}
|
||||
;;
|
||||
*)
|
||||
# Use /boot/grub by default.
|
||||
bootdir=${rootdir}/boot
|
||||
;;
|
||||
esac
|
||||
if [ -z "$bootdir" ]; then
|
||||
# Default bootdir if bootdir not initialized.
|
||||
bootdir=/@bootdirname@
|
||||
|
||||
grubdir=${bootdir}/`echo grub | sed ${transform}`
|
||||
if [ -n "$rootdir" ] ; then
|
||||
# Initialize bootdir if rootdir was initialized.
|
||||
bootdir=${rootdir}/@bootdirname@
|
||||
fi
|
||||
fi
|
||||
|
||||
grubdir=`echo "${bootdir}/@grubdirname@" | sed 's,//*,/,g'`
|
||||
|
||||
$grub_editenv ${grubdir}/grubenv unset prev_saved_entry
|
||||
$grub_editenv ${grubdir}/grubenv set saved_entry="$entry"
|
||||
|
|
|
@ -40,7 +40,7 @@ fi
|
|||
|
||||
osx_entry() {
|
||||
cat << EOF
|
||||
menuentry "${LONGNAME} (${2}-bit) (on ${DEVICE})" {
|
||||
menuentry "${LONGNAME} (${2}-bit) (on ${DEVICE})" --class osx --class darwin --class os {
|
||||
EOF
|
||||
save_default_entry | sed -e "s/^/\t/"
|
||||
prepare_grub_to_access_device ${DEVICE} | sed -e "s/^/\t/"
|
||||
|
@ -105,7 +105,7 @@ for OS in ${OSPROBED} ; do
|
|||
chain)
|
||||
|
||||
cat << EOF
|
||||
menuentry "${LONGNAME} (on ${DEVICE})" {
|
||||
menuentry "${LONGNAME} (on ${DEVICE})" --class windows --class os {
|
||||
EOF
|
||||
save_default_entry | sed -e "s/^/\t/"
|
||||
prepare_grub_to_access_device ${DEVICE} | sed -e "s/^/\t/"
|
||||
|
@ -147,7 +147,7 @@ EOF
|
|||
fi
|
||||
|
||||
cat << EOF
|
||||
menuentry "${LLABEL} (on ${DEVICE})" {
|
||||
menuentry "${LLABEL} (on ${DEVICE})" --class gnu-linux --class gnu --class os {
|
||||
EOF
|
||||
save_default_entry | sed -e "s/^/\t/"
|
||||
if [ -z "${prepare_boot_cache}" ]; then
|
||||
|
@ -174,7 +174,7 @@ EOF
|
|||
;;
|
||||
hurd)
|
||||
cat << EOF
|
||||
menuentry "${LONGNAME} (on ${DEVICE})" {
|
||||
menuentry "${LONGNAME} (on ${DEVICE})" --class hurd --class gnu --class os {
|
||||
EOF
|
||||
save_default_entry | sed -e "s/^/\t/"
|
||||
prepare_grub_to_access_device ${DEVICE} | sed -e "s/^/\t/"
|
||||
|
|
|
@ -454,6 +454,7 @@ unable_to_embed:
|
|||
|
||||
grub_disk_cache_invalidate_all ();
|
||||
|
||||
grub_file_filter_disable_compression ();
|
||||
file = grub_file_open (core_path_dev);
|
||||
if (file)
|
||||
{
|
||||
|
@ -524,6 +525,7 @@ unable_to_embed:
|
|||
}
|
||||
|
||||
/* Now read the core image to determine where the sectors are. */
|
||||
grub_file_filter_disable_compression ();
|
||||
file = grub_file_open (core_path_dev);
|
||||
if (! file)
|
||||
grub_util_error ("%s", grub_errmsg);
|
||||
|
@ -749,6 +751,13 @@ main (int argc, char *argv[])
|
|||
/* Initialize all modules. */
|
||||
grub_init_all ();
|
||||
|
||||
grub_lvm_fini ();
|
||||
grub_mdraid_fini ();
|
||||
grub_raid_fini ();
|
||||
grub_raid_init ();
|
||||
grub_mdraid_init ();
|
||||
grub_lvm_init ();
|
||||
|
||||
dest_dev = get_device_name (argv[optind]);
|
||||
if (! dest_dev)
|
||||
{
|
||||
|
|
|
@ -228,6 +228,7 @@ setup (const char *prefix, const char *dir,
|
|||
|
||||
grub_disk_cache_invalidate_all ();
|
||||
|
||||
grub_file_filter_disable_compression ();
|
||||
file = grub_file_open (core_path);
|
||||
if (file)
|
||||
{
|
||||
|
@ -297,6 +298,7 @@ setup (const char *prefix, const char *dir,
|
|||
}
|
||||
|
||||
/* Now read the core image to determine where the sectors are. */
|
||||
grub_file_filter_disable_compression ();
|
||||
file = grub_file_open (core_path);
|
||||
if (! file)
|
||||
grub_util_error ("%s", grub_errmsg);
|
||||
|
@ -612,6 +614,13 @@ main (int argc, char *argv[])
|
|||
/* Initialize all modules. */
|
||||
grub_init_all ();
|
||||
|
||||
grub_lvm_fini ();
|
||||
grub_mdraid_fini ();
|
||||
grub_raid_fini ();
|
||||
grub_raid_init ();
|
||||
grub_mdraid_init ();
|
||||
grub_lvm_init ();
|
||||
|
||||
find_dest_dev (&ginfo, argv);
|
||||
|
||||
ginfo.prefix = grub_make_system_path_relative_to_its_root (ginfo.dir ?
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue