~ubuntu-branches/ubuntu/wily/sugar-0.84/wily

« back to all changes in this revision

Viewing changes to debian/patches/wpa_passphrase.patch

  • Committer: Bazaar Package Importer
  • Author(s): Jonas Smedegaard
  • Date: 2009-12-11 18:49:39 UTC
  • mfrom: (2.2.5 sid)
  • Revision ID: james.westby@ubuntu.com-20091211184939-zxp8f64t03l2qv61
Tags: 0.84.9-1
* New upstream bugfix release.
* Update debian/copyright (just shuffling around, no new owners or
  licenses).

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
From: Jonas Smedegaard <dr@jones.dk>
 
2
Subject: look for wpa_passphrase command at multiple paths
 
3
Origin: http://git.sugarlabs.org/projects/jhconvert/repos/mainline/blobs/master/patches/0.84/sugar-1137.patch
 
4
Forwarded: not-needed
 
5
Last-Update: 2009-11-06
 
6
diff --git a/src/jarabe/desktop/keydialog.py b/src/jarabe/desktop/keydialog.py
 
7
--- a/src/jarabe/desktop/keydialog.py
 
8
+++ b/src/jarabe/desktop/keydialog.py
 
9
@@ -16,7 +16,7 @@
 
10
 
 
11
 import md5
 
12
 from gettext import gettext as _
 
13
-
 
14
+import os
 
15
 import gtk
 
16
 import dbus
 
17
 
 
18
@@ -238,8 +238,14 @@ class WPAKeyDialog(KeyDialog):
 
19
             real_key = key
 
20
         elif len(key) >= 8 and len(key) <= 63:
 
21
             # passphrase
 
22
+            if os.path.exists('/usr/sbin/wpa_passphrase'):
 
23
+                wpa_passphrase = '/usr/sbin/wpa_passphrase'
 
24
+            elif os.path.exists('/usr/bin/wpa_passphrase'):
 
25
+                wpa_passphrase = '/usr/bin/wpa_passphrase'
 
26
+            else:
 
27
+                raise RuntimeError("Can't find wpa_passphrase command")
 
28
             from subprocess import Popen, PIPE
 
29
-            p = Popen(['/usr/sbin/wpa_passphrase', ssid, key], stdout=PIPE)
 
30
+            p = Popen([wpa_passphrase, ssid, key], stdout=PIPE)
 
31
             for line in p.stdout:
 
32
                 if line.strip().startswith("psk="):
 
33
                     real_key = line.strip()[4:]