bootloader: limine: Simplify error handling in installation script, again.

This commit is contained in:
Hilton Chain 2026-03-21 09:21:56 +08:00
parent 1233c2154a
commit 68573186b5
No known key found for this signature in database
GPG Key ID: ACC66D09CA528292

View File

@ -59,7 +59,7 @@
;; Install unified kernel images and generate Limine configuration.
(call-with-output-file (in-vicinity limine-directory "limine.conf.tmp")
(lambda (port)
(let* ((ukify #$(file-append ukify "/bin/ukify"))
(let ((ukify #$(file-append ukify "/bin/ukify"))
(current-label (first '#$labels))
(current-args (first (list #$@ukify-args)))
(old-labels (cdr '#$labels))
@ -78,17 +78,12 @@ timeout: 5~%")
(unless (null? old-labels)
(format port "
/GNU system, old configurations...~%"))
(false-if-exception
(let loop ((count 1)
(labels old-labels)
(args old-args))
(let* ((image-name (format #f "OLD-~a.EFI" count)))
(let ((image-name (format #f "OLD-~a.EFI" count)))
(unless (null? labels)
(with-exception-handler
(lambda _
(delete-file image-name)
;; Exit loop.
(loop 0 '() '()))
(catch #t
(lambda ()
(apply invoke/quiet
ukify "build" "--output" image-name
@ -98,10 +93,14 @@ timeout: 5~%")
protocol: efi
path: boot():/EFI/Guix/OLD-~a.EFI~%"
(first labels)
count)))
count))
(lambda _
(delete-file image-name)
;; Exit loop.
(loop 0 '() '())))
(loop (1+ count)
(cdr labels)
(cdr args))))))))
(cdr args)))))))
(rename-file (in-vicinity limine-directory "limine.conf.tmp")
(in-vicinity limine-directory "limine.conf"))
;; Finally, install Limine.