guix-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[bug#30303] [PATCH] linux-boot: Add find-long-options.


From: Danny Milosavljevic
Subject: [bug#30303] [PATCH] linux-boot: Add find-long-options.
Date: Wed, 31 Jan 2018 13:29:33 +0100

* gnu/build/linux/boot.scm (find-long-options): New variable.
---
 gnu/build/linux-boot.scm | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/gnu/build/linux-boot.scm b/gnu/build/linux-boot.scm
index 0ab8391b0..b88ce6b99 100644
--- a/gnu/build/linux-boot.scm
+++ b/gnu/build/linux-boot.scm
@@ -37,6 +37,7 @@
   #:export (mount-essential-file-systems
             linux-command-line
             find-long-option
+            find-long-options
             make-essential-device-nodes
             make-static-device-nodes
             configure-qemu-networking
@@ -99,6 +100,18 @@ Return the value associated with OPTION, or #f on failure."
            (lambda (arg)
              (substring arg (+ 1 (string-index arg #\=)))))))
 
+(define (find-long-options option arguments)
+  "Find OPTIONs among ARGUMENTS, where OPTION is something like \"console\".
+Return the values associated with OPTIONs as a list, or the empty list on
+failure."
+  (let ((opt (string-append option "=")))
+    (map (lambda (arg)
+           (substring arg (+ 1 (string-index arg #\=))))
+         (filter
+           (lambda (arg)
+             (string-prefix? opt arg))
+         arguments))))
+
 (define* (make-disk-device-nodes base major #:optional (minor 0))
   "Make the block device nodes around BASE (something like \"/root/dev/sda\")
 with the given MAJOR number, starting with MINOR."





reply via email to

[Prev in Thread] Current Thread [Next in Thread]