diff --git a/.bzrignore b/.bzrignore index aa9c4ff84..c124c9280 100644 --- a/.bzrignore +++ b/.bzrignore @@ -2,6 +2,7 @@ 10_* 30_os-prober 40_custom +41_custom aclocal.m4 ascii.bitmaps ascii.h diff --git a/ChangeLog b/ChangeLog index aababc845..e2f240f40 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,77 @@ +2010-06-17 Colin Watson + + Fix i386-pc prefix handling with nested partitions (Debian bug + #585068). Note that the case where the core image is booted using + multiboot and relocated from its original location still requires + more work. + + * kern/i386/pc/init.c (make_install_device): If the prefix starts + with "(,", fill the boot drive in between those two characters, but + expect that a full partition specification including partition map + names will follow. + * util/i386/pc/grub-setup.c (setup): Unless an explicit prefix was + specified, write a prefix without the drive name but including a + full partition specification. + +2010-06-16 Colin Watson + + * util/grub-mkconfig.in: Ignore non-option arguments, for + compatibility with older versions (before 2010-06-12) which did the + same. In particular, this makes it easier to ship an update-grub + wrapper which is compatible with that used with GRUB Legacy (Debian + bug #586056). + +2010-06-14 Grégoire Sutre + + * Makefile.in (install-local): Use $$file.h2m instead of $$dest.h2m + for manual page generation. + +2010-06-14 Grégoire Sutre + + * po/POTFILES: Remove leftover commands/handler.c. + +2010-06-14 Colin Watson + + * util/grub-mkconfig.in: Remove vestige of old argument parsing that + left this script non-functional. + +2010-06-14 Colin Watson + + * docs/man/grub-emu.h2m: New file. + +2010-06-13 Colin Watson + + * docs/grub.texi (Commands): Document reduced command set in rescue + mode. + (cpuid): New section. + +2010-06-13 Grégoire Sutre + + * kern/emu/hostdisk.c (grub_util_biosdisk_get_grub_dev): Use the + new partition naming style. + * util/grub-install.in: Adapt sed subtitutions in grub-probe calls. + +2010-06-12 BVK Chaitanya + + Add "-o grub.iso" like cmdline options support. + + * util/grub-install.in: Improve cmdline option parsing. + * util/grub-mkconfig.in: Likewise. + * util/grub-mkrescue.in: Likewise. + * util/grub-reboot.in: Likewise. + * util/grub-set-default.in: Likewise. + * util/i386/efi/grub-install.in: Likewise. + * util/ieee1275/grub-install.in: Likewise. + * util/powerpc/ieee1275/grub-mkrescue.in: Likewise. + +2010-06-12 Colin Watson + + * .bzrignore: Ignore 41_custom. + +2010-06-12 Thomas Schmitt + + * util/grub-mkrescue.in: Pass unrecognized options to xorriso. + 2010-06-12 Colin Watson Avoid false positives in fs.lst, partmap.lst, and video.lst due to diff --git a/Makefile.in b/Makefile.in index afe4beb6e..b9b7f3d08 100644 --- a/Makefile.in +++ b/Makefile.in @@ -323,26 +323,26 @@ install-local: all if test -f "$$file"; then dir=; else dir="$(srcdir)/"; fi; \ dest="`echo $$file | sed 's,.*/,,' | sed '$(transform)'`"; \ $(INSTALL_PROGRAM) $$dir$$file $(DESTDIR)$(bindir)/$$dest; \ - $(HELP2MAN) --section=1 -i $(srcdir)/docs/man/$$dest.h2m -o $(DESTDIR)$(mandir)/man1/$$dest.1 $(builddir)/$$file; \ + $(HELP2MAN) --section=1 -i $(srcdir)/docs/man/$$file.h2m -o $(DESTDIR)$(mandir)/man1/$$dest.1 $(builddir)/$$file; \ done $(SHELL) $(mkinstalldirs) $(DESTDIR)$(sbindir) $(DESTDIR)$(mandir)/man8 @list='$(sbin_UTILITIES)'; for file in $$list; do \ if test -f "$$file"; then dir=; else dir="$(srcdir)/"; fi; \ dest="`echo $$file | sed 's,.*/,,' | sed '$(transform)'`"; \ $(INSTALL_PROGRAM) $$dir$$file $(DESTDIR)$(sbindir)/$$dest; \ - $(HELP2MAN) --section=8 -i $(srcdir)/docs/man/$$dest.h2m -o $(DESTDIR)$(mandir)/man8/$$dest.8 $(builddir)/$$file; \ + $(HELP2MAN) --section=8 -i $(srcdir)/docs/man/$$file.h2m -o $(DESTDIR)$(mandir)/man8/$$dest.8 $(builddir)/$$file; \ done @list='$(bin_SCRIPTS)'; for file in $$list; do \ if test -f "$$file"; then dir=; else dir="$(srcdir)/"; fi; \ dest="`echo $$file | sed 's,.*/,,' | sed '$(transform)'`"; \ $(INSTALL_SCRIPT) $$dir$$file $(DESTDIR)$(bindir)/$$dest; \ - $(HELP2MAN) --section=1 -i $(srcdir)/docs/man/$$dest.h2m -o $(DESTDIR)$(mandir)/man1/$$dest.1 $(builddir)/$$file; \ + $(HELP2MAN) --section=1 -i $(srcdir)/docs/man/$$file.h2m -o $(DESTDIR)$(mandir)/man1/$$dest.1 $(builddir)/$$file; \ done @list='$(sbin_SCRIPTS)'; for file in $$list; do \ if test -f "$$file"; then dir=; else dir="$(srcdir)/"; fi; \ dest="`echo $$file | sed 's,.*/,,' | sed '$(transform)'`"; \ $(INSTALL_SCRIPT) $$dir$$file $(DESTDIR)$(sbindir)/$$dest; \ - $(HELP2MAN) --section=8 -i $(srcdir)/docs/man/$$dest.h2m -o $(DESTDIR)$(mandir)/man8/$$dest.8 $(builddir)/$$file; \ + $(HELP2MAN) --section=8 -i $(srcdir)/docs/man/$$file.h2m -o $(DESTDIR)$(mandir)/man8/$$dest.8 $(builddir)/$$file; \ done $(SHELL) $(mkinstalldirs) $(DESTDIR)$(sysconfdir)/grub.d @list='$(grub-mkconfig_SCRIPTS)'; for file in $$list; do \ diff --git a/docs/grub.texi b/docs/grub.texi index cea9f6a31..822849777 100644 --- a/docs/grub.texi +++ b/docs/grub.texi @@ -1388,6 +1388,10 @@ the global section of the configuration file (or ``menu''); most of them can be entered on the command-line and can be used either anywhere in the menu or specifically in the menu entries. +In rescue mode, only the @command{insmod} (@pxref{insmod}), @command{ls} +(@pxref{ls}), @command{set} (@pxref{set}), and @command{unset} +(@pxref{unset}) commands are normally available. + @menu * Menu-specific commands:: * General commands:: @@ -1548,6 +1552,7 @@ you forget a command, you can run the command @command{help} * chainloader:: Chain-load another boot loader * cmp:: Compare two files * configfile:: Load a configuration file +* cpuid:: Check for CPU features * crc:: Calculate CRC32 checksums * date:: Display or set current date and time * drivemap:: Map a drive to another @@ -1669,6 +1674,20 @@ Load @var{file} as a configuration file. @end deffn +@node cpuid +@subsection cpuid + +@deffn Command cpuid [-l] +Check for CPU features. This command is only available on x86 systems. + +With the @option{-l} option, return true if the CPU supports long mode +(64-bit). + +If invoked without options, this command currently behaves as if it had been +invoked with @option{-l}. This may change in the future. +@end deffn + + @node crc @subsection crc diff --git a/docs/man/grub-emu.h2m b/docs/man/grub-emu.h2m new file mode 100644 index 000000000..09a1f88c1 --- /dev/null +++ b/docs/man/grub-emu.h2m @@ -0,0 +1,2 @@ +[NAME] +grub-emu \- GRUB emulator diff --git a/kern/emu/hostdisk.c b/kern/emu/hostdisk.c index 47389195c..bc37e9949 100644 --- a/kern/emu/hostdisk.c +++ b/kern/emu/hostdisk.c @@ -992,6 +992,11 @@ grub_util_biosdisk_fini (void) grub_disk_dev_unregister (&grub_util_biosdisk_dev); } +/* + * Note: we do not use the new partition naming scheme as dos_part does not + * necessarily correspond to an msdos partition. See e.g. the FreeBSD code + * in function grub_util_biosdisk_get_grub_dev. + */ static char * make_device_name (int drive, int dos_part, int bsd_part) { @@ -1400,11 +1405,9 @@ grub_util_biosdisk_get_grub_dev (const char *os_dev) For NetBSD, proceed as for Linux, except that the start sector is obtained from the disk label. */ { - char *name; + char *name, *partname; grub_disk_t disk; grub_disk_addr_t start; - int dos_part = -1; - int bsd_part = -1; auto int find_partition (grub_disk_t dsk, const grub_partition_t partition); @@ -1419,17 +1422,7 @@ grub_util_biosdisk_get_grub_dev (const char *os_dev) if (start == part_start) { - if (partition->parent) - { - dos_part = partition->parent->number; - bsd_part = partition->number; - } - else - { - dos_part = partition->number; - bsd_part = -1; - } - + partname = grub_partition_get_name (partition); return 1; } @@ -1465,6 +1458,7 @@ grub_util_biosdisk_get_grub_dev (const char *os_dev) if (! disk) return 0; + partname = NULL; grub_partition_iterate (disk, find_partition); if (grub_errno != GRUB_ERR_NONE) { @@ -1472,7 +1466,7 @@ grub_util_biosdisk_get_grub_dev (const char *os_dev) return 0; } - if (dos_part < 0) + if (partname == NULL) { grub_disk_close (disk); grub_error (GRUB_ERR_BAD_DEVICE, @@ -1480,7 +1474,9 @@ grub_util_biosdisk_get_grub_dev (const char *os_dev) return 0; } - return make_device_name (drive, dos_part, bsd_part); + name = grub_xasprintf ("%s,%s", disk->name, partname); + free (partname); + return name; } #elif defined(__GNU__) @@ -1525,7 +1521,7 @@ grub_util_biosdisk_get_grub_dev (const char *os_dev) for (p = os_dev + 5; *p; ++p) if (grub_isdigit(*p)) { - p = strchr (p, 's'); + p = strchr (p, 's'); /* msdos or apple (or ... ?) partition map */ if (p) { p++; diff --git a/kern/i386/pc/init.c b/kern/i386/pc/init.c index d81b1e117..8cbc757b2 100644 --- a/kern/i386/pc/init.c +++ b/kern/i386/pc/init.c @@ -83,6 +83,14 @@ make_install_device (void) grub_snprintf (ptr, sizeof (dev) - (ptr - dev), ")%s", grub_prefix); grub_strcpy (grub_prefix, dev); } + else if (grub_prefix[1] == ',' || grub_prefix[1] == ')') + { + /* We have a prefix, but still need to fill in the boot drive. */ + grub_snprintf (dev, sizeof (dev), + "(%cd%u%s", (grub_boot_drive & 0x80) ? 'h' : 'f', + grub_boot_drive & 0x7f, grub_prefix + 1); + grub_strcpy (grub_prefix, dev); + } return grub_prefix; } diff --git a/po/POTFILES b/po/POTFILES index d2c579edb..cfa1e33cb 100644 --- a/po/POTFILES +++ b/po/POTFILES @@ -12,7 +12,6 @@ commands/efi/fixvideo.c commands/efi/loadbios.c commands/gptsync.c commands/halt.c -commands/handler.c commands/hdparm.c commands/help.c commands/hexdump.c diff --git a/util/grub-install.in b/util/grub-install.in index 1e7fc1f2e..c7e087dd0 100644 --- a/util/grub-install.in +++ b/util/grub-install.in @@ -103,8 +103,23 @@ Report bugs to . EOF } +argument () { + opt=$1 + shift + + if test $# -eq 0; then + echo "$0: option requires an argument -- '$opt'" 1>&2 + exit 1 + fi + echo $1 +} + # Check the arguments. -for option in "$@"; do +while test $# -gt 0 +do + option=$1 + shift + case "$option" in -h | --help) usage @@ -112,33 +127,62 @@ for option in "$@"; do -v | --version) echo "$self (${PACKAGE_NAME}) ${PACKAGE_VERSION}" exit 0 ;; + + --modules) + modules=`argument $option "$@"`; shift;; --modules=*) modules=`echo "$option" | sed 's/--modules=//'` ;; + + --font) + font=`argument $option "$@"`; shift;; --font=*) font=`echo "$option" | sed 's/--font=//'` ;; + + --root-directory) + rootdir=`argument $option "$@"`; shift;; --root-directory=*) rootdir=`echo "$option" | sed 's/--root-directory=//'` ;; + + --grub-setup) + grub_setup=`argument $option "$@"`; shift;; --grub-setup=*) grub_setup=`echo "$option" | sed 's/--grub-setup=//'` ;; + + --grub-mkimage) + grub_mkimage=`argument $option "$@"`; shift;; --grub-mkimage=*) grub_mkimage=`echo "$option" | sed 's/--grub-mkimage=//'` ;; + + --grub-mkdevicemap) + grub_mkdevicemap=`argument $option "$@"`; shift;; --grub-mkdevicemap=*) grub_mkdevicemap=`echo "$option" | sed 's/--grub-mkdevicemap=//'` ;; + + --grub-probe) + grub_probe=`argument $option "$@"`; shift;; --grub-probe=*) grub_probe=`echo "$option" | sed 's/--grub-probe=//'` ;; + --no-floppy) no_floppy="--no-floppy" ;; --recheck) recheck=yes ;; + + --disk-module) + if [ "${target_cpu}-${platform}" = "i386-pc" ] ; then + disk_module=`argument $option "$@"`; shift; + fi ;; --disk-module=*) if [ "${target_cpu}-${platform}" = "i386-pc" ] ; then disk_module=`echo "$option" | sed 's/--disk-module=//'` fi ;; + # This is an undocumented feature... --debug) debug=yes ;; -f | --force) setup_force="--force" ;; + -*) echo "Unrecognized option \`$option'" 1>&2 usage @@ -312,12 +356,12 @@ if [ "x${devabstraction_module}" = "x" ] ; then else install_drive="`$grub_probe --target=drive --device ${install_device}`" || exit 1 fi - install_drive="`echo ${install_drive} | sed -e s/,[0-9]*[a-z]*//g`" + install_drive="`echo ${install_drive} | sed -e s/,[a-z0-9,]*//g`" fi grub_drive="`$grub_probe --target=drive --device ${grub_device}`" || exit 1 # Strip partition number - grub_drive="`echo ${grub_drive} | sed -e s/,[0-9]*[a-z]*//g`" + grub_drive="`echo ${grub_drive} | sed -e s/,[a-z0-9,]*//g`" if [ "$disk_module" = ata ] ; then # generic method (used on coreboot and ata mod) uuid="`$grub_probe --target=fs_uuid --device ${grub_device}`" diff --git a/util/grub-mkconfig.in b/util/grub-mkconfig.in index 6bdc166c9..fb475af6a 100644 --- a/util/grub-mkconfig.in +++ b/util/grub-mkconfig.in @@ -52,14 +52,23 @@ Report bugs to . EOF } +argument () { + opt=$1 + shift + + if test $# -eq 0; then + echo "$0: option requires an argument -- '$opt'" 1>&2 + exit 1 + fi + echo $1 +} + # 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 +while test $# -gt 0 +do + option=$1 + shift + case "$option" in -h | --help) usage @@ -67,9 +76,8 @@ for option in "$@"; do -v | --version) echo "$self (${PACKAGE_NAME}) ${PACKAGE_VERSION}" exit 0 ;; - -o) - next_grub_cfg=: - ;; + -o | --output) + grub_cfg=`argument $option "$@"`; shift;; --output=*) grub_cfg=`echo "$option" | sed 's/--output=//'` ;; @@ -78,13 +86,9 @@ for option in "$@"; do usage exit 1 ;; + # Explicitly ignore non-option arguments, for compatibility. esac done -if $next_grub_cfg; then - echo "Missing argument to \`-o'" 1>&2 - usage - exit 1 -fi . ${libdir}/grub/grub-mkconfig_lib diff --git a/util/grub-mkrescue.in b/util/grub-mkrescue.in index 90c031882..36cce31ec 100644 --- a/util/grub-mkrescue.in +++ b/util/grub-mkrescue.in @@ -53,20 +53,38 @@ Make GRUB rescue image. -h, --help print this message and exit -v, --version print the version information and exit - --output=FILE save output in FILE [required] + -o, --output=FILE save output in FILE [required] --modules=MODULES pre-load specified modules MODULES --rom-directory=DIR save rom images in DIR [optional] --xorriso=FILE use FILE as xorriso [optional] --grub-mkimage=FILE use FILE as grub-mkimage -$self generates a bootable rescue image with specified source files or directories. +$self generates a bootable rescue image with specified source files, source +directories, or mkisofs options listed by: xorriso -as mkisofs -help +Option -- switches to native xorriso command mode. or directories. Report bugs to . +Mail xorriso support requests to . EOF } +argument () { + opt=$1 + shift + + if test $# -eq 0; then + echo "$0: option requires an argument -- '$opt'" 1>&2 + exit 1 + fi + echo $1 +} + # Check the arguments. -for option in "$@"; do +while test $# -gt 0 +do + option=$1 + shift + case "$option" in -h | --help) usage @@ -74,29 +92,47 @@ for option in "$@"; do -v | --version) echo "$self (${PACKAGE_NAME}) ${PACKAGE_VERSION}" exit 0 ;; + + --modules) + modules=`argument $option "$@"`; shift ;; --modules=*) modules=`echo "$option" | sed 's/--modules=//'` ;; + + -o | --output) + output_image=`argument $option "$@"`; shift ;; --output=*) output_image=`echo "$option" | sed 's/--output=//'` ;; + + --rom-directory) + rom_directory=`argument $option "$@"`; shift ;; --rom-directory=*) rom_directory=`echo "$option" | sed 's/--rom-directory=//'` ;; + # Intentionally undocumented + --override-directory) + override_dir=`argument $option "$@"` + shift + PATH=${override_dir}:$PATH + export PATH + ;; --override-directory=*) override_dir=`echo "${option}/" | sed 's/--override-directory=//'` PATH=${override_dir}:$PATH export PATH ;; + + --grub-mkimage) + grub_mkimage=`argument $option "$@"`; shift ;; --grub-mkimage=*) grub_mkimage=`echo "$option" | sed 's/--grub-mkimage=//'` ;; + + --xorriso) + xorriso=`argument $option "$@"`; shift ;; --xorriso=*) xorriso=`echo "${option}/" | sed 's/--xorriso=//'` ;; - -*) - echo "Unrecognized option \`$option'" 1>&2 - usage - exit 1 - ;; + *) - source="${source} ${option}" ;; + source="${source} ${option} $@"; break ;; esac done diff --git a/util/grub-reboot.in b/util/grub-reboot.in index 2c49f5e13..e7a41f68f 100644 --- a/util/grub-reboot.in +++ b/util/grub-reboot.in @@ -48,8 +48,23 @@ Report bugs to . EOF } +argument () { + opt=$1 + shift + + if test $# -eq 0; then + echo "$0: option requires an argument -- '$opt'" 1>&2 + exit 1 + fi + echo $1 +} + # Check the arguments. -for option in "$@"; do +while test $# -gt 0 +do + option=$1 + shift + case "$option" in -h | --help) usage @@ -57,8 +72,12 @@ for option in "$@"; do -v | --version) echo "$self (${PACKAGE_NAME}) ${PACKAGE_VERSION}" exit 0 ;; + + --root-directory) + rootdir=`argument $option "$@"`; shift ;; --root-directory=*) rootdir=`echo "$option" | sed 's/--root-directory=//'` ;; + -*) echo "Unrecognized option \`$option'" 1>&2 usage diff --git a/util/grub-set-default.in b/util/grub-set-default.in index d8059bfaa..389c504c7 100644 --- a/util/grub-set-default.in +++ b/util/grub-set-default.in @@ -48,8 +48,23 @@ Report bugs to . EOF } +argument () { + opt=$1 + shift + + if test $# -eq 0; then + echo "$0: option requires an argument -- '$opt'" 1>&2 + exit 1 + fi + echo $1 +} + # Check the arguments. -for option in "$@"; do +while test $# -gt 0 +do + option=$1 + shift + case "$option" in -h | --help) usage @@ -57,8 +72,12 @@ for option in "$@"; do -v | --version) echo "$self (${PACKAGE_NAME}) ${PACKAGE_VERSION}" exit 0 ;; + + --root-directory) + rootdir=`argument $option "$@"`; shift ;; --root-directory=*) rootdir=`echo "$option" | sed 's/--root-directory=//'` ;; + -*) echo "Unrecognized option \`$option'" 1>&2 usage diff --git a/util/i386/efi/grub-install.in b/util/i386/efi/grub-install.in index 258381485..7fc78b434 100644 --- a/util/i386/efi/grub-install.in +++ b/util/i386/efi/grub-install.in @@ -73,8 +73,23 @@ Report bugs to . EOF } +argument () { + opt=$1 + shift + + if test $# -eq 0; then + echo "$0: option requires an argument -- '$opt'" 1>&2 + exit 1 + fi + echo $1 +} + # Check the arguments. -for option in "$@"; do +while test $# -gt 0 +do + option=$1 + shift + case "$option" in -h | --help) usage @@ -82,16 +97,32 @@ for option in "$@"; do -v | --version) echo "$self (${PACKAGE_NAME}) ${PACKAGE_VERSION}" exit 0 ;; + + --modules) + modules=`argument $option "$@"`; shift ;; --modules=*) modules=`echo "$option" | sed 's/--modules=//'` ;; + + --root-directory) + rootdir=`argument $option "$@"`; shift ;; --root-directory=*) rootdir=`echo "$option" | sed 's/--root-directory=//'` ;; + + --grub-mkimage) + grub_mkimage=`argument $option "$@"`; shift ;; --grub-mkimage=*) grub_mkimage=`echo "$option" | sed 's/--grub-mkimage=//'` ;; + + --grub-mkdevicemap) + grub_mkdevicemap=`argument $option "$@"`; shift ;; --grub-mkdevicemap=*) grub_mkdevicemap=`echo "$option" | sed 's/--grub-mkdevicemap=//'` ;; + + --grub-probe) + grub_probe=`argument $option "$@"`; shift ;; --grub-probe=*) grub_probe=`echo "$option" | sed 's/--grub-probe=//'` ;; + --no-floppy) no_floppy="--no-floppy" ;; --recheck) diff --git a/util/i386/pc/grub-setup.c b/util/i386/pc/grub-setup.c index f0baf1c89..454fba9fa 100644 --- a/util/i386/pc/grub-setup.c +++ b/util/i386/pc/grub-setup.c @@ -99,6 +99,7 @@ setup (const char *dir, struct grub_boot_blocklist *first_block, *block; grub_int32_t *install_dos_part, *install_bsd_part; grub_int32_t dos_part, bsd_part; + char *prefix; char *tmp_img; int i; grub_disk_addr_t first_sector; @@ -230,6 +231,8 @@ setup (const char *dir, + GRUB_KERNEL_MACHINE_INSTALL_DOS_PART); install_bsd_part = (grub_int32_t *) (core_img + GRUB_DISK_SECTOR_SIZE + GRUB_KERNEL_MACHINE_INSTALL_BSD_PART); + prefix = (char *) (core_img + GRUB_DISK_SECTOR_SIZE + + GRUB_KERNEL_MACHINE_PREFIX); /* Open the root device and the destination device. */ root_dev = grub_device_open (root); @@ -305,6 +308,18 @@ setup (const char *dir, dos_part = root_dev->disk->partition->number; bsd_part = -1; } + + if (prefix[0] != '(') + { + char *root_part_name, *new_prefix; + + root_part_name = + grub_partition_get_name (root_dev->disk->partition); + new_prefix = xasprintf ("(,%s)%s", root_part_name, prefix); + strcpy (prefix, new_prefix); + free (new_prefix); + free (root_part_name); + } } else dos_part = bsd_part = -1; diff --git a/util/ieee1275/grub-install.in b/util/ieee1275/grub-install.in index 72135213d..98fd5d65a 100644 --- a/util/ieee1275/grub-install.in +++ b/util/ieee1275/grub-install.in @@ -76,8 +76,23 @@ Report bugs to . EOF } +argument () { + opt=$1 + shift + + if test $# -eq 0; then + echo "$0: option requires an argument -- '$opt'" 1>&2 + exit 1 + fi + echo $1 +} + # Check the arguments. -for option in "$@"; do +while test $# -gt 0 +do + option=$1 + shift + case "$option" in -h | --help) usage @@ -85,16 +100,32 @@ for option in "$@"; do -v | --version) echo "$self (${PACKAGE_NAME}) ${PACKAGE_VERSION}" exit 0 ;; + + --modules) + modules=`argument $option "$@"`; shift ;; --modules=*) modules=`echo "$option" | sed 's/--modules=//'` ;; + + --root-directory) + rootdir=`argument $option "$@"`; shift ;; --root-directory=*) rootdir=`echo "$option" | sed 's/--root-directory=//'` ;; + + --grub-mkdevicemap) + grub_mkdevicemap=`argument $option "$@"`; shift ;; --grub-mkdevicemap=*) grub_mkdevicemap=`echo "$option" | sed 's/--grub-mkdevicemap=//'` ;; + + --grub-mkimage) + grub_mkimage=`argument $option "$@"`; shift ;; --grub-mkimage=*) grub_mkimage=`echo "$option" | sed 's/--grub-mkimage=//'` ;; + + --grub-probe) + grub_probe=`argument $option "$@"`; shift ;; --grub-probe=*) grub_probe=`echo "$option" | sed 's/--grub-probe=//'` ;; + --no-nvram) update_nvram=no ;; # This is an undocumented feature... diff --git a/util/powerpc/ieee1275/grub-mkrescue.in b/util/powerpc/ieee1275/grub-mkrescue.in index d79627862..4ef26f616 100644 --- a/util/powerpc/ieee1275/grub-mkrescue.in +++ b/util/powerpc/ieee1275/grub-mkrescue.in @@ -54,10 +54,25 @@ Report bugs to . EOF } +argument () { + opt=$1 + shift + + if test $# -eq 0; then + echo "$0: option requires an argument -- '$opt'" 1>&2 + exit 1 + fi + echo $1 +} + input_dir=${pkglibdir} # Check the arguments. -for option in "$@"; do +while test $# -gt 0 +do + option=$1 + shift + case "$option" in -h | --help) usage @@ -65,12 +80,22 @@ for option in "$@"; do -v | --version) echo "$self (${PACKAGE_NAME}) ${PACKAGE_VERSION}" exit 0 ;; + + --modules) + modules=`argument $option "$@"`; shift ;; --modules=*) modules=`echo "$option" | sed 's/--modules=//'` ;; + + --pkglibdir) + input_dir=`argument $option "$@"`; shift ;; --pkglibdir=*) input_dir=`echo "$option" | sed 's/--pkglibdir=//'` ;; + + --grub-mkimage) + grub_mkimage=`argument $option "$@"`; shift ;; --grub-mkimage=*) grub_mkimage=`echo "$option" | sed 's/--grub-mkimage=//'` ;; + -*) echo "Unrecognized option \`$option'" 1>&2 usage