remove curl binary

use busybox wget binary instead of curl binary to fetch exclude-list
This commit is contained in:
KOWX712
2024-11-14 21:44:31 +08:00
parent e9346303ac
commit bcfb8c12ad
7 changed files with 33 additions and 15 deletions
+30 -4
View File
@@ -2,17 +2,43 @@
MODPATH=${0%/*}
OUTPUT="$MODPATH/exclude-list"
BBPATH="/data/adb/modules/busybox-ndk/system/*/busybox \
/data/adb/magisk/busybox \
/data/adb/ksu/bin/busybox \
/data/adb/ap/bin/busybox"
find_busybox() {
for path in $BBPATH; do
if [ -f "$path" ]; then
BUSYBOX="$path"
return 0
fi
done
return 1
}
if ! curl -s "https://modules.lsposed.org/modules.json" > /dev/null; then
exit 1
# Check for wget binary
if ! command -v wget >/dev/null || grep -q "wget-curl" "$(command -v wget)"; then
if find_busybox; then
wget() { "$BUSYBOX" wget "$@"; }
else
echo "Error: busybox not found in specified paths." > "$OUTPUT"
exit 1
fi
fi
# Fetch Xposed module package names
curl -s "https://modules.lsposed.org/modules.json" | \
wget --no-check-certificate -q -O - "https://modules.lsposed.org/modules.json" 2>/dev/null | \
grep -o '"name":"[^"]*","description":' | \
awk -F'"' '{print $4}' > "$OUTPUT"
# Fetch additional package names
curl -s "https://raw.githubusercontent.com/KOWX712/Tricky-Addon-Update-Target-List/master/more-excldue.json" | \
wget --no-check-certificate -q -O - "https://raw.githubusercontent.com/KOWX712/Tricky-Addon-Update-Target-List/master/more-excldue.json" 2>/dev/null | \
grep -o '"package-name": *"[^"]*"' | \
awk -F'"' '{print $4}' >> "$OUTPUT"
# Check if the output directory is empty
if [ ! -s "$OUTPUT" ]; then
echo "Error: Failed to fetch data." > "$OUTPUT"
exit 1
fi