GNU bug report logs -
#69343
[PATCH 00/12] Simplify bootloader data structures and procedures
Previous Next
Full log
View this message in rfc822 format
From: Felix Lechner <felix.lechner <at> lease-up.com>
* guix/scripts/system.scm
(profile->boot-alternatives)[system->boot-parameters]: Rename, process
system and epoch, and move to...
(generation->boot-parameters): ...here.
(reinstall-bootloader): Use procedure above.
Change-Id: If31eeb4cef4f5a107a0ee5ad3f117bf38629ac38
---
guix/scripts/system.scm | 30 ++++++++++++++----------------
1 file changed, 14 insertions(+), 16 deletions(-)
diff --git a/guix/scripts/system.scm b/guix/scripts/system.scm
index cdd78a7849..4ca4f1fa85 100644
--- a/guix/scripts/system.scm
+++ b/guix/scripts/system.scm
@@ -328,26 +328,25 @@ (define-syntax-rule (unless-file-not-found exp)
#f
(apply throw args)))))
+(define (generation->boot-parameters profile number)
+ "Return the 'boot-parameters' for the generation of PROFILE specified
+by NUMBER."
+ (unless-file-not-found
+ (let* ((system (generation-file-name profile number))
+ (params (read-boot-parameters-file system))
+ (epoch (stat:mtime (lstat system)))
+ (text (boot-parameters-label params)))
+ (boot-parameters
+ (inherit params)
+ (label (decorated-boot-label text number epoch))))))
+
(define* (profile->boot-alternatives #:optional (profile %system-profile)
(numbers
(reverse (generation-numbers profile))))
"Return a list of 'boot-parameters' for the generations of PROFILE specified
by NUMBERS, which is a list of generation numbers. The list is ordered from
the most recent to the oldest profiles."
- (define (system->boot-parameters system number epoch)
- (unless-file-not-found
- (let* ((params (read-boot-parameters-file system))
- (text (boot-parameters-label params)))
- (boot-parameters
- (inherit params)
- (label (decorated-boot-label text number epoch))))))
- (let* ((systems (map (cut generation-file-name profile <>)
- numbers))
- (times (map (lambda (system)
- (unless-file-not-found
- (stat:mtime (lstat system))))
- systems)))
- (filter-map system->boot-parameters systems numbers times)))
+ (filter-map (cut generation->boot-parameters profile <>) numbers))
;;;
@@ -395,8 +394,7 @@ (define (reinstall-bootloader store number)
(bootloader bootloader)))
;; Make the specified system generation the default entry.
- (params (first (profile->boot-alternatives %system-profile
- (list number))))
+ (params (generation->boot-parameters %system-profile number))
(locale (boot-parameters-locale params))
(store-crypto-devices (boot-parameters-store-crypto-devices params))
(store-directory-prefix
--
2.45.2
This bug report was last modified 267 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.