Merge lp:~ogra/phablet-tools/pahblet-network-drop-root into lp:phablet-tools

Proposed by Oliver Grawert
Status: Merged
Approved by: Manuel de la Peña
Approved revision: 294
Merged at revision: 295
Proposed branch: lp:~ogra/phablet-tools/pahblet-network-drop-root
Merge into: lp:phablet-tools
Diff against target: 35 lines (+14/-11)
1 file modified
phablet-network (+14/-11)
To merge this branch: bzr merge lp:~ogra/phablet-tools/pahblet-network-drop-root
Reviewer Review Type Date Requested Status
Manuel de la Peña (community) Approve
PS Jenkins bot continuous-integration Approve
Review via email: mp+230864@code.launchpad.net

Commit message

drop the need for root on the target device when configuring the wlan

Description of the change

drop the need for root on the target device when configuring the wlan

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
294. By Oliver Grawert

add quoting around the KEY since apparently spaces in wlan keys are allowed

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
Manuel de la Peña (mandel) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'phablet-network'
2--- phablet-network 2014-05-14 13:05:18 +0000
3+++ phablet-network 2014-08-15 10:59:45 +0000
4@@ -128,17 +128,20 @@
5
6 echo Network file is $network_file
7
8- TMP_FILE=$(mktemp)
9- CMD="grep -v mac-address"
10- [ ! -r "$network_file" ] && CMD="sudo $CMD"
11- $CMD "$network_file" > $TMP_FILE
12-
13- echo Provisioning network file to device
14- target_network_file=$NETWORK_MANAGER/active_ws_connection.conf
15- adb push $TMP_FILE $target_network_file
16- adb shell "chmod 600 $target_network_file"
17-
18- rm -f $TMP_FILE
19+ SSID="$(sudo grep ^ssid= $network_file|sed 's/^ssid=//')"
20+ KEY="$(sudo grep ^psk= $network_file|sed 's/^psk=//')"
21+
22+ # No PSK ? Let's check for WEP
23+ [ -z "$KEY" ] && KEY="$(sudo grep ^wep-key0= $network_file|sed 's/^wep-key0=//')"
24+
25+ # Still no key ?
26+ if [ -z "$KEY" ]; then
27+ echo "Could neither find WEP nor WPA-PSK key !"
28+ exit 1
29+ fi
30+
31+ echo Provisioning network on device
32+ adb shell "nmcli device wifi connect ${SSID} password '${KEY}'"
33
34 echo
35 echo Network setup complete

Subscribers

People subscribed via source and target branches