[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
65/80: installer: Add flags to indicate network interface status.
From: |
John Darrington |
Subject: |
65/80: installer: Add flags to indicate network interface status. |
Date: |
Tue, 3 Jan 2017 15:49:45 +0000 (UTC) |
jmd pushed a commit to branch wip-installer
in repository guix.
commit 4f57e72b1bb472f9f9c30d684ea4c0e0cf50ae42
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)
- 78/80: installer: Rename "file-browser" -> "time-zone"., (continued)
- 78/80: installer: Rename "file-browser" -> "time-zone"., John Darrington, 2017/01/03
- 75/80: installer: Add predicate for the network task., John Darrington, 2017/01/03
- 50/80: installer: Rename module "new" to "guixsd-installer"., John Darrington, 2017/01/03
- 54/80: installer: Improve install page., John Darrington, 2017/01/03
- 62/80: installer: Use global variable instead of string literal for "/gnu"., John Darrington, 2017/01/03
- 63/80: installer: Do not use /tmp for holding the configuration., John Darrington, 2017/01/03
- 56/80: installer: Replace spawned mount command with the mount syscall., John Darrington, 2017/01/03
- 53/80: installer: Replace "%temporary-configuration-file-port" with "config-file"., John Darrington, 2017/01/03
- 51/80: installer: Use consistent window heights., John Darrington, 2017/01/03
- 15/80: installer: Add procedures to replace car/cdr since these are frounded upon by Guile gurus., John Darrington, 2017/01/03
- 65/80: installer: Add flags to indicate network interface status.,
John Darrington <=
- 66/80: installer: Format configuration to fix width of window., John Darrington, 2017/01/03
- 80/80: installer: Use --fallback when installing., John Darrington, 2017/01/03
- 69/80: installer: Add page with which the wifi password can be entered., John Darrington, 2017/01/03
- 60/80: installer: Change N_ from a procedure to a macro., John Darrington, 2017/01/03
- 67/80: installer: Do not allow forms to set the cursor visibility., John Darrington, 2017/01/03
- 74/80: installer: Add option to final page to reboot the system., John Darrington, 2017/01/03
- 77/80: installer: Remove "continue" button from host name page., John Darrington, 2017/01/03
- 76/80: installer: Add new page to set the system role., John Darrington, 2017/01/03
- 79/80: installer: Add confidence indicator., John Darrington, 2017/01/03
- 73/80: Merge remote-tracking branch 'origin/master' into wip-installer, John Darrington, 2017/01/03