summaryrefslogtreecommitdiffstats
path: root/tools/releasetools
diff options
context:
space:
mode:
authorTao Bao <tbao@google.com>2015-07-07 18:31:47 -0700
committerTao Bao <tbao@google.com>2015-07-07 20:52:01 -0700
commit610754e5ad84b2e65358d85dd38a4e0c86dc9342 (patch)
tree60c14eef3e96388cfe48e67dce93eb2c0e759c8c /tools/releasetools
parent1e253e76b9f0fcc92769b3dd02c8ffc8cc30520d (diff)
downloadbuild-610754e5ad84b2e65358d85dd38a4e0c86dc9342.zip
build-610754e5ad84b2e65358d85dd38a4e0c86dc9342.tar.gz
build-610754e5ad84b2e65358d85dd38a4e0c86dc9342.tar.bz2
Scan all init.*.rc files for flash_recovery service.
Clockwork builds may rename init.rc to init.core.rc. Change the OTA script to scan all init.*.rc files to determine the proper location for install-recovery.sh. Bug: 22128990 Change-Id: If96bd0b81090683ad0bbfddb735d390204849d9f
Diffstat (limited to 'tools/releasetools')
-rw-r--r--tools/releasetools/common.py24
1 files changed, 17 insertions, 7 deletions
diff --git a/tools/releasetools/common.py b/tools/releasetools/common.py
index 3c1575b..edacf7f 100644
--- a/tools/releasetools/common.py
+++ b/tools/releasetools/common.py
@@ -1203,18 +1203,28 @@ fi
}
# The install script location moved from /system/etc to /system/bin
- # in the L release. Parse the init.rc file to find out where the
+ # in the L release. Parse init.*.rc files to find out where the
# target-files expects it to be, and put it there.
sh_location = "etc/install-recovery.sh"
- try:
- with open(os.path.join(input_dir, "BOOT", "RAMDISK", "init.rc")) as f:
+ found = False
+ init_rc_dir = os.path.join(input_dir, "BOOT", "RAMDISK")
+ init_rc_files = os.listdir(init_rc_dir)
+ for init_rc_file in init_rc_files:
+ if (not init_rc_file.startswith('init.') or
+ not init_rc_file.endswith('.rc')):
+ continue
+
+ with open(os.path.join(init_rc_dir, init_rc_file)) as f:
for line in f:
- m = re.match("^service flash_recovery /system/(\S+)\s*$", line)
+ m = re.match(r"^service flash_recovery /system/(\S+)\s*$", line)
if m:
sh_location = m.group(1)
- print "putting script in", sh_location
+ found = True
break
- except (OSError, IOError), e:
- print "failed to read init.rc: %s" % (e,)
+
+ if found:
+ break
+
+ print "putting script in", sh_location
output_sink(sh_location, sh)