Merge branch 'master' into core-updates
[jackhill/guix/guix.git] / gnu / bootloader.scm
index 4e77974..4f2c71c 100644 (file)
   #:use-module (guix records)
   #:use-module (guix ui)
   #:use-module (srfi srfi-1)
-  #:export (bootloader
+  #:export (menu-entry
+            menu-entry?
+            menu-entry-label
+            menu-entry-device
+            menu-entry-linux
+            menu-entry-linux-arguments
+            menu-entry-initrd
+            menu-entry-device-mount-point
+
+            bootloader
             bootloader?
             bootloader-name
             bootloader-package
@@ -34,7 +43,7 @@
             bootloader-configuration
             bootloader-configuration?
             bootloader-configuration-bootloader
-            bootloader-configuration-device
+            bootloader-configuration-target
             bootloader-configuration-menu-entries
             bootloader-configuration-default-entry
             bootloader-configuration-timeout
             lookup-bootloader-by-name))
 
 \f
+;;;
+;;; Menu-entry record.
+;;;
+
+(define-record-type* <menu-entry>
+  menu-entry make-menu-entry
+  menu-entry?
+  (label           menu-entry-label)
+  (device          menu-entry-device       ; file system uuid, label, or #f
+                   (default #f))
+  (device-mount-point menu-entry-device-mount-point
+                   (default #f))
+  (linux           menu-entry-linux)
+  (linux-arguments menu-entry-linux-arguments
+                   (default '()))          ; list of string-valued gexps
+  (initrd          menu-entry-initrd))     ; file name of the initrd as a gexp
+
+\f
 ;;;
 ;;; Bootloader record.
 ;;;
   (bootloader                      bootloader-configuration-bootloader)    ; <bootloader>
   (device                          bootloader-configuration-device         ; string
                                    (default #f))
+  (target                          %bootloader-configuration-target         ; string
+                                   (default #f))
   (menu-entries                    bootloader-configuration-menu-entries   ; list of <boot-parameters>
                                    (default '()))
   (default-entry                   bootloader-configuration-default-entry  ; integer
   (additional-configuration        bootloader-configuration-additional-configuration ; record
                                    (default #f)))
 
+(define (bootloader-configuration-target config)
+  (or (%bootloader-configuration-target config)
+      (let ((device (bootloader-configuration-device config)))
+        (when device
+          (warning
+           (G_ "The 'device' field of bootloader configurations is deprecated.~%"))
+          (warning (G_ "Use 'target' instead.~%")))
+        device)))
+
 \f
 ;;;
 ;;; Bootloaders.
   "Return the list of bootloader modules."
   (all-modules (map (lambda (entry)
                       `(,entry . "gnu/bootloader"))
-                    %load-path)))
+                    %load-path)
+               #:warn warn-about-load-error))
 
 (define %bootloaders
   ;; The list of publically-known bootloaders.