[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
58/197: installer: Add flags to indicate network interface status.
From: |
Danny Milosavljevic |
Subject: |
58/197: installer: Add flags to indicate network interface status. |
Date: |
Mon, 3 Jul 2017 20:37:00 -0400 (EDT) |
dannym pushed a commit to branch wip-installer-2
in repository guix.
commit b44d97ca24d38390fa3741b90b7d489e0258793e
Author: John Darrington <address@hidden>
Date: Sat Dec 31 22:22:47 2016 +0000
installer: Add flags to indicate network interface status.
* gnu/system/installer/network.scm (network-page-init): Add dynamic
flags to indicate network interface status.
---
gnu/system/installer/network.scm | 48 +++++++++++++++++++++++++++-------------
1 file changed, 33 insertions(+), 15 deletions(-)
diff --git a/gnu/system/installer/network.scm b/gnu/system/installer/network.scm
index d26ca1e..31f9dde 100644
--- a/gnu/system/installer/network.scm
+++ b/gnu/system/installer/network.scm
@@ -1,5 +1,5 @@
;;; GNU Guix --- Functional package management for GNU
-;;; Copyright © 2016 John Darrington <address@hidden>
+;;; Copyright © 2016, 2017 John Darrington <address@hidden>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -37,7 +37,6 @@
network-page-refresh
network-page-key-handler))
-
(define (interfaces)
"Return a alist of network interfaces. Keys include 'name, 'class and 'state"
(slurp "ip -o link"
@@ -73,14 +72,14 @@
((menu-active menu)
(menu-set-active! menu #f)
(buttons-select nav 0))
-
+
((eqv? (buttons-selected nav) (1- (buttons-n-buttons nav)))
(menu-set-active! menu #t)
(buttons-unselect-all nav))
-
+
(else
(buttons-select-next nav))))
-
+
((eq? ch KEY_LEFT)
(menu-set-active! menu #f)
(buttons-select-prev nav))
@@ -108,15 +107,19 @@
"Ping"
ping-page-refresh
ping-page-key-handler)))
-
+
(set! page-stack (cons next page-stack))
((page-refresh next) next)))
((buttons-key-matches-symbol? nav ch 'continue)
- (delwin (outer (page-wwin page)))
- (delwin (inner (page-wwin page)))
- (set! page-stack (cdr page-stack))))
-
+
+ ;; Cancel the timer
+ (setitimer ITIMER_REAL 0 0 0 0)
+
+ (delwin (outer (page-wwin page)))
+ (delwin (inner (page-wwin page)))
+ (set! page-stack (cdr page-stack))))
+
(std-menu-key-handler menu ch))
#f)
@@ -142,7 +145,7 @@
5 (getmaxx (inner pr))
0 0
#:panel #f))
-
+
(bwin (derwin (inner pr)
3 (getmaxx (inner pr))
(- (getmaxy (inner pr)) 3) 0
@@ -153,7 +156,7 @@
(- (getmaxy (inner pr)) (getmaxy text-window) 3)
(- (getmaxx (inner pr)) 0)
(getmaxy text-window) 0 #:panel #f))
-
+
(menu (make-menu
(filter (lambda (i) (memq
(assq-ref i 'class)
@@ -161,6 +164,14 @@
(interfaces))
#:disp-proc
(lambda (datum row)
+
+ (match (string-split
+ (car (slurp
+ (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"
@@ -168,6 +179,7 @@
(addr (string-tokenize name char-set:digit)))
(match addr
((bus device . func)
+ (format #f "~50a ~6a ~a"
(car (assoc-ref
(cdr
;; It seems that lspci always prints an initial
@@ -183,13 +195,19 @@
(string->number func 10)))
(lambda (x)
(string-split x #\tab))))
- "Device:")))))))))
-
+ "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))
-
+
+
+ ;; Raise sigalarm every second to refresh the menu
+ (sigaction SIGALRM (lambda (_) (menu-redraw menu)))
+ (setitimer ITIMER_REAL 1 0 1 0)
+
(page-set-wwin! p pr)
(page-set-datum! p 'menu menu)
(page-set-datum! p 'navigation buttons)
- 86/197: installer: slurp: Ignore blank lines in output., (continued)
- 86/197: installer: slurp: Ignore blank lines in output., Danny Milosavljevic, 2017/07/03
- 76/197: installer: New procedure "page-leave"., Danny Milosavljevic, 2017/07/03
- 84/197: installer: Use guix build syscalls module for network interrogation., Danny Milosavljevic, 2017/07/03
- 94/197: installer: Add the notion of uuids to prospective filesystems., Danny Milosavljevic, 2017/07/03
- 89/197: installer: Make the network menu more reliable., Danny Milosavljevic, 2017/07/03
- 90/197: installer: Enable direct scrolling to top or bottom of menus., Danny Milosavljevic, 2017/07/03
- 78/197: installer: Ensure that the cursor visibility is updated on each page., Danny Milosavljevic, 2017/07/03
- 107/197: installer: Do not allow the creation of invalid file-system specificaitons., Danny Milosavljevic, 2017/07/03
- 57/197: installer: Add a console-keymap service., Danny Milosavljevic, 2017/07/03
- 69/197: installer: Remove "continue" button from host name page., Danny Milosavljevic, 2017/07/03
- 58/197: installer: Add flags to indicate network interface status.,
Danny Milosavljevic <=
- 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, 2017/07/03