diff options
author | Tao Bao <tbao@google.com> | 2015-07-08 10:43:31 -0700 |
---|---|---|
committer | Tao Bao <tbao@google.com> | 2015-07-08 10:43:31 -0700 |
commit | 38a534b6939630039d0c78c2f9f20dd8fde64c85 (patch) | |
tree | 6299ff96b2ba84272c93f355c5109994d653d841 /tools/releasetools/common.py | |
parent | 26b3ec5a689f187b3174d1f774d40d879730b729 (diff) | |
parent | 610754e5ad84b2e65358d85dd38a4e0c86dc9342 (diff) | |
download | build-38a534b6939630039d0c78c2f9f20dd8fde64c85.zip build-38a534b6939630039d0c78c2f9f20dd8fde64c85.tar.gz build-38a534b6939630039d0c78c2f9f20dd8fde64c85.tar.bz2 |
resolved conflicts for merge of 610754e5 to cw-e-dev
Change-Id: Ia0d0d82c7fec86e1585a9e2c90ac877c363ed491
Diffstat (limited to 'tools/releasetools/common.py')
-rw-r--r-- | tools/releasetools/common.py | 22 |
1 files changed, 16 insertions, 6 deletions
diff --git a/tools/releasetools/common.py b/tools/releasetools/common.py index 6f921e0..e8ab5ec 100644 --- a/tools/releasetools/common.py +++ b/tools/releasetools/common.py @@ -1388,18 +1388,28 @@ fi 'bonus_args': bonus_args} # 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(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) as e: - print "failed to read init.rc: %s" % (e,) + + if found: + break + + print "putting script in", sh_location output_sink(sh_location, sh) |