sugar-0.84 (0.84.20-1) wpa_passphrase.patch

Summary

 src/jarabe/desktop/keydialog.py |   10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

    
download this patch

Patch contents

From: Jonas Smedegaard <dr@jones.dk>
Subject: look for wpa_passphrase command at multiple paths
Origin: http://git.sugarlabs.org/projects/jhconvert/repos/mainline/blobs/master/patches/0.84/sugar-1137.patch
Forwarded: not-needed
Last-Update: 2009-11-06
--- a/src/jarabe/desktop/keydialog.py
+++ b/src/jarabe/desktop/keydialog.py
@@ -17,7 +17,7 @@
 
 import md5
 from gettext import gettext as _
-
+import os
 import gtk
 import dbus
 
@@ -243,8 +243,14 @@
             real_key = key
         elif len(key) >= 8 and len(key) <= 63:
             # passphrase
+            if os.path.exists('/usr/sbin/wpa_passphrase'):
+                wpa_passphrase = '/usr/sbin/wpa_passphrase'
+            elif os.path.exists('/usr/bin/wpa_passphrase'):
+                wpa_passphrase = '/usr/bin/wpa_passphrase'
+            else:
+                raise RuntimeError("Can't find wpa_passphrase command")
             from subprocess import Popen, PIPE
-            p = Popen(['/usr/sbin/wpa_passphrase', ssid, key], stdout=PIPE)
+            p = Popen([wpa_passphrase, ssid, key], stdout=PIPE)
             for line in p.stdout:
                 if line.strip().startswith("psk="):
                     real_key = line.strip()[4:]