refactor code

simplify, bug fix, unify variable name
This commit is contained in:
KOWX712
2024-10-28 21:28:56 +08:00
parent 4a7437705c
commit 1ebe14c646
5 changed files with 58 additions and 51 deletions

View File

@@ -1,25 +1,27 @@
MODDIR=${0%/*}
COMPATH="$MODDIR/common"
MODPATH=${0%/*}
TS="/data/adb/modules/tricky_store"
hash_value=$(grep -v '^#' "$MODDIR/boot_hash" | tr -d '[:space:]')
hash_value=$(grep -v '^#' "$MODPATH/boot_hash" | tr -d '[:space:]')
if [ -n "$hash_value" ]; then
resetprop -n ro.boot.vbmeta.digest "$hash_value"
fi
if [ ! -f "$COMPATH/ninstalled" ] || [ ! -f "$COMPATH/disabled" ] || [ ! -f "$COMPATH/normal" ]; then
sed -i 's/^description=.*/description=Module is corrupted, please reinstall module./' "$MODDIR/module.prop"
if [ ! -f "$MODPATH/common/module.prop.orig" ]; then
sed -i 's/^description=.*/description=Module is corrupted, please reinstall module./' "$MODPATH/module.prop"
touch "$MODPATH/disable"
exit 1
fi
if [ ! -d "$TS" ]; then
cat "$COMPATH/ninstalled" > "$MODDIR/module.prop"
sed -i 's/^description=.*/description=Tricky store is not installed/' "$MODPATH/module.prop"
touch "$MODPATH/disable"
elif [ -f "$TS/disable" ]; then
cat "$COMPATH/disabled" > "$MODDIR/module.prop"
sed -i 's/^description=.*/description=Tricky store is disabled/' "$MODPATH/module.prop"
touch "$MODPATH/disable"
else
cat "$COMPATH/normal" > "$MODDIR/module.prop"
cat "$MODPATH/common/module.prop.orig" > "$MODPATH/module.prop"
until [ "$(getprop sys.boot_completed)" = "1" ]; do
sleep 1
done
. "$COMPATH/UpdateTargetList.sh"
. "$MODPATH/UpdateTargetList.sh"
fi