* util/grub-install.c: Add new option --no-bootsector to skip

installing of bootsector. Accept --grub-setup=/bin/true as
	backwards-compatible synonym.
This commit is contained in:
Vladimir Serbinenko 2013-11-16 21:11:01 +01:00
parent cd46aa6cef
commit 55e2c84fe3
2 changed files with 34 additions and 13 deletions

View file

@ -1,3 +1,9 @@
2013-11-16 Vladimir Serbinenko <phcoder@gmail.com>
* util/grub-install.c: Add new option --no-bootsector to skip
installing of bootsector. Accept --grub-setup=/bin/true as
backwards-compatible synonym.
2013-11-16 Andrey Borzenkov <arvidjaar@gmail.com> 2013-11-16 Andrey Borzenkov <arvidjaar@gmail.com>
* util/grub-install.c (device_map_check_duplicates): Fix incorrect * util/grub-install.c (device_map_check_duplicates): Fix incorrect

View file

@ -67,6 +67,7 @@ static char * bootloader_id;
static int have_load_cfg = 0; static int have_load_cfg = 0;
static FILE * load_cfg_f = NULL; static FILE * load_cfg_f = NULL;
static char *load_cfg; static char *load_cfg;
static int install_bootsector = 1;
enum enum
{ {
@ -91,7 +92,8 @@ enum
OPTION_DEBUG, OPTION_DEBUG,
OPTION_DEBUG_IMAGE, OPTION_DEBUG_IMAGE,
OPTION_NO_FLOPPY, OPTION_NO_FLOPPY,
OPTION_DISK_MODULE OPTION_DISK_MODULE,
OPTION_NO_BOOTSECTOR
}; };
static int fs_probe = 1; static int fs_probe = 1;
@ -110,9 +112,13 @@ argp_parser (int key, char *arg, struct argp_state *state)
fs_probe = 0; fs_probe = 0;
return 0; return 0;
case OPTION_SETUP:
if (!grub_strstr (arg, "setup"))
install_bootsector = 0;
return 0;
/* Accept and ignore for compatibility. */ /* Accept and ignore for compatibility. */
case OPTION_FONT: case OPTION_FONT:
case OPTION_SETUP:
case OPTION_MKRELPATH: case OPTION_MKRELPATH:
case OPTION_PROBE: case OPTION_PROBE:
case OPTION_EDITENV: case OPTION_EDITENV:
@ -170,6 +176,10 @@ argp_parser (int key, char *arg, struct argp_state *state)
allow_floppy = 1; allow_floppy = 1;
return 0; return 0;
case OPTION_NO_BOOTSECTOR:
install_bootsector = 0;
return 0;
case OPTION_DEBUG: case OPTION_DEBUG:
verbosity++; verbosity++;
return 0; return 0;
@ -224,6 +234,10 @@ static struct argp_option options[] = {
{"no-nvram", OPTION_NO_NVRAM, 0, 0, {"no-nvram", OPTION_NO_NVRAM, 0, 0,
N_("don't update the `boot-device' NVRAM variable. " N_("don't update the `boot-device' NVRAM variable. "
"This option is only available on IEEE1275 targets."), 2}, "This option is only available on IEEE1275 targets."), 2},
{"skip-fs-probe",'s',0, 0,
N_("do not probe for filesystems in DEVICE"), 0},
{"no-bootsector", OPTION_NO_BOOTSECTOR, 0, 0,
N_("do not install bootsector"), 0},
{"debug", OPTION_DEBUG, 0, OPTION_HIDDEN, 0, 2}, {"debug", OPTION_DEBUG, 0, OPTION_HIDDEN, 0, 2},
{"no-floppy", OPTION_NO_FLOPPY, 0, OPTION_HIDDEN, 0, 2}, {"no-floppy", OPTION_NO_FLOPPY, 0, OPTION_HIDDEN, 0, 2},
@ -235,9 +249,6 @@ static struct argp_option options[] = {
N_("the ID of bootloader. This option is only available on EFI."), 2}, N_("the ID of bootloader. This option is only available on EFI."), 2},
{"efi-directory", OPTION_EFI_DIRECTORY, N_("DIR"), 0, {"efi-directory", OPTION_EFI_DIRECTORY, N_("DIR"), 0,
N_("use DIR as the EFI System Partition root."), 2}, N_("use DIR as the EFI System Partition root."), 2},
{"skip-fs-probe",'s',0, 0,
N_("do not probe for filesystems in DEVICE"), 0},
{0, 0, 0, 0, 0, 0} {0, 0, 0, 0, 0, 0}
}; };
@ -1388,7 +1399,8 @@ main (int argc, char *argv[])
"boot.img"); "boot.img");
grub_install_copy_file (boot_img_src, boot_img, 1); grub_install_copy_file (boot_img_src, boot_img, 1);
grub_util_info ("grub_bios_setup %s %s %s %s --directory='%s' --device-map='%s' '%s'", grub_util_info ("%sgrub_bios_setup %s %s %s %s --directory='%s' --device-map='%s' '%s'",
install_bootsector ? "" : "NOT RUNNING: ",
allow_floppy ? "--allow-floppy " : "", allow_floppy ? "--allow-floppy " : "",
verbosity ? "--verbose " : "", verbosity ? "--verbose " : "",
force ? "--force " : "", force ? "--force " : "",
@ -1398,9 +1410,10 @@ main (int argc, char *argv[])
install_device); install_device);
/* Now perform the installation. */ /* Now perform the installation. */
grub_util_bios_setup (platdir, "boot.img", "core.img", if (install_bootsector)
install_drive, force, grub_util_bios_setup (platdir, "boot.img", "core.img",
fs_probe, allow_floppy); install_drive, force,
fs_probe, allow_floppy);
break; break;
} }
case GRUB_INSTALL_PLATFORM_SPARC64_IEEE1275: case GRUB_INSTALL_PLATFORM_SPARC64_IEEE1275:
@ -1412,7 +1425,8 @@ main (int argc, char *argv[])
"boot.img"); "boot.img");
grub_install_copy_file (boot_img_src, boot_img, 1); grub_install_copy_file (boot_img_src, boot_img, 1);
grub_util_info ("grub_sparc_setup %s %s %s %s --directory='%s' --device-map='%s' '%s'", grub_util_info ("%sgrub_sparc_setup %s %s %s %s --directory='%s' --device-map='%s' '%s'",
install_bootsector ? "" : "NOT RUNNING: ",
allow_floppy ? "--allow-floppy " : "", allow_floppy ? "--allow-floppy " : "",
verbosity ? "--verbose " : "", verbosity ? "--verbose " : "",
force ? "--force " : "", force ? "--force " : "",
@ -1422,9 +1436,10 @@ main (int argc, char *argv[])
install_drive); install_drive);
/* Now perform the installation. */ /* Now perform the installation. */
grub_util_sparc_setup (platdir, "boot.img", "core.img", if (install_bootsector)
install_device, force, grub_util_sparc_setup (platdir, "boot.img", "core.img",
fs_probe, allow_floppy); install_device, force,
fs_probe, allow_floppy);
break; break;
} }