diff options
author | Miguel Ángel Arruga Vivas <rosen644835@gmail.com> | 2020-10-24 18:15:53 +0200 |
---|---|---|
committer | Miguel Ángel Arruga Vivas <rosen644835@gmail.com> | 2020-11-01 02:28:38 +0100 |
commit | 582cf9257cd1f9c969fbba5eb1c336ac8b975cde (patch) | |
tree | 579aa251535713503cb1f5611a67ea1523338b5e /gnu | |
parent | 96d0f0b13819a68480e204716c1af6605cfdcb4c (diff) | |
download | guix-582cf9257cd1f9c969fbba5eb1c336ac8b975cde.tar.gz |
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.
Diffstat (limited to 'gnu')
-rw-r--r-- | gnu/machine/ssh.scm | 3 | ||||
-rw-r--r-- | gnu/system.scm | 23 |
2 files changed, 25 insertions, 1 deletions
diff --git a/gnu/machine/ssh.scm b/gnu/machine/ssh.scm index 5020bd362f..a3a12fb54b 100644 --- a/gnu/machine/ssh.scm +++ b/gnu/machine/ssh.scm @@ -482,6 +482,8 @@ an environment type of 'managed-host." (list (second boot-parameters)))) (locale -> (boot-parameters-locale (second boot-parameters))) + (store-dir -> (boot-parameters-store-directory-prefix + (second boot-parameters))) (old-entries -> (map boot-parameters->menu-entry (drop boot-parameters 2))) (bootloader -> (operating-system-bootloader @@ -492,6 +494,7 @@ an environment type of 'managed-host." bootloader)) bootloader entries #:locale locale + #:store-directory-prefix store-dir #:old-entries old-entries))) (remote-result (machine-remote-eval machine remote-exp))) (when (eqv? 'error remote-result) diff --git a/gnu/system.scm b/gnu/system.scm index a3122eaa65..ff9ab18f22 100644 --- a/gnu/system.scm +++ b/gnu/system.scm @@ -148,6 +148,7 @@ boot-parameters-bootloader-name boot-parameters-bootloader-menu-entries boot-parameters-store-device + boot-parameters-store-directory-prefix boot-parameters-store-mount-point boot-parameters-locale boot-parameters-kernel @@ -293,12 +294,17 @@ directly by the user." ;; understand that. The 'root-device', on the other hand, corresponds ;; exactly to the device field of the <file-system> object representing the ;; OS's root file system, so it might be a device path like "/dev/sda3". + ;; The 'store-directory-prefix' field contains #f or the store path inside + ;; the 'store-device' as it is seen by GRUB, e.g. it would contain + ;; "/storefs" if the store is located in that subvolume of a btrfs + ;; partition. (root-device boot-parameters-root-device) (bootloader-name boot-parameters-bootloader-name) (bootloader-menu-entries ;list of <menu-entry> boot-parameters-bootloader-menu-entries) (store-device boot-parameters-store-device) (store-mount-point boot-parameters-store-mount-point) + (store-directory-prefix boot-parameters-store-directory-prefix) (locale boot-parameters-locale) (kernel boot-parameters-kernel) (kernel-arguments boot-parameters-kernel-arguments) @@ -394,6 +400,17 @@ file system labels." (_ ;the old format root-device)))) + (store-directory-prefix + (match (assq 'store rest) + (('store . store-data) + (match (assq 'directory-prefix store-data) + (('directory-prefix prefix) prefix) + ;; No directory-prefix found. + (_ #f))) + (_ + ;; No store found, old format. + #f))) + (store-mount-point (match (assq 'store rest) (('store ('device _) ('mount-point mount-point) _ ...) @@ -1294,6 +1311,7 @@ such as '--root' and '--load' to <boot-parameters>." (let* ((initrd (and (not (operating-system-hurd os)) (operating-system-initrd-file os))) (store (operating-system-store-file-system os)) + (file-systems (operating-system-file-systems os)) (locale (operating-system-locale os)) (bootloader (bootloader-configuration-bootloader (operating-system-bootloader os))) @@ -1315,6 +1333,7 @@ such as '--root' and '--load' to <boot-parameters>." (bootloader-configuration-menu-entries (operating-system-bootloader os))) (locale locale) (store-device (ensure-not-/dev (file-system-device store))) + (store-directory-prefix (btrfs-store-subvolume-file-name file-systems)) (store-mount-point (file-system-mount-point store))))) (define (device->sexp device) @@ -1371,7 +1390,9 @@ being stored into the \"parameters\" file)." (device #$(device->sexp (boot-parameters-store-device params))) (mount-point #$(boot-parameters-store-mount-point - params)))) + params)) + (directory-prefix + #$(boot-parameters-store-directory-prefix params)))) #:set-load-path? #f))) (define-gexp-compiler (operating-system-compiler (os <operating-system>) |