-
Notifications
You must be signed in to change notification settings - Fork 45
/
Copy pathbuild-all
executable file
·202 lines (146 loc) · 5.85 KB
/
build-all
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
200
201
202
#!/bin/bash
set -e
source "$(dirname "$(readlink -f "$0")")/.global"
mkdir -p "$patches_dex_dir"
rm -rf "$patches_dex_dir"/*
build_one() {
local patch_name="$1"
local fileset_dirs=( "${@:2}" )
echo "********* BUILD: $patch_name"
echo
local patch_tmp_dir="$tmp_dir/$patch_name"
mkdir "$patch_tmp_dir"
local patch_dex_dirs=()
for fileset_dir in "${fileset_dirs[@]}"; do
local fileset_name="$(basename "$fileset_dir")"
echo "****** build: $patch_name"
echo "****** against: $fileset_name"
echo
local patch_source_dir="$patches_source_dir/$patch_name"
local api_level="$(cut -d '-' -f 1 <<<"$fileset_name")"
local patch_dex_dir="$patch_tmp_dir/${patch_name}__$fileset_name"
patch_dex_dirs+=( "$patch_dex_dir" )
"$base_dir/build-patch" "$patch_source_dir" "$api_level" "$fileset_dir" "$patch_dex_dir"
echo
done
echo "********* PUBLISH: $patch_name"
echo "********* BUILT AGAINST: $(basename "${fileset_dirs[0]}")"
cp -r "${patch_dex_dirs[0]}" "$patches_dex_dir/$patch_name"
echo
echo
}
apply_one() {
local patch_name="$1"
local fileset_dirs=( "${@:2}" )
echo "********* APPLY: $patch_name"
echo
local patch_dex_dir="$patches_dex_dir/$patch_name"
local fileset_tmp_dir="$tmp_dir/${patch_name}__fs"
mkdir "$fileset_tmp_dir"
#patched_fileset_dirs=()
for fileset_dir in "${fileset_dirs[@]}"; do
local fileset_name="$(basename "$fileset_dir")"
echo "****** apply: $patch_name"
echo "****** to: $fileset_name"
echo
local api_level="$(cut -d '-' -f 1 <<<"$fileset_name")"
local patched_fileset_dir="$fileset_tmp_dir/${fileset_name}__$patch_name"
#patched_fileset_dirs+=( "$patched_fileset_dir" )
"$base_dir/patch-fileset" "$patch_dex_dir" "$api_level" "$fileset_dir" "$patched_fileset_dir"
if [ -d "$fileset_dir/dedex" ]; then
ln -s -t "$patched_fileset_dir" "$fileset_dir/dedex"
fi
if [ -d "$fileset_dir/dedex-auto" ]; then
ln -s -t "$patched_fileset_dir" "$fileset_dir/dedex-auto"
fi
echo
done
echo
}
build_and_apply_one() {
build_one "$@"
apply_one "$@"
}
generate_patch_sources() {
echo "********* GENERATE PATCH SOURCES"
"$base_dir/patches-src-gen/generate-patch-sources"
echo
echo
}
build_all() {
shopt -s nullglob
if [[ "$1" == "--quick" || "$1" == "-q" ]]; then
local quick=1
else
local quick=0
fi
tmp_dir="$patches_dex_dir/tmp-dir"
mkdir "$tmp_dir"
echo "*" >"$tmp_dir/.gitignore"
# Android versions and API levels
# API Version Codename
# 28 9.0 Pie
# 27 8.1 Oreo
# 26 8.0 Oreo
# 25 7.1 Nougat
# 24 7.0 Nougat
# 23 6.0 Marshmallow
# 22 5.1 Lollipop
# 21 5.0 Lollipop
# (20) - -
# 19 4.4 KitKat
# 18 4.3 Jelly Bean
# 17 4.2 Jelly Bean
# 16 4.1 Jelly Bean
# 15 4.0.3-4 Ice Cream Sandwich
# 14 4.0.1-2 Ice Cream Sandwich
# (13) 3.2 Honeycomb
# (12) 3.1 Honeycomb
# (11) 3.0 Honeycomb
# 10 2.3.3-7 Gingerbread
# 09 2.3.0-2 Gingerbread
# 08 2.2 Froyo
# 07 2.1 Eclair
# 06 2.0.1 Eclair
# 05 2.0.0 Eclair
# 04 1.6 Donut
# 03 1.5 Cupcake
# 02 1.1 -
# 01 1.0 -
# Generate patch sources
generate_patch_sources
# Build the hook patches
if (( quick )); then
build_and_apply_one sigspoof-hook-1.5-2.3 "$filesets_dir"/10-*
build_and_apply_one sigspoof-hook-4.0 "$filesets_dir"/15-*
build_one sigspoof-hook-4.1-6.0 "$filesets_dir"/16-*
apply_one sigspoof-hook-4.1-6.0 "$filesets_dir"/{16,17,22}-*
build_one sigspoof-hook-7.0-9.0 "$filesets_dir"/24-*
apply_one sigspoof-hook-7.0-9.0 "$filesets_dir"/2{4,6,8}-*
else
build_and_apply_one sigspoof-hook-1.5-2.3 "$filesets_dir"/{0[3-9],10}-*
build_and_apply_one sigspoof-hook-4.0 "$filesets_dir"/1[4-5]-*
build_and_apply_one sigspoof-hook-4.1-6.0 "$filesets_dir"/{1[6-9],2[1-3]}-*
build_and_apply_one sigspoof-hook-7.0-9.0 "$filesets_dir"/2[4-8]-*
fi
# Build the core patch
if (( quick )); then
build_one sigspoof-core "$tmp_dir"/sigspoof-hook-1.5-2.3__fs/10-*
apply_one sigspoof-core "$tmp_dir"/sigspoof-hook-{1.5-2.3,4.0,4.1-6.0,7.0-9.0}__fs/*
else
# Avoid building the core patch on Android 9.0 (Workaround for https://github.com/Lanchon/haystack/issues/23)
#build_and_apply_one sigspoof-core "$tmp_dir"/sigspoof-hook-{1.5-2.3,4.0,4.1-6.0,7.0-9.0}__fs/*
build_one sigspoof-core "$tmp_dir"/sigspoof-hook-{{1.5-2.3,4.0,4.1-6.0}__fs/*,7.0-9.0__fs/2[4-7]-*}
apply_one sigspoof-core "$tmp_dir"/sigspoof-hook-{1.5-2.3,4.0,4.1-6.0,7.0-9.0}__fs/*
fi
# Build the UI patches
build_one sigspoof-ui-global-4.0 "$tmp_dir"/sigspoof-core__fs/1[4-5]-*
build_one sigspoof-ui-global-4.1 "$tmp_dir"/sigspoof-core__fs/16-*
build_one sigspoof-ui-global-4.2-5.0 "$tmp_dir"/sigspoof-core__fs/{1[7-9],21}-*
build_one sigspoof-ui-global-5.1-6.0 "$tmp_dir"/sigspoof-core__fs/2[2-3]-*
build_one sigspoof-ui-global-7.0-7.1 "$tmp_dir"/sigspoof-core__fs/2[4-5]-*
build_one sigspoof-ui-global-8.0-8.1 "$tmp_dir"/sigspoof-core__fs/2[6-7]-*
build_one sigspoof-ui-global-9.0 "$tmp_dir"/sigspoof-core__fs/28-*
rm -rf "$tmp_dir"
}
build_all "$@" 2>&1 | tee "$patches_dex_dir/bulk-patch-builder.log"