* [bug#28281] [PATCH] gnu: Add os-prober.
@ 2017-08-29 19:06 Arun Isaac
[not found] ` <handler.28281.B.150403363917922.ack@debbugs.gnu.org>
` (2 more replies)
0 siblings, 3 replies; 5+ messages in thread
From: Arun Isaac @ 2017-08-29 19:06 UTC (permalink / raw)
To: 28281
* gnu/packages/bootloaders.scm (os-prober): New variable.
---
gnu/packages/bootloaders.scm | 66 ++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 66 insertions(+)
diff --git a/gnu/packages/bootloaders.scm b/gnu/packages/bootloaders.scm
index f66d0bb3f..57d284be6 100644
--- a/gnu/packages/bootloaders.scm
+++ b/gnu/packages/bootloaders.scm
@@ -395,3 +395,69 @@ also initializes the boards (RAM etc).")
(define-public u-boot-odroid-c2
(make-u-boot-package "odroid-c2" "aarch64-linux-gnu"))
+
+(define-public os-prober
+ (package
+ (name "os-prober")
+ (version "1.76")
+ (source
+ (origin
+ (method url-fetch)
+ (uri (string-append "mirror://debian/pool/main/o/os-prober/os-prober_"
+ version ".tar.xz"))
+ (sha256
+ (base32
+ "1vb45i76bqivlghrq7m3n07qfmmq4wxrkplqx8gywj011rhq19fk"))))
+ (build-system gnu-build-system)
+ (arguments
+ `(#:modules ((guix build gnu-build-system)
+ (guix build utils)
+ (ice-9 ftw) ; for ftw
+ (ice-9 regex) ; for string-match
+ (srfi srfi-2) ; for and-let*
+ (srfi srfi-26)) ; for cut
+ #:make-flags (list "CC=gcc")
+ #:tests? #f ; no tests
+ #:phases
+ (modify-phases %standard-phases
+ (replace 'configure
+ (lambda* (#:key outputs #:allow-other-keys)
+ (substitute* (find-files ".")
+ (("/usr") (assoc-ref outputs "out")))
+ (substitute* (find-files "." "50mounted-tests$")
+ (("mkdir") "mkdir -p"))
+ #t))
+ (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)))
+ (list "os-probes" "linux-boot-probes"))
+ #t))))))
+ (home-page "https://joeyh.name/code/os-prober")
+ (synopsis "Detect other operating systems")
+ (description "os-prober probes disks on the system for other operating
+systems so that they can be added to the bootloader. It also works out how to
+boot existing GNU/Linux systems and detects what distribution is installed in
+order to add a suitable bootloader menu entry.")
+ (license license:gpl2+)))
--
2.13.4
^ permalink raw reply related [flat|nested] 5+ messages in thread
[parent not found: <handler.28281.B.150403363917922.ack@debbugs.gnu.org>]
* [bug#28281] [PATCH] gnu: Add os-prober.
2017-08-29 19:06 [bug#28281] [PATCH] gnu: Add os-prober Arun Isaac
[not found] ` <handler.28281.B.150403363917922.ack@debbugs.gnu.org>
@ 2017-08-31 13:25 ` Ludovic Courtès
2017-08-31 17:41 ` Arun Isaac
2017-09-09 17:16 ` Arun Isaac
2 siblings, 1 reply; 5+ messages in thread
From: Ludovic Courtès @ 2017-08-31 13:25 UTC (permalink / raw)
To: Arun Isaac; +Cc: 28281
Hi!
Arun Isaac <arunisaac@systemreboot.net> 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’.
^ permalink raw reply [flat|nested] 5+ messages in thread
* [bug#28281] [PATCH] gnu: Add os-prober.
2017-08-31 13:25 ` [bug#28281] [PATCH] gnu: Add os-prober Ludovic Courtès
@ 2017-08-31 17:41 ` Arun Isaac
0 siblings, 0 replies; 5+ messages in thread
From: Arun Isaac @ 2017-08-31 17:41 UTC (permalink / raw)
To: Ludovic Courtès; +Cc: 28281
> For clarity, what about (1) using ‘find-files’ instead of ‘ftw’
I started with something like that and switched to `ftw' for slightly
shorter code. But, I guess clarity is more important.
> (2) separating code that builds the list of files from code that calls
> ‘install-file’?
Sure, will do. I'll send an updated patch with both changes
incorporated.
This package is really so messed up. I don't know why they couldn't have
just provided us with a Makefile for installation. Sigh...
^ permalink raw reply [flat|nested] 5+ messages in thread
* [bug#28281] [PATCH] gnu: Add os-prober.
2017-08-29 19:06 [bug#28281] [PATCH] gnu: Add os-prober Arun Isaac
[not found] ` <handler.28281.B.150403363917922.ack@debbugs.gnu.org>
2017-08-31 13:25 ` [bug#28281] [PATCH] gnu: Add os-prober Ludovic Courtès
@ 2017-09-09 17:16 ` Arun Isaac
2 siblings, 0 replies; 5+ messages in thread
From: Arun Isaac @ 2017-09-09 17:16 UTC (permalink / raw)
To: 28281
* gnu/packages/bootloaders.scm (os-prober): New variable.
---
gnu/packages/bootloaders.scm | 69 ++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 69 insertions(+)
diff --git a/gnu/packages/bootloaders.scm b/gnu/packages/bootloaders.scm
index f66d0bb3f..613537a5d 100644
--- a/gnu/packages/bootloaders.scm
+++ b/gnu/packages/bootloaders.scm
@@ -395,3 +395,72 @@ also initializes the boards (RAM etc).")
(define-public u-boot-odroid-c2
(make-u-boot-package "odroid-c2" "aarch64-linux-gnu"))
+
+(define-public os-prober
+ (package
+ (name "os-prober")
+ (version "1.76")
+ (source
+ (origin
+ (method url-fetch)
+ (uri (string-append "mirror://debian/pool/main/o/os-prober/os-prober_"
+ version ".tar.xz"))
+ (sha256
+ (base32
+ "1vb45i76bqivlghrq7m3n07qfmmq4wxrkplqx8gywj011rhq19fk"))))
+ (build-system gnu-build-system)
+ (arguments
+ `(#:modules ((guix build gnu-build-system)
+ (guix build utils)
+ (ice-9 regex) ; for string-match
+ (srfi srfi-26)) ; for cut
+ #:make-flags (list "CC=gcc")
+ #:tests? #f ; no tests
+ #:phases
+ (modify-phases %standard-phases
+ (replace 'configure
+ (lambda* (#:key outputs #:allow-other-keys)
+ (substitute* (find-files ".")
+ (("/usr") (assoc-ref outputs "out")))
+ (substitute* (find-files "." "50mounted-tests$")
+ (("mkdir") "mkdir -p"))
+ #t))
+ (replace 'install
+ (lambda* (#:key outputs #:allow-other-keys)
+ (define (find-files-non-recursive directory)
+ (find-files directory
+ (lambda (file stat)
+ (string-match (string-append "^" directory "/[^/]*$")
+ file))
+ #:directories? #t))
+
+ (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)
+ (for-each
+ (lambda (file)
+ (let ((destination (string-append lib "/" directory
+ "/" (basename file))))
+ (mkdir-p (dirname destination))
+ (copy-recursively file destination)))
+ (append (find-files-non-recursive (string-append directory "/common"))
+ (find-files-non-recursive (string-append directory "/x86")))))
+ (list "os-probes" "os-probes/mounted" "os-probes/init"
+ "linux-boot-probes" "linux-boot-probes/mounted"))
+ #t))))))
+ (home-page "https://joeyh.name/code/os-prober")
+ (synopsis "Detect other operating systems")
+ (description "os-prober probes disks on the system for other operating
+systems so that they can be added to the bootloader. It also works out how to
+boot existing GNU/Linux systems and detects what distribution is installed in
+order to add a suitable bootloader menu entry.")
+ (license license:gpl2+)))
--
2.14.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
end of thread, other threads:[~2017-09-09 17:18 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-08-29 19:06 [bug#28281] [PATCH] gnu: Add os-prober Arun Isaac
[not found] ` <handler.28281.B.150403363917922.ack@debbugs.gnu.org>
2017-08-29 19:19 ` [bug#28281] Acknowledgement ([PATCH] gnu: Add os-prober.) Arun Isaac
2017-08-31 13:25 ` [bug#28281] [PATCH] gnu: Add os-prober Ludovic Courtès
2017-08-31 17:41 ` Arun Isaac
2017-09-09 17:16 ` Arun Isaac
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/guix.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).