mirror of
https://codeberg.org/guix/guix.git
synced 2025-10-02 02:15:12 +00:00
system: Add store-directory-prefix to boot-parameters.
Fixes <http://issues.guix.gnu.org/44196> * gnu/machine/ssh.scm (roll-back-managed-host): Use boot-parameters-store-directory-prefix. * gnu/system.scm (define-module): Export boot-parameters-store-directory-prefix. (<boot-parameters>)[store-directory-prefix]: New field. It is used to generate the correct paths when /gnu/store is installed on a btrfs subvolume whose name doesn't match the final runtime path, as the bootloader doesn't have knowledge about the final mounting points. [boot-parameters-store-directory-prefix]: New accessor. (read-boot-parameters): Read directory-prefix from store field. (operating-system-boot-parameters-file): Add directory-prefix to store field. * guix/scripts/system.scm (reinstall-bootloader): Use boot-parameters-store-directory-prefix. * test/boot-parameters.scm (%default-btrfs-subvolume, %default-store-directory-prefix): New variables. (%grub-boot-parameters): Use %default-store-directory-prefix. (%default-operating-system): Use %default-btrfs-subvolume. (test-boot-parameters): Add directory-prefix. (test optional fields): Add test for directory-prefix. (test os store-directory-prefix): New test.
This commit is contained in:
parent
96d0f0b138
commit
582cf9257c
4 changed files with 48 additions and 4 deletions
|
@ -46,6 +46,9 @@
|
|||
(define %default-initrd (string-append %default-initrd-path "/initrd.cpio.gz"))
|
||||
(define %default-root-device (uuid "abcdef12-3456-7890-abcd-ef1234567890"))
|
||||
(define %default-store-device (uuid "01234567-89ab-cdef-0123-456789abcdef"))
|
||||
(define %default-btrfs-subvolume "testfs")
|
||||
(define %default-store-directory-prefix
|
||||
(string-append "/" %default-btrfs-subvolume))
|
||||
(define %default-store-mount-point (%store-prefix))
|
||||
(define %default-multiboot-modules '())
|
||||
(define %default-locale "es_ES.utf8")
|
||||
|
@ -63,6 +66,7 @@
|
|||
(multiboot-modules %default-multiboot-modules)
|
||||
(locale %default-locale)
|
||||
(store-device %default-store-device)
|
||||
(store-directory-prefix %default-store-directory-prefix)
|
||||
(store-mount-point %default-store-mount-point)))
|
||||
|
||||
(define %default-operating-system
|
||||
|
@ -81,7 +85,10 @@
|
|||
(file-system
|
||||
(device %default-store-device)
|
||||
(mount-point %default-store-mount-point)
|
||||
(type "btrfs"))
|
||||
(type "btrfs")
|
||||
(options
|
||||
(string-append "subvol="
|
||||
%default-btrfs-subvolume)))
|
||||
%base-file-systems))))
|
||||
|
||||
(define (quote-uuid uuid)
|
||||
|
@ -103,6 +110,7 @@
|
|||
(with-store #t)
|
||||
(store-device
|
||||
(quote-uuid %default-store-device))
|
||||
(store-directory-prefix %default-store-directory-prefix)
|
||||
(store-mount-point %default-store-mount-point))
|
||||
(define (generate-boot-parameters)
|
||||
(define (sexp-or-nothing fmt val)
|
||||
|
@ -117,10 +125,12 @@
|
|||
(sexp-or-nothing " (kernel-arguments ~S)" kernel-arguments)
|
||||
(sexp-or-nothing " (initrd ~S)" initrd)
|
||||
(if with-store
|
||||
(format #false " (store~a~a)"
|
||||
(format #false " (store~a~a~a)"
|
||||
(sexp-or-nothing " (device ~S)" store-device)
|
||||
(sexp-or-nothing " (mount-point ~S)"
|
||||
store-mount-point))
|
||||
store-mount-point)
|
||||
(sexp-or-nothing " (directory-prefix ~S)"
|
||||
store-directory-prefix))
|
||||
"")
|
||||
(sexp-or-nothing " (locale ~S)" locale)
|
||||
(sexp-or-nothing " (bootloader-name ~a)" bootloader-name)
|
||||
|
@ -149,6 +159,7 @@
|
|||
(test-read-boot-parameters #:store-device #false)
|
||||
(test-read-boot-parameters #:store-device 'false)
|
||||
(test-read-boot-parameters #:store-mount-point #false)
|
||||
(test-read-boot-parameters #:store-directory-prefix #false)
|
||||
(test-read-boot-parameters #:multiboot-modules #false)
|
||||
(test-read-boot-parameters #:locale #false)
|
||||
(test-read-boot-parameters #:bootloader-name #false
|
||||
|
@ -253,4 +264,10 @@
|
|||
(operating-system-boot-parameters %default-operating-system
|
||||
%default-root-device)))
|
||||
|
||||
(test-equal "from os, store-directory-prefix"
|
||||
%default-store-directory-prefix
|
||||
(boot-parameters-store-directory-prefix
|
||||
(operating-system-boot-parameters %default-operating-system
|
||||
%default-root-device)))
|
||||
|
||||
(test-end "boot-parameters")
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue