[Merge] lp:~ogra/phablet-tools/phablet-tools-fix-writable-image into lp:phablet-tools
Sergio Schvezov
sergio.schvezov at canonical.com
Wed Sep 17 12:25:01 UTC 2014
Review: Needs Fixing
cosmetic fixes
Diff comments:
> === modified file 'phablet-config'
> --- phablet-config 2014-09-16 10:05:01 +0000
> +++ phablet-config 2014-09-17 11:30:50 +0000
> @@ -109,8 +109,10 @@
> dbusarg = 'false'
> if args.dbus_probe == 'enable':
> dbusarg = 'true'
> - dbus_call = 'dbus-send --system --print-reply --dest=com.canonical.PropertyService ' \
> - '/com/canonical/PropertyService com.canonical.PropertyService.SetProperty ' \
> + dbus_call = 'dbus-send --system --print-reply ' \
> + '--dest=com.canonical.PropertyService ' \
> + '/com/canonical/PropertyService ' \
> + 'com.canonical.PropertyService.SetProperty ' \
> 'string:autopilot boolean:%s' % dbusarg
> adb.shell(dbus_call, False)
> # wait until it is done; it takes a while to start apparmor_parser, so
> @@ -126,23 +128,25 @@
>
>
> def sudo_shell(adb, sudocmd, cmd):
> - adb.shell('%s %s' % (sudocmd, cmd))
> + output = adb.shell('%s %s' % (sudocmd, cmd), ignore_errors=False)
> + print("%s" % output)
as this codebase is using single quotes, it would be better if you switch to that
>
>
> def _handle_writable_image(adb, args):
> - if not is_remote_root(adb):
> - dbus_call = 'dbus-send --system --print-reply --dest=com.canonical.PropertyService ' \
> - '/com/canonical/PropertyService com.canonical.PropertyService.SetProperty ' \
> - 'string:writable boolean:true'
> - adb.shell(dbus_call, False)
> - adb.reboot()
> - else:
> - fname = '/userdata/.writable_image'
> - try:
> - adb.shell('test -e %s' % fname, False)
> - except CalledProcessError as e:
> + fname = '/userdata/.writable_image'
> + try:
> + adb.shell('test -e %s' % fname, False)
> + except CalledProcessError as e:
> + if not is_remote_root(adb):
> + dbus_call = 'dbus-send --system --print-reply ' \
> + '--dest=com.canonical.PropertyService ' \
> + '/com/canonical/PropertyService ' \
> + 'com.canonical.PropertyService.SetProperty ' \
> + 'string:writable boolean:true'
> + adb.shell(dbus_call, False)
> + else:
> adb.shell('touch %s' % fname, False)
> - adb.reboot()
> + adb.reboot()
>
> adb.wait_for_device()
> adb.wait_for_network()
> @@ -153,7 +157,7 @@
> if not is_remote_root(adb) and args.remotepassword:
> tempfile = adb.shell('mktemp -t sudo_askpass.XXXX').rstrip()
>
> - adb.shell('/bin/echo -e \\"#!/bin/sh\necho %s \\" > %s ' %
> + adb.shell("printf '%%s\\n' '#!/bin/sh' 'echo %s' >> %s " %
single quotes
> (args.remotepassword[0], tempfile), ignore_errors=False)
> adb.shell("chmod u+x %s" % tempfile)
> sudocmd = 'SUDO_ASKPASS=%s sudo -A' % tempfile
>
--
https://code.launchpad.net/~ogra/phablet-tools/phablet-tools-fix-writable-image/+merge/234946
Your team Ubuntu Phablet Team is subscribed to branch lp:phablet-tools.
More information about the Ubuntu-reviews
mailing list