bootloader: menu-entry->ukify-args: Avoid relative reference to system generations.

This commit is contained in:
Hilton Chain 2026-07-25 21:25:13 +08:00
parent ed592c6c6e
commit ecdb930021
No known key found for this signature in database
GPG Key ID: ACC66D09CA528292
2 changed files with 21 additions and 3 deletions

View File

@ -36,10 +36,10 @@
old-entries))
(define labels
(map-in-order menu-entry-label menu-entries))
(map menu-entry-label menu-entries))
(define ukify-args
(map-in-order menu-entry->ukify-args menu-entries))
(map menu-entry->ukify-args menu-entries))
(program-file "install-limine"
(with-imported-modules

View File

@ -26,7 +26,25 @@
#~(list "--os-release" #$label
"--linux" #$linux
"--initrd" #$initrd
"--cmdline" (string-join (list #$@arguments))
"--cmdline"
(string-join
(map (lambda (arg)
;; Use absolute references to avoid stale system generation
;; status.
(if (or (string-prefix? "gnu.system=" arg)
(string-prefix? "gnu.load=" arg))
(let* ((split-arg (string-split arg #\=))
(option (car split-arg))
(value (cadr split-arg)))
(string-join
(list option
(catch #t
(lambda ()
(readlink value))
(const value)))
"="))
arg))
(list #$@arguments)))
"--stub"
#$(file-append systemd-stub "/libexec/" (systemd-stub-name)))))