guix-commits
[Top][All Lists]
Advanced

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

07/07: installer: Add procudure for starting a wireless interface.


From: John Darrington
Subject: 07/07: installer: Add procudure for starting a wireless interface.
Date: Sun, 19 Feb 2017 12:30:56 -0500 (EST)

jmd pushed a commit to branch wip-installer
in repository guix.

commit e7c2d417ce9fd8252018737200c4eeb0b4efe2bf
Author: John Darrington <address@hidden>
Date:   Sun Feb 19 15:28:23 2017 +0100

    installer: Add procudure for starting a wireless interface.
    
    * gnu/system/installer/wireless.scm (start-interface): New procedure.
---
 gnu/system/installer/wireless.scm | 19 ++++++++++++++-----
 1 file changed, 14 insertions(+), 5 deletions(-)

diff --git a/gnu/system/installer/wireless.scm 
b/gnu/system/installer/wireless.scm
index 3e34e61..42b1a8f 100644
--- a/gnu/system/installer/wireless.scm
+++ b/gnu/system/installer/wireless.scm
@@ -24,6 +24,7 @@
   #:use-module (gnu system installer misc)
   #:use-module (gnu system installer utils)
   #:use-module (ice-9 format)
+  #:use-module (ice-9 rdelim)
   #:use-module (ice-9 match)
   #:use-module (gurses menu)
   #:use-module (gurses buttons)
@@ -245,6 +246,18 @@
 
 
 
+(define (start-interface config-file ifce)
+  (let ((pid-file (format #f "/wpspid-~a" ifce)))
+    (catch #t
+           (lambda () (kill (string->number
+                             (read-line (open pid-file O_RDONLY))) SIGINT))
+           (lambda (key . args) #t))
+    (zero? (system* "wpa_supplicant"
+                    "-c" config-file
+                    "-P" pid-file
+                    "-i" ifce
+                    "-B"))))
+
 (define (wireless-connect ifce access-point passphrase)
   "Connect the wireless interface IFCE to ACCESS-POINT using the key 
PASSPHRASE."
 
@@ -274,9 +287,5 @@ network={
 
        (with-output-to-file "/dev/null"
          (lambda ()
-           (and (zero? (system* "wpa_supplicant"
-                                "-c" filename
-                                "-P" (format #f "/wpspid-~a" ifce)
-                                "-i" ifce
-                                "-B"))
+           (and (start-interface filename ifce)
                 (dhclient ifce))))))))



reply via email to

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