Subject: [PATCH 3/4] gnu: grub-efi: Add grub.

From: Danny Milosavljevic <[email-masked]>
Date: Sat, 15 Jul 2017 15:37:55 +0200

* gnu/packages/bootloaders.scm (grub-efi)[native-inputs]: Add grub.
[arguments]: Add phase "install-non-efi".
---
 gnu/packages/bootloaders.scm | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)

diff --git a/gnu/packages/bootloaders.scm b/gnu/packages/bootloaders.scm
index b6833dff6..f18402e21 100644
--- a/gnu/packages/bootloaders.scm
+++ b/gnu/packages/bootloaders.scm
@@ -152,6 +152,9 @@ menu to select one of the installed operating systems.")
      `(("efibootmgr" ,efibootmgr)
        ("mtools", mtools)
        ,@(package-inputs grub)))
+    (native-inputs
+     `(("grub" ,grub)
+       ,@(package-native-inputs grub)))
     (arguments
      `(;; TODO: Tests need a UEFI firmware for qemu. There is one at
        ;; https://github.com/tianocore/edk2/tree/master/OvmfPkg .
@@ -180,7 +183,15 @@ menu to select one of the installed operating systems.")
                        (("\"mcopy\"")
                         (string-append "\"" mtools
                                        "/bin/mcopy\"")))
-                     #t))))))))))
+                     #t)))
+               (add-after 'install 'install-non-efi
+                 (lambda* (#:key inputs outputs #:allow-other-keys)
+                   ;; grub-mkresuce can use it for making a hybrid image.
+                   (copy-recursively (string-append (assoc-ref inputs "grub")
+                                                    "/lib/grub/i386-pc")
+                                     (string-append (assoc-ref outputs "out")
+                                                    "/lib/grub/i386-pc"))
+                   #t)))))))))
 
 (define-public syslinux
   (let ((commit "bb41e935cc83c6242de24d2271e067d76af3585c"))