forked from leegarchat/dfe-neo-v2
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathBUILD_DFE.sh
210 lines (201 loc) · 7.26 KB
/
BUILD_DFE.sh
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
203
204
205
206
207
208
209
210
#!/bin/bash
VERSION="$1"
TEST="$2"
if ! type "7z" &>/dev/null ; then
echo "Не установлен 7z. Нужен для сборки"
fi
change_langues(){
cat "$WORK_DIR/tmp/CONFIG" > "$WORK_DIR/$FOLDER/NEO.config"
while IFS= read -r line; do
echo "1'$line'"
case $line in
*EXAMPLE_LNG)
echo "2'$line'"
new_line=${line/"-EXAMPLE_LNG"/}
echo "3'$new_line'"
sed -i "/$line/ {r $WORK_DIR/$FOLDER/META-INF/tools/languages/$1/$new_line.lng
d
}" "$WORK_DIR/$FOLDER/NEO.config"
;;
esac
done <"$WORK_DIR/tmp/CONFIG"
}
DIRNAME="$(dirname "$(realpath "$0")")"
files_needed=(
customize.sh
META-INF/com/google/android/update-binary
META-INF/com/google/android/updater-script
META-INF/tools/denylist.txt
META-INF/tools/init.sh
META-INF/tools/install.sh
META-INF/tools/languages/en/en.sh
META-INF/tools/languages/hi/hi.sh
META-INF/tools/languages/id/id.sh
META-INF/tools/languages/ru/ru.sh
META-INF/tools/languages/zh/zh.sh
META-INF/tools/magisk.db
module.prop
NEO.config
)
magisk_files=(
MAGISK/Magisk-Delta-v26.4.apk
MAGISK/Magisk-Delta-v27.0.apk
MAGISK/Magisk-kitsune-v27-R65C33E4F.apk
MAGISK/Magisk-v26.4-kitsune-2.apk
MAGISK/Magisk-v26.4.apk
MAGISK/Magisk-v27.0.zip
)
arm64_bin=(
META-INF/tools/binary/arm64-v8a/avbctl
META-INF/tools/binary/arm64-v8a/bash
META-INF/tools/binary/arm64-v8a/bootctl
META-INF/tools/binary/arm64-v8a/busybox
META-INF/tools/binary/arm64-v8a/lptools_new
META-INF/tools/binary/arm64-v8a/magisk
META-INF/tools/binary/arm64-v8a/magiskboot
META-INF/tools/binary/arm64-v8a/make_ext4fs
META-INF/tools/binary/arm64-v8a/resize2fs
META-INF/tools/binary/arm64-v8a/e2fsck
META-INF/tools/binary/arm64-v8a/tune2fs
META-INF/tools/binary/arm64-v8a/snapshotctl
META-INF/tools/binary/arm64-v8a/sqlite3
META-INF/tools/binary/arm64-v8a/toolbox
META-INF/tools/binary/arm64-v8a/toybox
)
arm32_bin=(
META-INF/tools/binary/armeabi-v7a/avbctl
META-INF/tools/binary/armeabi-v7a/bash
META-INF/tools/binary/armeabi-v7a/bootctl
META-INF/tools/binary/armeabi-v7a/busybox
META-INF/tools/binary/armeabi-v7a/lptools_new
META-INF/tools/binary/armeabi-v7a/magisk
META-INF/tools/binary/armeabi-v7a/magiskboot
META-INF/tools/binary/armeabi-v7a/make_ext4fs
META-INF/tools/binary/armeabi-v7a/resize2fs
META-INF/tools/binary/armeabi-v7a/e2fsck
META-INF/tools/binary/armeabi-v7a/tune2fs
META-INF/tools/binary/armeabi-v7a/snapshotctl
META-INF/tools/binary/armeabi-v7a/sqlite3
META-INF/tools/binary/armeabi-v7a/toolbox
META-INF/tools/binary/armeabi-v7a/toybox
)
x86_bin=(
META-INF/tools/binary/x86/avbctl
META-INF/tools/binary/x86/bash
META-INF/tools/binary/x86/bootctl
META-INF/tools/binary/x86/busybox
META-INF/tools/binary/x86/lptools_new
META-INF/tools/binary/x86/magisk
META-INF/tools/binary/x86/magiskboot
META-INF/tools/binary/x86/make_ext4fs
META-INF/tools/binary/x86/resize2fs
META-INF/tools/binary/x86/e2fsck
META-INF/tools/binary/x86/tune2fs
META-INF/tools/binary/x86/snapshotctl
META-INF/tools/binary/x86/sqlite3
META-INF/tools/binary/x86/toolbox
META-INF/tools/binary/x86/toybox
)
x86_64_bin=(
META-INF/tools/binary/x86_64/avbctl
META-INF/tools/binary/x86_64/bash
META-INF/tools/binary/x86_64/bootctl
META-INF/tools/binary/x86_64/busybox
META-INF/tools/binary/x86_64/lptools_new
META-INF/tools/binary/x86_64/magisk
META-INF/tools/binary/x86_64/magiskboot
META-INF/tools/binary/x86_64/make_ext4fs
META-INF/tools/binary/x86_64/resize2fs
META-INF/tools/binary/x86_64/e2fsck
META-INF/tools/binary/x86_64/tune2fs
META-INF/tools/binary/x86_64/snapshotctl
META-INF/tools/binary/x86_64/sqlite3
META-INF/tools/binary/x86_64/toolbox
META-INF/tools/binary/x86_64/toybox
)
if [[ -z "$TEST" ]] ; then
FULL_LITE_ARGS="full lite"
LNG_ARGS="ru en id hi zh"
ARCH_ARGS="arm64-v8a armeabi-v7a x86 x86_64 Universal"
else
FULL_LITE_ARGS="lite"
LNG_ARGS="ru en"
ARCH_ARGS="arm64-v8a"
fi
cd "$DIRNAME"
sed -i 's/^export EXEMPLE_VERSION=.*/export EXEMPLE_VERSION="'$VERSION'"/' META-INF/com/google/android/update-binary
for line in $(find ./ -name *"\.sh" -or -name "update"* -or -name "NEO.config" -or -name "module.prop" ) ; do
before=$(cat "$line")
sed -i 's/\r$//' "$line"
after=$(cat "$line")
if [ "$before" != "$after" ]; then
echo "Пофикшено: $line"
fi
done
for full_lite in $FULL_LITE_ARGS ; do
for language in $LNG_ARGS ; do
cd "$DIRNAME"
lng="$language"
case "$lng" in
en)
long_lng="english-language"
README_FILE="README.md"
;;
ru)
long_lng="russian-language"
README_FILE="README_ru.md"
;;
id)
long_lng="indonesian-language"
README_FILE="README_id.md"
;;
hi)
long_lng="hindi-language"
README_FILE="README_hi.md"
;;
zh)
long_lng="chinese-language"
README_FILE="README_zh.md"
;;
esac
[[ -d "$DIRNAME/../DFE-NEO-builds/DFE-NEO-$VERSION/$full_lite/$long_lng" ]] || mkdir -pv "$DIRNAME/../DFE-NEO-builds/DFE-NEO-$VERSION/$full_lite/$long_lng" &>/dev/null
for arch in $ARCH_ARGS ; do
{
if [[ "$full_lite" == full ]] ; then
NAME_ZIP="$DIRNAME/../DFE-NEO-builds/DFE-NEO-$VERSION/$full_lite/$long_lng/$arch-$lng-DFE-NEO-$VERSION.zip"
else
NAME_ZIP="$DIRNAME/../DFE-NEO-builds/DFE-NEO-$VERSION/$full_lite/$long_lng/$arch-$lng-DFE-NEO-$VERSION-lite.zip"
fi
echo "- Компиляция... $full_lite:$(basename "$NAME_ZIP")"
case $arch in
arm64-v8a)
7z a -mx9 "$NAME_ZIP" "${files_needed[@]}" "${arm64_bin[@]}" &>/dev/null
;;
armeabi-v7a)
7z a -mx9 "$NAME_ZIP" "${files_needed[@]}" "${arm32_bin[@]}" &>/dev/null
;;
x86)
7z a -mx9 "$NAME_ZIP" "${files_needed[@]}" "${x86_bin[@]}" &>/dev/null
;;
x86_64)
7z a -mx9 "$NAME_ZIP" "${files_needed[@]}" "${x86_64_bin[@]}" &>/dev/null
;;
Universal)
7z a -mx9 "$NAME_ZIP" "${files_needed[@]}" "${x86_64_bin[@]}" "${x86_bin[@]}" "${arm32_bin[@]}" "${arm64_bin[@]}" &>/dev/null
;;
esac
cd "$DIRNAME/META-INF/tools/languages/$language"
7z a -mx9 "$NAME_ZIP" NEO.config &>/dev/null
cd "$DIRNAME"
7z a -mx9 "$NAME_ZIP" $README_FILE &>/dev/null
[[ "$full_lite" == full ]] && 7z a -mx9 "$NAME_ZIP" "${magisk_files[@]}" &>/dev/null
echo "- Компиляция $full_lite:$(basename "$NAME_ZIP") завершена"
if [[ -n "$TEST" ]] ; then
cp "$NAME_ZIP" $DIRNAME/../DFE-NEO-builds/
fi
} &
done
wait
done
done
echo "Зборка версии $VERSION завершена!"