[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[bug#28281] [PATCH] gnu: Add os-prober.
From: |
Ludovic Courtès |
Subject: |
[bug#28281] [PATCH] gnu: Add os-prober. |
Date: |
Thu, 31 Aug 2017 15:25:48 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/25.2 (gnu/linux) |
Hi!
Arun Isaac <address@hidden> skribis:
> * gnu/packages/bootloaders.scm (os-prober): New variable.
[...]
> + (replace 'install
> + (lambda* (#:key outputs #:allow-other-keys)
> + (let* ((out (assoc-ref outputs "out"))
> + (bin (string-append out "/bin"))
> + (lib (string-append out "/lib"))
> + (share (string-append out "/share")))
> + (for-each (cut install-file <> bin)
> + (list "linux-boot-prober" "os-prober"))
> + (install-file "newns" (string-append lib "/os-prober"))
> + (install-file "common.sh" (string-append share "/os-prober"))
> + (install-file "os-probes/mounted/powerpc/20macosx"
> + (string-append lib "/os-probes/mounted"))
> + (for-each
> + (lambda (directory)
> + (ftw directory
> + (lambda (file stat flag)
> + (when (eq? flag 'regular)
> + (and-let* ((result (or (string-match "/common/"
> file)
> + (string-match "/x86/"
> file))))
> + (install-file
> + file (dirname
> + (string-append
> + lib "/" (substring file 0 (match:start
> result 0))
> + (substring file (1- (match:end result
> 0))))))))
> + #t)))
For clarity, what about (1) using ‘find-files’ instead of ‘ftw’, and (2)
separating code that builds the list of files from code that calls
‘install-file’?
So something like:
(define (candidate-files directory)
(find-files directory
(lambda (file stat)
(and (eq? (stat:kind stat) 'regular)
…))))
(for-each (lambda (file)
(install-file file …))
(append-map candidate-files
(list "os-probes" "linux-boot-probes")))
WDYT?
Ludo’.