Merge lp:~ogra/phablet-tools/phablet-tools-fix-writable-image into lp:phablet-tools

Proposed by Oliver Grawert
Status: Merged
Approved by: Sergio Schvezov
Approved revision: 312
Merged at revision: 310
Proposed branch: lp:~ogra/phablet-tools/phablet-tools-fix-writable-image
Merge into: lp:phablet-tools
Diff against target: 64 lines (+20/-16)
1 file modified
phablet-config (+20/-16)
To merge this branch: bzr merge lp:~ogra/phablet-tools/phablet-tools-fix-writable-image
Reviewer Review Type Date Requested Status
Sergio Schvezov Approve
PS Jenkins bot continuous-integration Approve
Review via email: mp+234946@code.launchpad.net

Commit message

fix phablet-config to not require a reboot when already writable, fix ASKPASS handling, make output of phablet-config writable-image more verbose for ppa and package actions

Description of the change

fix phablet-config to not require a reboot when already writable, fix ASKPASS handling, make output of phablet-config writable-image more verbose for ppa and package actions

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

fix pep8

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
Sergio Schvezov (sergiusens) wrote :

cosmetic fixes

review: Needs Fixing
312. By Oliver Grawert

use single quotes in print() call

Revision history for this message
Oliver Grawert (ogra) wrote :

@sergio
the in-shell printf needs double quotes, else the "printf '$format' 'line1' 'line2'" notation will not work.
i fixed the other quoting.

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
Sergio Schvezov (sergiusens) wrote :

On miércoles 17 de septiembre de 2014 10h'13:23 ART, Oliver Grawert wrote:
> @sergio
> the in-shell printf needs double quotes, else the "printf
> '$format' 'line1' 'line2'" notation will not work.
> i fixed the other quoting.

you can aways escape those ;-) But ok

Revision history for this message
Oliver Grawert (ogra) wrote :

hi,
Am Mittwoch, den 17.09.2014, 10:35 -0300 schrieb Sergio Schvezov:
> On miércoles 17 de septiembre de 2014 10h'13:23 ART, Oliver Grawert wrote:
> > @sergio
> > the in-shell printf needs double quotes, else the "printf
> > '$format' 'line1' 'line2'" notation will not work.
> > i fixed the other quoting.
>
> you can aways escape those ;-) But ok
yes, at the cost of having to double escape the already existing double
escapes too ... in the end the line would be full of backslashes and
unreadable.

ciao
 oli

Revision history for this message
Sergio Schvezov (sergiusens) wrote :

lgtm

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'phablet-config'
2--- phablet-config 2014-09-16 10:05:01 +0000
3+++ phablet-config 2014-09-17 13:07:57 +0000
4@@ -109,8 +109,10 @@
5 dbusarg = 'false'
6 if args.dbus_probe == 'enable':
7 dbusarg = 'true'
8- dbus_call = 'dbus-send --system --print-reply --dest=com.canonical.PropertyService ' \
9- '/com/canonical/PropertyService com.canonical.PropertyService.SetProperty ' \
10+ dbus_call = 'dbus-send --system --print-reply ' \
11+ '--dest=com.canonical.PropertyService ' \
12+ '/com/canonical/PropertyService ' \
13+ 'com.canonical.PropertyService.SetProperty ' \
14 'string:autopilot boolean:%s' % dbusarg
15 adb.shell(dbus_call, False)
16 # wait until it is done; it takes a while to start apparmor_parser, so
17@@ -126,23 +128,25 @@
18
19
20 def sudo_shell(adb, sudocmd, cmd):
21- adb.shell('%s %s' % (sudocmd, cmd))
22+ output = adb.shell('%s %s' % (sudocmd, cmd), ignore_errors=False)
23+ print('%s' % output)
24
25
26 def _handle_writable_image(adb, args):
27- if not is_remote_root(adb):
28- dbus_call = 'dbus-send --system --print-reply --dest=com.canonical.PropertyService ' \
29- '/com/canonical/PropertyService com.canonical.PropertyService.SetProperty ' \
30- 'string:writable boolean:true'
31- adb.shell(dbus_call, False)
32- adb.reboot()
33- else:
34- fname = '/userdata/.writable_image'
35- try:
36- adb.shell('test -e %s' % fname, False)
37- except CalledProcessError as e:
38+ fname = '/userdata/.writable_image'
39+ try:
40+ adb.shell('test -e %s' % fname, False)
41+ except CalledProcessError as e:
42+ if not is_remote_root(adb):
43+ dbus_call = 'dbus-send --system --print-reply ' \
44+ '--dest=com.canonical.PropertyService ' \
45+ '/com/canonical/PropertyService ' \
46+ 'com.canonical.PropertyService.SetProperty ' \
47+ 'string:writable boolean:true'
48+ adb.shell(dbus_call, False)
49+ else:
50 adb.shell('touch %s' % fname, False)
51- adb.reboot()
52+ adb.reboot()
53
54 adb.wait_for_device()
55 adb.wait_for_network()
56@@ -153,7 +157,7 @@
57 if not is_remote_root(adb) and args.remotepassword:
58 tempfile = adb.shell('mktemp -t sudo_askpass.XXXX').rstrip()
59
60- adb.shell('/bin/echo -e \\"#!/bin/sh\necho %s \\" > %s ' %
61+ adb.shell("printf '%%s\\n' '#!/bin/sh' 'echo %s' >> %s " %
62 (args.remotepassword[0], tempfile), ignore_errors=False)
63 adb.shell("chmod u+x %s" % tempfile)
64 sudocmd = 'SUDO_ASKPASS=%s sudo -A' % tempfile

Subscribers

People subscribed via source and target branches