aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Wendt <thoemy@gmx.net>2015-02-01 16:42:46 +0100
committereyosen <abittin@gmail.com>2015-02-04 14:47:05 +0200
commit7a54e6b0736c764c66dc4ae7f6e2df2b0abd13cb (patch)
treeb9a029338126252143ce95875e0c656d5d156746
parent12a7ba94776b1911d5074b62a15ddf2680d25635 (diff)
endeavoru: Abort installation if a incompatible recovery is detected
The ROM installation is aborted if the storage layouts don't match. Detection is done based on a property that is either 1 or unset. This serves as preparation for the upcoming storage layout change. Change-Id: I94385ce5790f69702056d2b4f6a185607388df3c
-rw-r--r--releasetools.py48
1 files changed, 34 insertions, 14 deletions
diff --git a/releasetools.py b/releasetools.py
index cd76ce7..6c5edc7 100644
--- a/releasetools.py
+++ b/releasetools.py
@@ -19,18 +19,38 @@ import common
import os
import shutil
-#TARGET_DIR = os.getenv('OUT')
-#UTILITIES_DIR = os.path.join(TARGET_DIR, 'utilities')
-
-def FullOTA_Assertions(info):
- info.script.AppendExtra(
- ('assert('
- 'getprop("ro.bootloader") == "1.28.0000" || '
- 'getprop("ro.bootloader") == "1.31.0000" || '
- 'getprop("ro.bootloader") == "1.33.0000" || '
- 'getprop("ro.bootloader") == "1.36.0000" || '
- 'getprop("ro.bootloader") == "1.39.0000" || '
- 'getprop("ro.bootloader") == "1.72.0000" || '
- 'getprop("ro.bootloader") == "1.73.0000"'
- ');'))
+# CWM displays 48 chars. ->|
+LAYOUT_ERROR_MESSAGE = """
+Your recovery is using the new storage layout
+but the ROM you're trying to install is not.
+Flash a compatible recovery and format /data and
+/sdcard or use a compatible ROM.
+
+For more information see: http://goo.gl/vvy4c7
+"""
+
+# Property is '1' if the new format is supported and '' if not
+PROPERTY='ro.build.endeavoru.newlayout'
+
+def FullOTA_Assertions(self):
+ self.script.AssertSomeBootloader("1.28.0000", "1.31.0000", "1.33.0000",
+ "1.36.0000", "1.39.0000", "1.72.0000",
+ "1.73.0000")
+
+def FullOTA_InstallBegin(self):
+ self.script.AppendExtra('package_extract_file("%s", "%s");' % ("system/build.prop",
+ "/tmp/rom.prop"))
+
+ self.script.AppendExtra('file_getprop("/tmp/rom.prop", "%s");' % PROPERTY)
+
+ rom_prop = 'file_getprop("/tmp/rom.prop", "%s")' % PROPERTY
+ recovery_prop = 'getprop("%s")' % PROPERTY
+
+ # Check if the properties are equal
+ self.script.AppendExtra('ifelse(%s != %s,' % (rom_prop, recovery_prop))
+
+ for line in LAYOUT_ERROR_MESSAGE.split('\n'):
+ self.script.AppendExtra('ui_print("%s"); ' % line)
+
+ self.script.AppendExtra('abort("Incompatible ROM storage layout"); );')