Subject: [bug#27705] [PATCH v3 3/4] gnu: Add grub-hybrid.

From: Danny Milosavljevic <[email-masked]>
Date: Thu, 20 Jul 2017 21:44:46 +0200

* gnu/packages/bootloaders.scm (grub-hybrid): New variable.
---
 gnu/packages/bootloaders.scm | 24 ++++++++++++++++++++++++
 1 file changed, 24 insertions(+)

diff --git a/gnu/packages/bootloaders.scm b/gnu/packages/bootloaders.scm
index 7a91e32d9..9d18e7d9a 100644
--- a/gnu/packages/bootloaders.scm
+++ b/gnu/packages/bootloaders.scm
@@ -182,6 +182,30 @@ menu to select one of the installed operating systems.")
                                        "/bin/mcopy\"")))
                      #t))))))))))
 
+(define-public grub-hybrid
+  (package
+    (inherit grub-efi)
+    (name "grub-hybrid")
+    (synopsis "GRand Unified Boot loader (hybrid version)")
+    (inputs
+     `(("grub" ,grub)
+       ,@(package-inputs grub-efi)))
+    (arguments
+     (substitute-keyword-arguments (package-arguments grub-efi)
+      ((#:phases phases)
+      `(modify-phases ,phases
+         (add-after 'install 'install-non-efi
+           (lambda* (#:key inputs outputs #:allow-other-keys)
+             (let ((input-dir (string-append (assoc-ref inputs "grub") "/lib/grub"))
+                   (output-dir (string-append (assoc-ref outputs "out") "/lib/grub")))
+               (for-each
+                 (lambda (basename)
+                   (if (not (string-prefix? "." basename))
+                       (symlink (string-append input-dir "/" basename)
+                                (string-append output-dir "/" basename))))
+                 ((@@ (ice-9 ftw) scandir) input-dir))
+               #t)))))))))
+
 (define-public syslinux
   (let ((commit "bb41e935cc83c6242de24d2271e067d76af3585c"))
     (package