[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
87/197: installer: Minor cleanup.
From: |
Danny Milosavljevic |
Subject: |
87/197: installer: Minor cleanup. |
Date: |
Mon, 3 Jul 2017 20:37:05 -0400 (EDT) |
dannym pushed a commit to branch wip-installer-2
in repository guix.
commit 9ea13608ad3458b602185a6e6b643ea3877d40fe
Author: John Darrington <address@hidden>
Date: Wed Jan 11 07:39:31 2017 +0100
installer: Minor cleanup.
* gnu/system/installer/network.scm (network-page-init): Avoid one car.
---
gnu/system/installer/network.scm | 75 +++++++++++++++++++++-------------------
1 file changed, 39 insertions(+), 36 deletions(-)
diff --git a/gnu/system/installer/network.scm b/gnu/system/installer/network.scm
index d07791e..2209877 100644
--- a/gnu/system/installer/network.scm
+++ b/gnu/system/installer/network.scm
@@ -41,12 +41,12 @@
(define (interfaces)
(map (lambda (ifce)
- `((name . ,ifce)
- (class . ,(cond
- ((loopback-network-interface? ifce) 'loopback)
- ((zero? (system* "iw" "dev" ifce "info"))
- 'wireless)
- (else 'ethernet)))))
+ `((name . ,ifce)
+ (class . ,(cond
+ ((loopback-network-interface? ifce) 'loopback)
+ ((zero? (system* "iw" "dev" ifce "info"))
+ 'wireless)
+ (else 'ethernet)))))
(all-network-interface-names)))
(define my-buttons `((continue ,(N_ "_Continue") #t)
@@ -64,8 +64,8 @@
((eq? ch #\tab)
(cond
((menu-active menu)
- (menu-set-active! menu #f)
- (buttons-select nav 0))
+ (menu-set-active! menu #f)
+ (buttons-select nav 0))
((eqv? (buttons-selected nav) (1- (buttons-n-buttons nav)))
(menu-set-active! menu #t)
@@ -96,12 +96,12 @@
(zero? (system* "dhclient" (assq-ref item 'name)))))))
((buttons-key-matches-symbol? nav ch 'test)
- (let ((next (make-page (page-surface page)
- "Ping"
- ping-page-refresh
- 0
- ping-page-key-handler)))
- (page-enter next)))
+ (let ((next (make-page (page-surface page)
+ "Ping"
+ ping-page-refresh
+ 0
+ ping-page-key-handler)))
+ (page-enter next)))
((buttons-key-matches-symbol? nav ch 'continue)
@@ -127,9 +127,9 @@
(define (network-page-init p)
(let* ((s (page-surface p))
(pr (make-boxed-window #f
- (- (getmaxy s) 4) (- (getmaxx s) 2)
- 2 1
- #:title (page-title p)))
+ (- (getmaxy s) 4) (- (getmaxx s) 2)
+ 2 1
+ #:title (page-title p)))
(text-window (derwin
(inner pr)
5 (getmaxx (inner pr))
@@ -139,7 +139,7 @@
(bwin (derwin (inner pr)
3 (getmaxx (inner pr))
(- (getmaxy (inner pr)) 3) 0
- #:panel #f))
+ #:panel #f))
(buttons (make-buttons my-buttons 1))
(mwin (derwin (inner pr)
@@ -154,36 +154,39 @@
(interfaces))
#:disp-proc
(lambda (datum row)
-
(match (string-split
(car (slurp
- (string-append "ip -o link show "(assq-ref
datum 'name))
+ (string-append "ip -o link show "
+ (assq-ref datum 'name))
#f)) #\space)
((_ _ flags _ _ _ _ _ state . _)
-
- ;; Convert a network device name such as "enp0s25" to
- ;; something more descriptive like
- ;; "82567LM Gigabit Network Connection"
- (let* ((name (assq-ref datum 'name))
- (addr (string-tokenize name char-set:digit)))
- (match addr
- ((bus device . func)
- (format #f "~50a ~6a ~a"
- (car (assoc-ref
- (slurp (format #f "lspci -v -mm -s~x:~x.~x"
+ ;; Convert a network device name such as "enp0s25" to
+ ;; something more descriptive like
+ ;; "82567LM Gigabit Network Connection"
+ (let* ((name (assq-ref datum 'name))
+ (addr (string-tokenize name char-set:digit)))
+ (match addr
+ ((bus device . func)
+ (format #f "~50a ~6a ~a"
+ (assoc-ref
+ (slurp
+ (format #f "lspci -v -mm -s~x:~x.~x"
(string->number bus 10)
(string->number device 10)
(if (null? func) 0
(string->number func 10)))
(lambda (x)
- (string-split x #\tab)))
- "Device:"))
- state flags))))))))))
+ (let ((idx (string-index x #\:)))
+ (cons (substring x 0 idx)
+ (string-trim
+ (substring x (1+ idx)))))))
+ "Device")
+ state flags))))))))))
(addstr* text-window (format #f
- (gettext
- "To install GuixSD a connection to one of ~s must be available.
The following network devices exist on the system. Select one to configure or
\"Continue\" to proceeed.") %default-substitute-urls))
+ (gettext
+ "To install GuixSD a connection to one of
~s must be available. The following network devices exist on the system.
Select one to configure or \"Continue\" to proceeed.")
%default-substitute-urls))
;; Raise sigalarm every second to refresh the menu
- 58/197: installer: Add flags to indicate network interface status., (continued)
- 58/197: installer: Add flags to indicate network interface status., Danny Milosavljevic, 2017/07/03
- 72/197: installer: Use --fallback when installing., Danny Milosavljevic, 2017/07/03
- 73/197: installer: Correct behaviour of push-cursor and pop-cursor procedures., Danny Milosavljevic, 2017/07/03
- 77/197: installer: New procedure: page-enter., Danny Milosavljevic, 2017/07/03
- 82/197: installer: Rename 'file-browser.scm' to 'key-map.scm'., Danny Milosavljevic, 2017/07/03
- 63/197: installer: Change essid --> wireless., Danny Milosavljevic, 2017/07/03
- 70/197: installer: Rename "file-browser" -> "time-zone"., Danny Milosavljevic, 2017/07/03
- 81/197: installer: Make all windows with ports scrollable., Danny Milosavljevic, 2017/07/03
- 62/197: installer: Add page with which the wifi password can be entered., Danny Milosavljevic, 2017/07/03
- 75/197: installer: Remove pointless calls to delwin., Danny Milosavljevic, 2017/07/03
- 87/197: installer: Minor cleanup.,
Danny Milosavljevic <=
- 79/197: installer: Rename "Back" buttons to "Cancel"., Danny Milosavljevic, 2017/07/03
- 98/197: installer: Correct bug detecting a wireless interface., Danny Milosavljevic, 2017/07/03
- 91/197: installer: Add callback parameter for forms., Danny Milosavljevic, 2017/07/03
- 95/197: installer: Add a predicate to ensure the partitions have been formatted., Danny Milosavljevic, 2017/07/03
- 102/197: installer: Correct bug where the timezone page returned to the wrong page., Danny Milosavljevic, 2017/07/03
- 119/197: gurses: Allow menu update to work for panel windows., Danny Milosavljevic, 2017/07/03
- 103/197: installer: Avoid exception when the device to format cannot be found., Danny Milosavljevic, 2017/07/03
- 116/197: installer: Fix bug in config generation., Danny Milosavljevic, 2017/07/03
- 105/197: installer: Extend the 'file-system' concept to include swap spaces., Danny Milosavljevic, 2017/07/03
- 83/197: installer: "Setup" --> "Set up", Danny Milosavljevic, 2017/07/03