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

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

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

View File

@@ -18,8 +18,8 @@ COMPATH="$MODPATH/common"
TS="/data/adb/modules/tricky_store"
SCRIPT_DIR="/data/adb/tricky_store"
CONFIG_DIR="$SCRIPT_DIR/target_list_config"
MODNAME=$(grep '^id=' "$MODPATH/module.prop" | awk -F= '{print $2}' | xargs)
ORG_DIR="/data/adb/modules/$MODNAME"
MODID=`grep_prop id $TMPDIR/module.prop`
ORG_DIR="/data/adb/modules/$MODID"
kb="$COMPATH/.default"
if [ ! -d "$TS" ]; then

View File

@@ -5,19 +5,11 @@ initialize() {
cp "$MODPATH/module.prop" "$COMPATH/module.prop.orig"
mv "$COMPATH/UpdateTargetList.sh" "$SCRIPT_DIR/UpdateTargetList.sh"
sed -i "s|\"set-path\"|\"/data/adb/modules/$MODNAME/common/\"|" "$MODPATH/webroot/index.js" || {
sed -i "s|\"set-path\"|\"/data/adb/modules/$MODID/common/\"|" "$MODPATH/webroot/index.js" || {
ui_print "! Failed to replace path"
abort
}
# handle missing binary
if [ ! -f "/system/bin/curl" ]; then
mkdir -p "$MODPATH/system/bin"
mv "$MODPATH/bin/$(getprop ro.product.cpu.abi)/curl" "$MODPATH/system/bin/curl"
set_perm "$MODPATH/system/bin/curl" 0 2000 0777
fi
rm -rf "$MODPATH/bin"
set_perm $SCRIPT_DIR/UpdateTargetList.sh 0 2000 0755
set_perm $COMPATH/get_exclude-list.sh 0 2000 0755
}