summary refs log tree commit diff
path: root/gnu
diff options
context:
space:
mode:
authorDanny Milosavljevic <dannym@scratchpost.org>2017-07-21 01:06:47 +0200
committerDanny Milosavljevic <dannym@scratchpost.org>2017-08-03 16:35:34 +0200
commitdd4b7476ec2c8c1d790f1366173a15bd6042eeee (patch)
tree93f2900ea01fe912f9d9567eb14b292d89c27488 /gnu
parent75e6639f364d77378edbc10022bca09040336a56 (diff)
downloadguix-dd4b7476ec2c8c1d790f1366173a15bd6042eeee.tar.gz
gnu: Add grub-hybrid.
* gnu/packages/bootloaders.scm (grub-hybrid): New variable.
Diffstat (limited to 'gnu')
-rw-r--r--gnu/packages/bootloaders.scm33
1 files changed, 33 insertions, 0 deletions
diff --git a/gnu/packages/bootloaders.scm b/gnu/packages/bootloaders.scm
index 34b8953aa7..c0d16b6c88 100644
--- a/gnu/packages/bootloaders.scm
+++ b/gnu/packages/bootloaders.scm
@@ -183,6 +183,39 @@ menu to select one of the installed operating systems.")
                                        "/bin/mcopy\"")))
                      #t))))))))))
 
+;; Because grub searches hardcoded paths it's easiest to just build grub
+;; again to make it find both grub-pc and grub-efi.  There is a command
+;; line argument which allows you to specify ONE platform - but
+;; grub-mkrescue will use multiple platforms if they are available
+;; in the installation directory (without command line argument).
+(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)
+       ((#:modules modules `((guix build utils) (guix build gnu-build-system)))
+        `((ice-9 ftw) ,@modules))
+       ((#: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))))
+                  (scandir input-dir))
+                 #t)))))))))
+
 (define-public syslinux
   (let ((commit "bb41e935cc83c6242de24d2271e067d76af3585c"))
     (package