diff --git a/module/customize.sh b/module/customize.sh index 48b4b622..89ea550c 100644 --- a/module/customize.sh +++ b/module/customize.sh @@ -1,23 +1,24 @@ -#!/system/bin/sh +#!/system/bin/sh +# customize.sh - Safe Installer -MODPATH=${0%/*} -MODULE_NAME=targetedfix -MODULE_PATH=/data/adb/modules/$MODULE_NAME -UPDATE_PATH=/data/adb/modules_update/$MODULE_NAME +# 1. Setup Variables +# CRITICAL: Do NOT define MODPATH manually. Trust the Manager. +MODID=targetedfix +LIVE_PATH="/data/adb/modules/$MODID" -ui_print "-> Installing $MODULE_NAME..." +ui_print "- Installing TargetedFix..." -# If old install exists = update/reinstall -if [ -d "$MODULE_PATH/config" ]; then - ui_print "-> Backing up user configs..." - mkdir -p "$UPDATE_PATH/config" - - for f in "$MODULE_PATH/config/"*; do - [ -s "$f" ] && cp -af "$f" "$UPDATE_PATH/config/" - done 2>/dev/null +# 2. CONFIG RESTORATION +# Check if config folder exists AND is not empty +if [ -d "$LIVE_PATH/config" ] && [ "$(ls -A "$LIVE_PATH/config")" ]; then + ui_print "- Preserving user config..." + + # A. Delete the default 'config' folder + rm -rf "$MODPATH/config" + + # B. Copy the user's clean config folder + cp -af "$LIVE_PATH/config" "$MODPATH/" fi -ui_print "-> $MODULE_NAME installation done!" -ui_print "-> Thanks for using this module.🙂" - -exit 0 \ No newline at end of file +ui_print "- Installation Done!" +ui_print "- Thanks for using this module.🙂" diff --git a/module/post-fs-data.sh b/module/post-fs-data.sh deleted file mode 100644 index 9c298025..00000000 --- a/module/post-fs-data.sh +++ /dev/null @@ -1,13 +0,0 @@ -#!/system/bin/sh -# Early boot restore - -MODULE_NAME=targetedfix -MODULE_PATH=/data/adb/modules/$MODULE_NAME -UPDATE_PATH=/data/adb/modules_update/$MODULE_NAME - -mkdir -p "$MODULE_PATH/config" - -# Restore from backup if available -for f in "$UPDATE_PATH/config/"*; do - [ -s "$f" ] && cp -af "$f" "$MODULE_PATH/config/" -done 2>/dev/null \ No newline at end of file diff --git a/module/service.sh b/module/service.sh deleted file mode 100644 index fdb80326..00000000 --- a/module/service.sh +++ /dev/null @@ -1,13 +0,0 @@ -#!/system/bin/sh -# Late boot restore fallback - -MODULE_NAME=targetedfix -MODULE_PATH=/data/adb/modules/$MODULE_NAME -UPDATE_PATH=/data/adb/modules_update/$MODULE_NAME - -sleep 5 -mkdir -p "$MODULE_PATH/config" - -for f in "$UPDATE_PATH/config/"*; do - [ -s "$f" ] && cp -af "$f" "$MODULE_PATH/config/" -done 2>/dev/null \ No newline at end of file