From 2948476589a4ad73b8c14faa1842c193dedbc23c Mon Sep 17 00:00:00 2001 From: KOWX712 Date: Thu, 31 Oct 2024 23:27:00 +0800 Subject: [PATCH] optimize --- lite-script_only/UpdateTargetList.sh | 3 +-- module/action.sh | 8 +++++++- module/common/UpdateTargetList.sh | 7 +------ 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/lite-script_only/UpdateTargetList.sh b/lite-script_only/UpdateTargetList.sh index 62f61c2..f09c696 100644 --- a/lite-script_only/UpdateTargetList.sh +++ b/lite-script_only/UpdateTargetList.sh @@ -1,7 +1,7 @@ #!/bin/sh # by KOW -# Tricky Addon Lite: Update Target List Script v1.4.1 (v1.3.1) +# Tricky Addon Lite: Update Target List Script v1.5 # GitHub Repository: https://github.com/KOWX712/Tricky-Addon-Update-Target-List/blob/master/lite-script_only/README.md # Telegram channel: https://t.me/kowchannel @@ -26,7 +26,6 @@ echo " " echo " Staring script..." echo " " -# Create or overwrite the target.txt file > /data/adb/tricky_store/target.txt echo " Adding apps to target.txt..." diff --git a/module/action.sh b/module/action.sh index 42935a8..0d0f459 100644 --- a/module/action.sh +++ b/module/action.sh @@ -3,7 +3,13 @@ echo "**********************************************" echo "- Staring script..." echo " " -sh "$TS"/UpdateTargetList.sh +if [ ! -f "$TS/UpdateTargetList.sh" ]; then + echo "! Script missing, please install module again" + echo "**********************************************" + exit 1 +else + . "$TS/UpdateTargetList.sh" +fi echo "**********************************************" echo "\(__All set!__)/" diff --git a/module/common/UpdateTargetList.sh b/module/common/UpdateTargetList.sh index 88183f5..0595d85 100644 --- a/module/common/UpdateTargetList.sh +++ b/module/common/UpdateTargetList.sh @@ -6,7 +6,6 @@ # Using module to put normal app into system app may exclude corresponding app from this script too, please disable it if you found this script doesn't work. MODDIR="/data/adb/tricky_store/target_list_config" -# Config file check echo "- Checking config files..." echo " " if [ ! -f "$MODDIR/EXCLUDE" ]; then @@ -24,26 +23,22 @@ else echo " " fi -# Read exclution and addition config EXCLUDE=$(grep -vE '^[[:space:]]*#|^[[:space:]]*$' "$MODDIR/EXCLUDE" | sed 's/^[[:space:]]*//;s/[[:space:]]*$//' | tr '\n' '|' | sed 's/|$//') ADDITION=$(grep -vE '^[[:space:]]*#|^[[:space:]]*$' "$MODDIR/ADDITION") -# Create or overwrite the target.txt file echo "- Overwritting target.txt" echo " " > /data/adb/tricky_store/target.txt -# Add all non-system apps to the target file and remove exclusions echo "- Adding apps into /data/adb/tricky_store/target.txt" echo " " su -c pm list packages -3 &1 | cat | awk -F: '{print $2}' | grep -Ev "$EXCLUDE" > /data/adb/tricky_store/target.txt sleep 1 -# Add additional apps to the target file if they are not already present echo "- Adding addition app... " echo " " for app in $ADDITION; do - app=$(echo "$app" | tr -d '[:space:]') # Trim any whitespace + app=$(echo "$app" | tr -d '[:space:]') if ! grep -Fxq "$app" /data/adb/tricky_store/target.txt; then echo "$app" >> /data/adb/tricky_store/target.txt fi