releasetools: Add --oem_no_mount option.
We may have devices with OEM-specific properties but without an OEM
partition (e.g. the properties might be set by init based on hardware
SKUs). For such devices, we supply --oem_no_mount to skip mounting the
OEM partition in the updater-script. The option is only meaningful when
-o (--oem_settings) is specified.
Bug: 27359929
Change-Id: Ic08396e478a82be4188e980e704b33b4f704a8d7
(cherry picked from commit 8608cde944d64dece63e8c770deb78c1d092c719)
diff --git a/tools/releasetools/edify_generator.py b/tools/releasetools/edify_generator.py
index a52e328..f597cb3 100644
--- a/tools/releasetools/edify_generator.py
+++ b/tools/releasetools/edify_generator.py
@@ -77,11 +77,17 @@
raise ValueError("must specify an OEM property")
if not value:
raise ValueError("must specify the OEM value")
- cmd = ('file_getprop("/oem/oem.prop", "{name}") == "{value}" || '
- 'abort("This package expects the value \\"{value}\\" for '
- '\\"{name}\\" on the OEM partition; this has value \\"" + '
- 'file_getprop("/oem/oem.prop", "{name}") + "\\".");').format(
- name=name, value=value)
+ if common.OPTIONS.oem_no_mount:
+ cmd = ('getprop("{name}") == "{value}" || '
+ 'abort("This package expects the value \\"{value}\\" for '
+ '\\"{name}\\"; this has value \\"" + '
+ 'getprop("{name}") + "\\".");').format(name=name, value=value)
+ else:
+ cmd = ('file_getprop("/oem/oem.prop", "{name}") == "{value}" || '
+ 'abort("This package expects the value \\"{value}\\" for '
+ '\\"{name}\\" on the OEM partition; this has value \\"" + '
+ 'file_getprop("/oem/oem.prop", "{name}") + "\\".");').format(
+ name=name, value=value)
self.script.append(cmd)
def AssertSomeFingerprint(self, *fp):