forked from CyanogenMod/android_device_htc_endeavoru
-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathreleasetools.py
56 lines (43 loc) · 1.99 KB
/
releasetools.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
# Copyright (C) 2013 The Android Open Source Project
# Copyright (C) 2013 The CyanogenMod Project
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""Custom OTA commands for endeavoru"""
import common
import os
import shutil
# 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"); );')