Merge lp:~pwlars/phablet-tools/network-no-sudo into lp:phablet-tools

Proposed by Paul Larson
Status: Merged
Approved by: Oliver Grawert
Approved revision: 318
Merged at revision: 320
Proposed branch: lp:~pwlars/phablet-tools/network-no-sudo
Merge into: lp:phablet-tools
Diff against target: 17 lines (+5/-2)
1 file modified
phablet-network (+5/-2)
To merge this branch: bzr merge lp:~pwlars/phablet-tools/network-no-sudo
Reviewer Review Type Date Requested Status
PS Jenkins bot continuous-integration Approve
Ubuntu Phablet Team Pending
Review via email: mp+235689@code.launchpad.net

Commit message

Don't use sudo in phablet-network unless it's really needed

Description of the change

We're trying to eliminate the sources of sudo needed in the ci testing process. In this case, even if you specify a network file for phablet-network to use and you have full permissions on it, phablet-network uses sudo to grep for the lines it needs from it unnecessarily. This fixes that so that it should only use sudo if the file is unreadable by the current user.

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

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'phablet-network'
--- phablet-network 2014-09-18 11:45:03 +0000
+++ phablet-network 2014-09-23 18:10:40 +0000
@@ -128,8 +128,11 @@
128128
129 echo Network file is $network_file129 echo Network file is $network_file
130130
131 SSID="$(sudo grep ^ssid= "$network_file"|sed 's/^ssid=//')"131 if [ ! -r "$network_file" ]; then
132 KEY="$(sudo grep ^psk= "$network_file"|sed 's/^psk=//')"132 SUDO="sudo"
133 fi
134 SSID="$($SUDO grep ^ssid= "$network_file"|sed 's/^ssid=//')"
135 KEY="$($SUDO grep ^psk= "$network_file"|sed 's/^psk=//')"
133136
134 # No PSK ? Let's check for WEP137 # No PSK ? Let's check for WEP
135 [ -z "$KEY" ] && KEY="$(sudo grep ^wep-key0= "$network_file"|sed 's/^wep-key0=//')"138 [ -z "$KEY" ] && KEY="$(sudo grep ^wep-key0= "$network_file"|sed 's/^wep-key0=//')"

Subscribers

People subscribed via source and target branches