Skip to content

Commit 4f7613b

Browse files
committed
big changes
Signed-off-by: bachnxuan <bachnxuan@gmail.com>
1 parent 0dd68fa commit 4f7613b

1 file changed

Lines changed: 15 additions & 10 deletions

File tree

‎build.sh‎

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ exec > >(tee "$LOGFILE") 2>&1
7373
: "${TG_CHAT_ID:?Required chat ID missing: TG_CHAT_ID}"
7474

7575
# Verify KernelSU variant
76-
KSU="${KSU^^}"
76+
KSU="${KSU^^}"
7777
case "$KSU" in NONE | KSU | NEXT | SUKI) ;;
7878
*)
7979
error "Invalid KSU='$KSU' (expected: NONE|KSU|NEXT|SUKI)" >&2
@@ -97,7 +97,12 @@ NC='\033[0m'
9797

9898
# MarkdownV2 escape
9999
escape_md_v2() {
100-
echo "$*" | sed -e 's/\\/\\\\/g' -e 's/[][(){}.+\-=_*|!#>~`]/\\&/g'
100+
local s=$*
101+
s=${s//\\/\\\\} s=${s//_/\\_} s=${s//*/\\*} s=${s//[/\\[} s=${s//]/\\]}
102+
s=${s//(/\\(} s=${s//)/\\)} s=${s//~/\\~} s=${s//\`/\\\`} s=${s//>/\\>}
103+
s=${s//#/\\#} s=${s//+/\\+} s=${s//-/\\-} s=${s//=/\\=} s=${s//|/\\|}
104+
s=${s//\{/\\{} s=${s//\}/\\}} s=${s//./\\.} s=${s//!/\\!}
105+
echo "$s"
101106
}
102107

103108
# Logging functions
@@ -187,7 +192,7 @@ git_clone() {
187192
### Prepare environent ###
188193

189194
RESET_DIR_LIST=(
190-
"$KERNEL_DEST" "$ANYKERNEL_DEST" "$OUT_DIR" "$DIST_DIR"
195+
"$KERNEL_DEST" "$ANYKERNEL_DEST" "$OUT_DIR"
191196
)
192197
info "Preparing directories: ${RESET_DIR_LIST[*]}"
193198
for dir in "${RESET_DIR_LIST[@]}"; do
@@ -263,7 +268,7 @@ if [[ $ksu_included == true ]]; then
263268
info "Setting up KernelSU"
264269
case "$KSU" in
265270
"NEXT") install_ksu KernelSU-Next/KernelSU-Next next ;;
266-
"SUKI") install_ksu SukiSU-Ultra/SukiSU-Ultra "$(if [[ "$SUSFS" == "true" ]]; then echo "susfs-main"; else echo "nongki"; fi)" ;;
271+
"SUKI") install_ksu SukiSU-Ultra/SukiSU-Ultra "$(if [[ $SUSFS == "true" ]]; then echo "susfs-main"; else echo "nongki"; fi)" ;;
267272
esac
268273

269274
info "Applying manual hook patch"
@@ -274,18 +279,18 @@ if [[ $ksu_included == true ]]; then
274279
fi
275280

276281
config --enable CONFIG_KSU
277-
282+
278283
config --enable CONFIG_KSU_TRACEPOINT_HOOK
279284
config --enable CONFIG_KSU_MANUAL_HOOK
280285
config --disable CONFIG_KSU_KPROBES_HOOK
281-
286+
282287
config --enable CONFIG_KPM
283288
config --disable CONFIG_KSU_MANUAL_SU
284289
success "Setup KernelSU successfully!"
285290
fi
286291

287292
# SuSFS setup
288-
if [[ "$SUSFS" == "true" ]]; then
293+
if [[ $SUSFS == "true" ]]; then
289294
# Kernel-side
290295
info "Applying kernel-side SuSFS patches"
291296
SUSFS_DIR="$WORKSPACE/susfs"
@@ -323,7 +328,7 @@ else
323328
config --disable CONFIG_KSU_SUSFS
324329
fi
325330

326-
if [[ "$LXC" == "true" ]]; then
331+
if [[ $LXC == "true" ]]; then
327332
info "Applying LXC patch..."
328333
patch -p1 --forward --fuzz=3 --no-backup-if-mismatch < "$KERNEL_PATCHES/lxc_support.patch"
329334
success "Applied LXC patch successfully"
@@ -352,8 +357,8 @@ info "Making an flashable AnyKernel3 zip..."
352357

353358
cd "${ANYKERNEL_DEST}"
354359
VARIANT="$KSU"
355-
[[ "$SUSFS" == "true" ]] && VARIANT+="-SUSFS"
356-
[[ "$LXC" == "true" ]] && VARIANT+="-LXC"
360+
[[ $SUSFS == "true" ]] && VARIANT+="-SUSFS"
361+
[[ $LXC == "true" ]] && VARIANT+="-LXC"
357362
PACKAGE_NAME="$KERNEL_NAME-$KERNEL_VERSION-$VARIANT-$(date '+%F')"
358363
zip -r9 "$WORKSPACE/$PACKAGE_NAME.zip" ./*
359364
cd "$OLDPWD"

0 commit comments

Comments
 (0)