From 565bbeb75fa0de64b8d9a9581be4941dc87c791b Mon Sep 17 00:00:00 2001 From: KOWX712 Date: Wed, 16 Oct 2024 05:03:20 +0800 Subject: [PATCH] Initial --- README.md | 52 ++++------ changelog.md | 95 +++---------------- .../META-INF/com/google/android/update-binary | 33 +++++++ .../com/google/android/updater-script | 1 + module/action.sh | 9 ++ module/common/.keybox | 1 + module/common/ADDITION | 9 ++ module/common/EXCLUDE | 9 ++ module/common/UpdateTargetList.sh | 58 +++++++++++ module/common/system.prop | 3 + module/customize.sh | 91 ++++++++++++++++++ module/module.prop | 7 ++ module/service.sh | 18 ++++ module/uninstall.sh | 9 ++ update.json | 8 +- 15 files changed, 280 insertions(+), 123 deletions(-) create mode 100644 module/META-INF/com/google/android/update-binary create mode 100644 module/META-INF/com/google/android/updater-script create mode 100644 module/action.sh create mode 100644 module/common/.keybox create mode 100644 module/common/ADDITION create mode 100644 module/common/EXCLUDE create mode 100644 module/common/UpdateTargetList.sh create mode 100644 module/common/system.prop create mode 100644 module/customize.sh create mode 100644 module/module.prop create mode 100644 module/service.sh create mode 100644 module/uninstall.sh diff --git a/README.md b/README.md index 257093a..921fdbf 100755 --- a/README.md +++ b/README.md @@ -1,40 +1,20 @@ -

Magisk Module Template Extended (MMT-Ex)

+# **Tricky Addon: Update Target List** -
- - Version - - _time_stamp_ - - _time_stamp_ - - _time_stamp_
+## Description +- Automated script to update tricky store target list. +- Custom config: ADDITION and EXCLUDE in /data/adb/tricky_store/target_list_config -
- MMT Extended is the spiritual successor of Unity and makes magisk module creation easy. Instructions in the -

Wiki

Also supports KSU

-
+## Requirements +- Tricky store module installed -
-

- - Source Code - - | - - Addons Repository - - | - - XDA - -

-
+## Instructions +- Module will update taget list on every boot. -### Usage -- [Follow the directions here (DO NOT FORK)](https://help.github.com/en/github/creating-cloning-and-archiving-repositories/creating-a-repository-from-a-template) -- Then follow instructions in [Wiki](https://github.com/Zackptg5/MMT-Extended/wiki) +- Action button method +If action button feature is available, use action button can update tricky store target list. + +- Manual script method +If action button feature isn't avaliable, you can run UpdateTargetList.sh under /data/adb/tricky_store/ manually. + +## Links +[Telegram channel](https://t.me/kowchannel) diff --git a/changelog.md b/changelog.md index 8469040..2ce9411 100755 --- a/changelog.md +++ b/changelog.md @@ -1,86 +1,15 @@ -### v3.7 - 4.24.2024 -* Magisk v27 fix +### Tricky Addon: Update Target List +Automated script to update tricky store target.txt +Requirement: Tricky Store module installed +Telegram channel: https://t.me/kowchannel -### v3.6 - 2.16.2024 -* Update magisk delta support (now called kitsune) -* Add support for APatch -* Add support for magisk atomic mounting (in theory) +## Changelog +### v1.2 +- Automated update target list on every boot +- Initial release -### v3.5 - 9.11.2023 -* Define SERVICED, POSTFSDATAD, and SYSTEM_ROOT if not already defined - were removed or renamed in magisk 26.2 and 26.3 for no good reason :/ +### v1.1 +- Add exclution and addition list config, config directory: /data/adb/tricky_store/target_list_config (No release) -### v3.4 - 9.3.2023 -* Bug fix for boot-completed scripts - -### v3.3 - 8.13.2023 -* Updates for KSU - * min ksu version now v0.6.6 - * added support for boot-completed scripts - -### v3.2 - 8.11.2023 -* Bug fixes for custom partitions - -### v3.1 - 7.25.2023 -* Add override for extra partitions in event you have workaround for support for regular magisk installs - -### v3.0 - 7.10.2023 -* Add support for KSU modules -* Add support for magisk delta -* Add support for other partitions - note that you need magisk delta or ksu installed to use these -* Make debug default behavior, remove flag -* Fix uninstall script so it'll clean up files outside of module folder if user manually deletes module folder - -### v2.1 - 5.24.2023 -* Update variables for magisk 26 - -### v2.0 - 1.29.2022 -* Update for magisk 24 - * Added zygisk module support -* Misc fixes - -### v1.8 - 11.21.2021 -* Fix for magisk canary -* Minimum magisk version now 20.4 - -### v1.7 - 9.9.2021 -* Small fix for magisk canary - -### v1.6 - 9.12.2020 -* Updates for latest magisk - minmagisk is 20 now -* Added back ro.build.product to device_check for older roms -* Moved credits so it'll work with latest magisk mod template - -### v1.5 - 3.27.2020 -* Have debug log be part of regular log, remove superfluous stuff, module dev can just add what they want -* Removed addon runtime confusion - all scripts are install.sh now -* Added manufacturer option to device_check -* Fixes for Magisk 20.4 - -### v1.4 - 2.20.2020 -* Add more vendor perms -* Fixed uninstall.sh script install behavior - it'll install if there's files outside of modpath or if there's custom logic at the top of it -* Misc bug fixes - -### v1.3 - 1.22.2020 -* Move debug log to same location as magisk log - Download folder -* Add proper chcon for vendor files - fixes various issues with audioflinger and maybe more with android Q -* Remove empty folders after moving files for DYNLIB -* Fix api check bug - -### v1.2 - 1.17.2020 -* Fixed bug in debug log -* Fixed DYNLIB so it won't move empty files (replacements) to vendor -* Magisk manager only installs now - will automatically remove module if flashed in recovery -* Removed extra crap that was needed for recovery installs -* Removed common/uninstall and upgrade scripts, no need for them anymore -* Removed mount_part function - no need for it now since recovery is no longer supported - just remount partition as rw -* More in line with regular magisk module template now - flashing zip always installs/upgrades mod. To uninstall, use magisk manager - -### v1.1 - 1.11.2020 -* No longer use .core - it'll be deprecated soon -* Fix for uninstall -* Fix bug in debug function during uninstalls -* Misc fixes - -### v1.0 - 1.4.2020 -* Initial release \ No newline at end of file +### v1.0 +- Initial version (No release) diff --git a/module/META-INF/com/google/android/update-binary b/module/META-INF/com/google/android/update-binary new file mode 100644 index 0000000..ab207ac --- /dev/null +++ b/module/META-INF/com/google/android/update-binary @@ -0,0 +1,33 @@ +#!/sbin/sh + +################# +# Initialization +################# + +umask 022 + +# echo before loading util_functions +ui_print() { echo "$1"; } + +require_new_magisk() { + ui_print "*******************************" + ui_print " Please install Magisk v20.4+! " + ui_print "*******************************" + exit 1 +} + +######################### +# Load util_functions.sh +######################### + +OUTFD=$2 +ZIPFILE=$3 + +mount /data 2>/dev/null + +[ -f /data/adb/magisk/util_functions.sh ] || require_new_magisk +. /data/adb/magisk/util_functions.sh +[ $MAGISK_VER_CODE -lt 20400 ] && require_new_magisk + +install_module +exit 0 diff --git a/module/META-INF/com/google/android/updater-script b/module/META-INF/com/google/android/updater-script new file mode 100644 index 0000000..f225797 --- /dev/null +++ b/module/META-INF/com/google/android/updater-script @@ -0,0 +1 @@ +#MAGISK diff --git a/module/action.sh b/module/action.sh new file mode 100644 index 0000000..72fbccb --- /dev/null +++ b/module/action.sh @@ -0,0 +1,9 @@ +MODDIR=${0%/*} +echo "**********************************************" +echo "- Staring script..." +echo " " + +sh "$MODDIR"/common/UpdateTargetList.sh || true + +echo "**********************************************" +echo "\(__All set!__)/" \ No newline at end of file diff --git a/module/common/.keybox b/module/common/.keybox new file mode 100644 index 0000000..a0c2040 --- /dev/null +++ b/module/common/.keybox @@ -0,0 +1 @@ +nothing here \ No newline at end of file diff --git a/module/common/ADDITION b/module/common/ADDITION new file mode 100644 index 0000000..20bb98e --- /dev/null +++ b/module/common/ADDITION @@ -0,0 +1,9 @@ +# This is the list of additional apps to include in the target file +# DO NOT remove the default app here +# You can add your custom addition app's package name here +# Each app package name should be on a new line + +com.google.android.gms +io.github.vvb2060.keyattestation +io.github.vvb2060.mahoshojo +icu.nullptr.nativetest \ No newline at end of file diff --git a/module/common/EXCLUDE b/module/common/EXCLUDE new file mode 100644 index 0000000..3261968 --- /dev/null +++ b/module/common/EXCLUDE @@ -0,0 +1,9 @@ +# This is the list of apps to exclude from the target file +# DO NOT remove the default app here +# You can add your custom exclusion app here +# Each app package name should be on a new line + +oneplus +coloros +com.android.patch +me.bmax.apatch \ No newline at end of file diff --git a/module/common/UpdateTargetList.sh b/module/common/UpdateTargetList.sh new file mode 100644 index 0000000..3d35b6a --- /dev/null +++ b/module/common/UpdateTargetList.sh @@ -0,0 +1,58 @@ +#!/bin/sh + +# by KOW, telegram channel: https://t.me/kowchannel + +# This script will put all non-system app into /data/adb/tricky_store/target.txt +# 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. + +# Define the mod path +MODDIR="/data/adb/tricky_store/target_list_config" + +# Config file check +echo "- Checking config files..." +echo " " +if [ ! -f "$MODDIR/EXCLUDE" ]; then + echo "! Exclude list is missing!" + exit 1 +else + echo "- Exclude config file found." + echo " " +fi +if [ ! -f "$MODDIR/ADDITION" ]; then + echo "! Addition list is missing" + exit 1 +else + echo "- Addition config file found." + echo " " +fi + +# Read exclution and addition config +EXCLUDE=$(grep -vE '^#|^$' "$MODDIR/EXCLUDE" | tr '\n' '|' | sed 's/|$//') +ADDITIONS=$(grep -vE '^#|^$' "$MODDIR/ADDITION") + +# Create or overwrite the target.txt file +echo "- Overwritting target.txt" +echo " " +su -c > /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 $ADDITIONS; do + if ! grep -qx "$app" /data/adb/tricky_store/target.txt; then + echo "$app" >> /data/adb/tricky_store/target.txt + fi +done + +# Force stop gms. Not necessary, you can add it if you want +#su -c killall com.google.android.gms +#su -c killall com.google.android.gms.unstable + +echo "- target.txt updated successfully" +echo " " \ No newline at end of file diff --git a/module/common/system.prop b/module/common/system.prop new file mode 100644 index 0000000..9eb4d4b --- /dev/null +++ b/module/common/system.prop @@ -0,0 +1,3 @@ +# To pass Minotaur native test Conventional Test (8), you can get your VerifiedBootHash from KeyAttestation app +# Put verifiedBootHash after 'ro.boot.vbmeta.digest=' and remove the '#' infront of it. +#ro.boot.vbmeta.digest= \ No newline at end of file diff --git a/module/customize.sh b/module/customize.sh new file mode 100644 index 0000000..cfd32bf --- /dev/null +++ b/module/customize.sh @@ -0,0 +1,91 @@ +SKIPUNZIP=0 +DEBUG=false +if [ "$(which magisk)" ]; then + BM="Magisk:$MAGISK_VER│$MAGISK_VER_CODE" +elif [ "$KSU" ]; then + BM="KSU:$KSU_KERNEL_VER_CODE│$KSU_VER_CODE" +elif [ "$APATCH" ]; then + BM="APatch:$APATCH_VER│$APATCH_VER_CODE" +else + ui_print " "; + ui_print "! recovery is not supported"; + abort " "; +fi + +print_modname() { + ui_print "*******************************************************" + ui_print "Installing Tricky Addon: Update Target List" + ui_print "Author: KOWX712" + ui_print "*******************************************************" +} + +if [ -d /data/adb/modules/tricky_store ]; then + echo "- Tricky store module installed" +else + echo "! Tricky store module is not installed" + exit 1 +fi + +key_check() { + while true; do + key_check=$(/system/bin/getevent -qlc 1) + key_event=$(echo "$key_check" | awk '{ print $3 }' | grep 'KEY_') + key_status=$(echo "$key_check" | awk '{ print $4 }') + if [[ "$key_event" == *"KEY_"* && "$key_status" == "DOWN" ]]; then + keycheck="$key_event" + break + fi + done + while true; do + key_check=$(/system/bin/getevent -qlc 1) + key_event=$(echo "$key_check" | awk '{ print $3 }' | grep 'KEY_') + key_status=$(echo "$key_check" | awk '{ print $4 }') + if [[ "$key_event" == *"KEY_"* && "$key_status" == "UP" ]]; then + break + fi + done +} + +ui_print "- Installing..." +COMPATH="$MODPATH/common" +CONFIG_DIR="/data/adb/tricky_store/target_list_config" +SCRIPT_DIR="/data/adb/tricky_store" +cp "$MODPATH/module.prop" "$COMPATH/disabled" +sed -i 's/^description=.*/description=Tricky store is disabled/' "$COMPATH/disabled" +cp "$MODPATH/module.prop" "$COMPATH/ninstalled" +sed -i 's/^description=.*/description=Tricky store is not installed/' "$COMPATH/ninstalled" +cp "$MODPATH/module.prop" "$COMPATH/normal" +CONFIG_DIR="/data/adb/tricky_store/target_list_config" +SCRIPT_DIR="/data/adb/tricky_store" +mkdir -p "$CONFIG_DIR" +cp "$COMPATH/UpdateTargetList.sh" "$SCRIPT_DIR/UpdateTargetList.sh" +mv "$COMPATH/EXCLUDE" "$CONFIG_DIR/EXCLUDE" +mv "$COMPATH/ADDITION" "$CONFIG_DIR/ADDITION" + +if [ ! -f "/data/adb/modules/TA_utl/system.prop" ]; then + mv "$COMPATH/system.prop" "$MODPATH/system.prop" +else + rm -f "$COMPATH/system.prop" + mv "/data/adb/modules/TA_utl/system.prop" "$MODPATH/system.prop" +fi + +kb="$COMPATH/.keybox" +ui_print "*********************************************" +ui_print "- Do you want to replace tricky store keybox?" +ui_print " Volume up: YES" +ui_print " Volume up: NO" +ui_print "*********************************************" +key_check +if [[ "$keycheck" == "KEY_VOLUMEUP" ]]; then + ui_print "*********************************************" + ui_print "- Replacing keybox..." + ui_print "*********************************************" + mv "$SCRIPT_DIR/keybox.xml" "$COMPATH/origkeybox" + mv "$kb" "$SCRIPT_DIR/keybox.xml" +else + rm -f "$kb" +fi + +ui_print " " +ui_print "- Installation completed successfully! " +ui_print " " diff --git a/module/module.prop b/module/module.prop new file mode 100644 index 0000000..fc38704 --- /dev/null +++ b/module/module.prop @@ -0,0 +1,7 @@ +id=TA_utl +name=Tricky Addon: Update Target List +version=v1.2 +versionCode=12 +author=KOWX712 +description=Update tricky store target list with action button. Custom config: ADDITION and EXCLUDE in /data/adb/tricky_store/target_list_config +updateJson=https://raw.githubusercontent.com/KOWX712/Tricky-Addon-Update-Target-List/refs/heads/master/update.json \ No newline at end of file diff --git a/module/service.sh b/module/service.sh new file mode 100644 index 0000000..c42e4ba --- /dev/null +++ b/module/service.sh @@ -0,0 +1,18 @@ +MODDIR=${0%/*} +COMPATH="$MODDIR/common" +# Check pm command functionality +sleep 10 +until pm list packages > /dev/null 2>&1; do + sleep 1 +done + +# Check tricky store status +TS="/data/adb/modules/tricky_store" +if [ -f "$TS/disable" ]; then + cat "$COMPATH/disabled" > "$MODDIR/module.prop" +elif [ ! -d "$TS" ]; then + cat "$COMPATH/ninstalled" > "$MODDIR/module.prop" +else + cat "$COMPATH/normal" > "$MODDIR/module.prop" + sh "$MODDIR"/common/UpdateTargetList.sh || true +fi \ No newline at end of file diff --git a/module/uninstall.sh b/module/uninstall.sh new file mode 100644 index 0000000..26fe0e2 --- /dev/null +++ b/module/uninstall.sh @@ -0,0 +1,9 @@ +MODDIR="/data/adb/tricky_store" +# Remove residue and restore original keybox. +MODPATH=${0%/*} +rm -rf "$MODDIR/target_list_config" +rm -f "$MODDIR/UpdateTargetList.sh" +if [ -f "$MODPATH/common/origkeybox" ]; then + rm -f "$MODDIR/keybox.xml" + mv "$MODPATH/common/origkeybox" "$MODDIR/keybox.xml" +fi \ No newline at end of file diff --git a/update.json b/update.json index 69b7f5d..c15a449 100755 --- a/update.json +++ b/update.json @@ -1,6 +1,6 @@ { - "version": "v3.6", - "versionCode": 18, - "zipUrl": "https://raw.githubusercontent.com/Zackptg5/MMT-Extended/install.zip", - "changelog": "https://raw.githubusercontent.com/Zackptg5/MMT-Extended/changelog.md" + "version": "v1.2", + "versionCode": 12, + "zipUrl": "", + "changelog": "https://raw.githubusercontent.com/KOWX712/Tricky-Addon-Update-Target-List/refs/heads/master/changelog.md" } \ No newline at end of file