grub/util/grub.d
Konrad Rzeszutek Wilk a8e0f1adf7 Fix util/grub.d/20_linux_xen.in: Add xen_boot command support for aarch64
Commit d33045ce7f introduced
the support for this, but it does not work under x86 (as it stops
20_linux_xen from running).

The 20_linux_xen is run under a shell and any exits from within it:

(For example on x86):
+ /usr/bin/grub2-file --is-arm64-efi /boot/xen-4.9.0.gz
[root@tst063 grub]# echo $?
1

will result in 20_linux_xen exiting without continuing
and also causing grub2-mkconfig to stop processing.

As in:

 [root@tst063 grub]# ./grub-mkconfig | tail
 Generating grub configuration file ...
 Found linux image: /boot/vmlinuz-4.13.0-0.rc5.git1.1.fc27.x86_64
 Found initrd image: /boot/initramfs-4.13.0-0.rc5.git1.1.fc27.x86_64.img
 Found linux image: /boot/vmlinuz-0-rescue-ec082ee24aea41b9b16aca52a6d10cc2
 Found initrd image: /boot/initramfs-0-rescue-ec082ee24aea41b9b16aca52a6d10cc2.img
 		echo	'Loading Linux 0-rescue-ec082ee24aea41b9b16aca52a6d10cc2 ...'
 		linux	/vmlinuz-0-rescue-ec082ee24aea41b9b16aca52a6d10cc2 root=/dev/mapper/fedora_tst063-root ro single
 		echo	'Loading initial ramdisk ...'
 		initrd	/initramfs-0-rescue-ec082ee24aea41b9b16aca52a6d10cc2.img
 	}
 }

 ### END /usr/local/etc/grub.d/10_linux ###

 ### BEGIN /usr/local/etc/grub.d/20_linux_xen ###

 root@tst063 grub]#

And no more.

This patch wraps the invocation of grub-file to be a in subshell
and to process the return value in a conditional. That fixes
the issue.

RH-BZ 1486002: grub2-mkconfig does not work if xen.gz is installed.

CC: Fu Wei <fu.wei@linaro.org>
Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
2017-09-07 23:25:29 +02:00
..
00_header.in grub-mkconfig: use $pkgdatadir in scripts 2015-04-29 19:18:54 +03:00
10_hurd.in grub-mkconfig: use $pkgdatadir in scripts 2015-04-29 19:18:54 +03:00
10_illumos.in grub-mkconfig: use $pkgdatadir in scripts 2015-04-29 19:18:54 +03:00
10_kfreebsd.in grub-mkconfig: use $pkgdatadir in scripts 2015-04-29 19:18:54 +03:00
10_linux.in 10_linux: Fix grouping of tests for GRUB_DEVICE 2016-03-06 08:51:07 +03:00
10_netbsd.in grub-mkconfig: use $pkgdatadir in scripts 2015-04-29 19:18:54 +03:00
10_windows.in grub-mkconfig: use $pkgdatadir in scripts 2015-04-29 19:18:54 +03:00
10_xnu.in xnu: Add new kernel path to autoconfig. 2016-02-12 15:42:26 +01:00
20_linux_xen.in Fix util/grub.d/20_linux_xen.in: Add xen_boot command support for aarch64 2017-09-07 23:25:29 +02:00
30_os-prober.in xnu: Add new kernel path to autoconfig. 2016-02-12 15:42:26 +01:00
40_custom.in 2009-09-10 Robert Millan <rmh.grub@aybabtu.com> 2009-09-10 12:53:25 +00:00
41_custom.in * grub-core/normal/main.c (read_config_file): Provide config_file and 2012-05-27 15:34:41 +02:00
README 2007-05-04 Robert Millan <rmh@aybabtu.com> 2007-05-04 07:11:44 +00:00

All executable files in this directory are processed in shell expansion order.

  00_*: Reserved for 00_header.
  10_*: Native boot entries.
  20_*: Third party apps (e.g. memtest86+).

The number namespace in-between is configurable by system installer and/or
administrator.  For example, you can add an entry to boot another OS as
01_otheros, 11_otheros, etc, depending on the position you want it to occupy in
the menu; and then adjust the default setting via /etc/default/grub.