summaryrefslogtreecommitdiff
path: root/scripts/update_device.py
diff options
context:
space:
mode:
authorLinux Build Service Account <lnxbuild@localhost>2021-05-17 15:13:53 -0700
committerLinux Build Service Account <lnxbuild@localhost>2021-05-17 15:13:53 -0700
commit0482fa15f58c1de5ead9e0e3e2aa1d593d18e6c2 (patch)
tree8a0c2de54ad2c65b6a60c9a4b7d8cfd6450d2a46 /scripts/update_device.py
parentcb81ab091697e25f1b332c7e8f128cbe174ba141 (diff)
parent5d3613e99ec327d2ba487cc00de13b334618886f (diff)
Merge 5d3613e99ec327d2ba487cc00de13b334618886f on remote branch
Change-Id: I2a577c1058cf2e4b65e1c13cb3bc9eccb1b2bea4
Diffstat (limited to 'scripts/update_device.py')
-rwxr-xr-xscripts/update_device.py20
1 files changed, 12 insertions, 8 deletions
diff --git a/scripts/update_device.py b/scripts/update_device.py
index 074b91d6..f672cda0 100755
--- a/scripts/update_device.py
+++ b/scripts/update_device.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python3
#
# Copyright (C) 2017 The Android Open Source Project
#
@@ -350,7 +350,7 @@ class AdbHost(object):
if self._device_serial:
self._command_prefix += ['-s', self._device_serial]
- def adb(self, command):
+ def adb(self, command, timeout_seconds: float = None):
"""Run an ADB command like "adb push".
Args:
@@ -365,7 +365,7 @@ class AdbHost(object):
command = self._command_prefix + command
logging.info('Running: %s', ' '.join(str(x) for x in command))
p = subprocess.Popen(command, universal_newlines=True)
- p.wait()
+ p.wait(timeout_seconds)
return p.returncode
def adb_output(self, command):
@@ -428,12 +428,14 @@ def main():
help='Update with the secondary payload in the package.')
parser.add_argument('--no-slot-switch', action='store_true',
help='Do not perform slot switch after the update.')
- parser.add_argument('--allocate_only', action='store_true',
+ parser.add_argument('--no-postinstall', action='store_true',
+ help='Do not execute postinstall scripts after the update.')
+ parser.add_argument('--allocate-only', action='store_true',
help='Allocate space for this OTA, instead of actually \
applying the OTA.')
- parser.add_argument('--verify_only', action='store_true',
+ parser.add_argument('--verify-only', action='store_true',
help='Verify metadata then exit, instead of applying the OTA.')
- parser.add_argument('--no_care_map', action='store_true',
+ parser.add_argument('--no-care-map', action='store_true',
help='Do not push care_map.pb to device.')
args = parser.parse_args()
logging.basicConfig(
@@ -472,6 +474,8 @@ def main():
if args.no_slot_switch:
args.extra_headers += "\nSWITCH_SLOT_ON_REBOOT=0"
+ if args.no_postinstall:
+ args.extra_headers += "\nRUN_POST_INSTALL=0"
with zipfile.ZipFile(args.otafile) as zfp:
CARE_MAP_ENTRY_NAME = "care_map.pb"
@@ -482,7 +486,7 @@ def main():
care_map_fp.write(zfp.read(CARE_MAP_ENTRY_NAME))
care_map_fp.flush()
dut.adb(["push", care_map_fp.name,
- "/data/ota_package/" + CARE_MAP_ENTRY_NAME])
+ "/data/ota_package/" + CARE_MAP_ENTRY_NAME])
if args.file:
# Update via pushing a file to /data.
@@ -542,7 +546,7 @@ def main():
if server_thread:
server_thread.StopServer()
for cmd in finalize_cmds:
- dut.adb(cmd)
+ dut.adb(cmd, 5)
return 0