forked from AdrianDC/advanced_development_shell_tools
/
android_release.rc
executable file
·200 lines (176 loc) · 4.53 KB
/
android_release.rc
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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
#!/bin/bash
# ======================================
# Developed by Adrian DC - 2015-2016
# ======================================
# === ROM Output Cleaner ===
function outdevcl()
{
if [ -z "$1" ]; then
echo " Usage: outdevcl devicename";
echo "";
return;
fi;
outdir="./out/target/product/$1";
rm -rfv "$outdir/combinedroot";
rm -rfv "$outdir/data";
rm -rfv "$outdir/install";
rm -rfv "$outdir/recovery";
rm -rfv "$outdir/root";
rm -rfv "$outdir/system";
rm -rfv "$outdir/utilities";
rm -rfv "$outdir/boot"*;
rm -rfv "$outdir/combined"*;
rm -rfv "$outdir/kernel";
rm -rfv "$outdir/ramdisk"*;
rm -rfv "$outdir/recovery"*;
rm -rfv "$outdir/system"*;
rm -rfv "$outdir/"*$1*".zip";
rm -rfv "$outdir/"*$1*".zip.md5sum";
rm -rfv "$outdir/"*"ota"*".zip";
rm -rfv "$outdir/obj/ETC/system_build_prop_intermediates";
rm -rfv "$outdir/obj/PACKAGING/target_files_intermediates";
rm -rfv "$outdir/ota_temp/RECOVERY/RAMDISK";
}
# === ROM Automatic Releaser ===
function romautorelease()
{
# Function usage
if [ -z "$1" ]; then
echo "";
echo " Usage: romautorelease devicename [cm/dev/caf/oms,j1,nowipe/outcl,local/wipeout]";
echo "";
return;
fi;
# Internal variables
local cwd=$(pwd);
local rom_logs="/media/adriandc/AndroidDev/Logs";
repor;
# ROM variables
local rom_device="$1";
local rom_params="$2";
local rom_phone="${rom_device^}";
local rom_tag;
local rom_target;
# CyanogenMod 14.0
if [[ "$rom_params" =~ "cm" ]]; then
rom_target="$rom_phone/CyanogenMod-14.0";
rom_tag="CM140";
# AOSP-CAF 6.0
elif [[ "$rom_params" =~ "caf" ]]; then
rom_target="$rom_phone/AOSP-CF-6.0";
rom_tag="AOSP-CAF-6.0";
# AOSP-OMS 6.0
elif [[ "$rom_params" =~ "oms" ]]; then
rom_target="$rom_phone/AOSP-OMS-6.0";
rom_tag="AOSP-OMS-6.0";
# AOSP-CAF 6.0
elif [[ "$rom_params" =~ "caf" ]]; then
rom_target="$rom_phone/AOSP-CAF-6.0";
rom_tag="AOSP-CAF-6.0";
# Development
elif [[ "$rom_params" =~ "dev" ]]; then
rom_target="Development";
rom_tag="CM140";
# Automatic CyanogenMod 14.0
else
rom_tag="CM140";
# Automatic per-device selection
case "$rom_device" in
huashan|hayabusa|mint|tsubasa)
rom_target="$rom_phone/CyanogenMod-14.0";;
anzu|taoshan|*)
rom_target="Development";;
esac;
fi;
# Cleanup output sources
if [[ "$rom_params" =~ "nobuild" ]]; then
echo " Cleaning skipped...";
elif [[ "$rom_params" =~ "outcl" ]]; then
rm -rfv "./out/target/product";
elif [[ ! "$rom_params" =~ "nowipe" ]]; then
outdevcl "$rom_device";
fi;
# CPU handling
if [[ "$rom_params" =~ "j1" ]]; then
build_cpu_count=1;
else
build_cpu_count=$(grep -c ^processor /proc/cpuinfo);
fi;
# Start the compilation
rom_logs_output="$rom_logs/Build.$rom_device.$rom_tag.log";
if [[ "$rom_params" =~ "nobuild" ]]; then
echo " Build skipped...";
elif [[ "$rom_tag" =~ "CAF" ]]; then
source ./build/envsetup.sh;
lunch aosp_$rom_device-userdebug;
make -j$build_cpu_count otapackage | tee $rom_logs_output;
elif [[ "$rom_tag" =~ "AOSP" ]]; then
source ./build/envsetup.sh;
lunch aosp_$rom_device-userdebug;
make -j$build_cpu_count bacon | tee $rom_logs_output;
else
repos "$rom_device";
brunch "$rom_device" | tee $rom_logs_output;
fi;
# Send the result and notify
pushbrom "$rom_device";
if [[ ! "$rom_params" =~ "local" ]]; then
devuplrom "$rom_device" "$rom_target";
fi;
# Wipe product output if requested
if [[ "$rom_params" =~ "wipeout" ]]; then
outdevcl "$rom_device";
fi;
cd "$cwd";
}
# === CyanogenMod Automatic Releaser ===
function cmautorelease()
{
cdand;
cdcm;
reposy;
cm14patcher;
for device in huashan mint hayabusa tsubasa; do
romautorelease "$device" 'cm';
done;
}
# === MultiROM Automatic Releaser ===
function mromautorelease()
{
cdand;
cdmultirom;
repomrom "huashan";
for device in mint hayabusa tsubasa; do
repomrom "$device" "nosync";
done;
}
# === ROM CAF 8x60 Releaser ===
function cafautorelease()
{
cdand;
cdaospcaf;
reposycl;
for device in huashan mint hayabusa tsubasa; do
romautorelease "$device" caf;
done;
}
# === ROM OMS 8x60 Releaser ===
function omsautorelease()
{
cdand;
cdaospoms;
reposycl;
for device in huashan mint hayabusa tsubasa; do
romautorelease "$device" oms;
done;
}
# === TWRP Automatic Releaser ===
function twrpautorelease()
{
cdand;
cdtwrp;
repotwrp "huashan";
for device in mint hayabusa tsubasa; do
repotwrp "$device" "nosync";
done;
}