From abb45a5542fedd2a7c587aa91402b21f606bc259 Mon Sep 17 00:00:00 2001 From: Tao Bao Date: Wed, 25 Oct 2017 11:13:03 -0700 Subject: update_device.py: Handle the package push without 'adb root'. When using '--file' (and without '--no-push'), it tries to push the package to /data/ota_package/debug.zip. However, that's not allowed directly with 'adb push', unless by restarting adb with 'adb root'. This CL works around the issue by pushing the file to /data/local/tmp first, then moving it over to the desired place. Test: update_device.py --file Change-Id: I608284cc90918fc01cf7584569d4d7d4165148ca --- scripts/update_device.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'scripts/update_device.py') diff --git a/scripts/update_device.py b/scripts/update_device.py index b2452ac9..49de7a15 100755 --- a/scripts/update_device.py +++ b/scripts/update_device.py @@ -382,7 +382,12 @@ def main(): device_ota_file = os.path.join(OTA_PACKAGE_PATH, 'debug.zip') payload_url = 'file://' + device_ota_file if not args.no_push: - cmds.append(['push', args.otafile, device_ota_file]) + data_local_tmp_file = '/data/local/tmp/debug.zip' + cmds.append(['push', args.otafile, data_local_tmp_file]) + cmds.append(['shell', 'su', '0', 'mv', data_local_tmp_file, + device_ota_file]) + cmds.append(['shell', 'su', '0', 'chcon', + 'u:object_r:ota_package_file:s0', device_ota_file]) cmds.append(['shell', 'su', '0', 'chown', 'system:cache', device_ota_file]) cmds.append(['shell', 'su', '0', 'chmod', '0660', device_ota_file]) else: -- cgit v1.2.3