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

Proposed by Oliver Grawert
Status: Merged
Approved by: Sergio Schvezov
Approved revision: 252
Merged at revision: 254
Proposed branch: lp:~ogra/phablet-tools/no-sudo-in-phablet-network
Merge into: lp:phablet-tools
Diff against target: 14 lines (+3/-1)
1 file modified
phablet-network (+3/-1)
To merge this branch: bzr merge lp:~ogra/phablet-tools/no-sudo-in-phablet-network
Reviewer Review Type Date Requested Status
Sergio Schvezov Approve
PS Jenkins bot continuous-integration Approve
Review via email: mp+214921@code.launchpad.net

Commit message

we do not need sudo if we can read the network credentials file we hand over via commandline option to phablet-network, so lets not require it.

Description of the change

do not require sudo for network credential files we can read

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

Tested with a file owned by my uid and with ones that can't be read by me (root owned and 500)

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 2013-10-03 15:12:23 +0000
3+++ phablet-network 2014-04-09 11:21:37 +0000
4@@ -114,7 +114,9 @@
5 echo Network file is $network_file
6
7 TMP_FILE=$(mktemp)
8- sudo grep -v mac-address "$network_file" > $TMP_FILE
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

Subscribers

People subscribed via source and target branches