[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
22/197: installer: Make "interfaces" return an alist.
From: |
Danny Milosavljevic |
Subject: |
22/197: installer: Make "interfaces" return an alist. |
Date: |
Mon, 3 Jul 2017 20:36:53 -0400 (EDT) |
dannym pushed a commit to branch wip-installer-2
in repository guix.
commit 6abe06538d8dbe33727a8bf2269082399fe16a8d
Author: John Darrington <address@hidden>
Date: Sat Dec 24 10:04:08 2016 +0100
installer: Make "interfaces" return an alist.
* gnu/system/installer/network.scm (interfaces) : Convert from a procedure
returning a list of strings, to a procedure returning an alist and deal with
the consequences.
---
gnu/system/installer/network.scm | 41 +++++++++++++++++++++++-----------------
1 file changed, 24 insertions(+), 17 deletions(-)
diff --git a/gnu/system/installer/network.scm b/gnu/system/installer/network.scm
index da8d959..4e3abd6 100644
--- a/gnu/system/installer/network.scm
+++ b/gnu/system/installer/network.scm
@@ -37,14 +37,19 @@
network-page-key-handler))
-(define (interfaces) (delete "lo"
+(define (interfaces)
(slurp "ip -o link"
(lambda (s)
- (match (string-split s #\:)
- ((_ interface-name . _)
- (string-trim-both
- interface-name
- char-set:whitespace)))))))
+ (match (string-split s #\space)
+ ((_ interface-name _ _ _ _ _ _
+ state _ _ _ _ _ _ _ _ _ class . _)
+ `((name .
+ ,(string-trim-right
+ interface-name #\:))
+ (state . ,state)
+ (class . ,class)))))))
+
+
(define my-buttons `((continue ,(N_ "_Continue") #t)
(test ,(N_ "_Test") #t)))
@@ -134,22 +139,24 @@
(getmaxy text-window) 0 #:panel #f))
(menu (make-menu
- (interfaces)
+ (filter (lambda (i) (equal? "link/ether" (assq-ref i 'class)))
+ (interfaces))
#:disp-proc
(lambda (datum row)
- ;; Convert a network device name such as "enp0s25" to
+ ;; Convert a network device name such as "enp0s25" to
;; something more descriptive like
;; "82567LM Gigabit Network Connection"
- (let* ((addr (string-tokenize datum char-set:digit))
- (bus (match addr ((n . _)
- (string->number n 10))))
+ (let* ((name (assq-ref datum 'name))
+ (addr (string-tokenize name char-set:digit))
+ (bus (match addr ((n . _)
+ (string->number n 10))))
- (device (match addr ((_ . (n . _))
- (string->number n 10))))
+ (device (match addr ((_ . (n . _))
+ (string->number n 10))))
- (func (match addr
- ((_ . (_ . (n . _)))
- (string->number n 10)) (_ 0))))
+ (func (match addr
+ ((_ . (_ . (n . _)))
+ (string->number n 10)) (_ 0))))
(car (assoc-ref
(cdr
;; It seems that lspci always prints an initial
@@ -160,7 +167,7 @@
(slurp (format #f "lspci -vm -s~x:~x.~x" bus device
func)
(lambda (x)
(string-split x #\tab))))
- "Device:")))))))
+ "Device:")))))))
(addstr* text-window (format #f
- 18/197: installer: Handle the 'back' action in the filesystems task., (continued)
- 18/197: installer: Handle the 'back' action in the filesystems task., Danny Milosavljevic, 2017/07/03
- 13/197: installer: Add alternate method of finding TZDIR., Danny Milosavljevic, 2017/07/03
- 31/197: installer: Make minumum-store-size variable global., Danny Milosavljevic, 2017/07/03
- 33/197: installer: Improve dependencies on the final task., Danny Milosavljevic, 2017/07/03
- 17/197: installer: Add completion predicate for disk task., Danny Milosavljevic, 2017/07/03
- 21/197: installer: Fix incorrect host in ping task., Danny Milosavljevic, 2017/07/03
- 20/197: installer: Return slurped lines in their correct order., Danny Milosavljevic, 2017/07/03
- 25/197: installer: Connect ethernet interfaces on selection., Danny Milosavljevic, 2017/07/03
- 03/197: installer: Remove obsolete procedures/variables, Danny Milosavljevic, 2017/07/03
- 10/197: installer: Perform a task's dependencies prior to the task itself., Danny Milosavljevic, 2017/07/03
- 22/197: installer: Make "interfaces" return an alist.,
Danny Milosavljevic <=
- 26/197: installer: Let the kernel know about (possibly) changed partitions., Danny Milosavljevic, 2017/07/03
- 27/197: installer: Deal with partition tables which are (partially) corrupt., Danny Milosavljevic, 2017/07/03
- 28/197: installer: Add a variable to represent the minimum recommended store size., Danny Milosavljevic, 2017/07/03
- 32/197: installer: Remove ad-hoc completed predicate and use standard one., Danny Milosavljevic, 2017/07/03
- 34/197: installer: Replace some instances of "car"., Danny Milosavljevic, 2017/07/03
- 40/197: installer: Turn off kernel ring messages to console., Danny Milosavljevic, 2017/07/03
- 37/197: install: Define new procedure pipe-cmd and use it to implement window-pipe., Danny Milosavljevic, 2017/07/03
- 41/197: installer: Enable scrolling in the installation window., Danny Milosavljevic, 2017/07/03
- 38/197: installer: Correct bugs generating the configuration., Danny Milosavljevic, 2017/07/03
- 45/197: installer: Fix bug where window-pipe did not return the proper exit status., Danny Milosavljevic, 2017/07/03