From a6e3bbb4ab26a032ed59ea69bae48e9d396e77fd Mon Sep 17 00:00:00 2001 From: ldaurcvvrk <111478801+ldaurcvvrk@users.noreply.github.com> Date: Sat, 15 Mar 2025 19:56:06 +0800 Subject: [PATCH] Delete template/magisk_module directory --- template/magisk_module/.gitattributes | 9 -- template/magisk_module/CHANGELOG.md | 128 ------------------ .../META-INF/com/google/android/update-binary | 33 ----- .../com/google/android/updater-script | 1 - template/magisk_module/customize.sh | 127 ----------------- template/magisk_module/module.prop | 7 - template/magisk_module/post-fs-data.sh | 71 ---------- .../magisk_module/post-install.example.sh | 41 ------ template/magisk_module/riru.sh | 44 ------ template/magisk_module/rish | 11 -- template/magisk_module/sepolicy.rule | 6 - template/magisk_module/uninstall.sh | 17 --- template/magisk_module/util_functions.sh | 65 --------- template/magisk_module/verify.sh | 39 ------ 14 files changed, 599 deletions(-) delete mode 100644 template/magisk_module/.gitattributes delete mode 100644 template/magisk_module/CHANGELOG.md delete mode 100644 template/magisk_module/META-INF/com/google/android/update-binary delete mode 100644 template/magisk_module/META-INF/com/google/android/updater-script delete mode 100644 template/magisk_module/customize.sh delete mode 100644 template/magisk_module/module.prop delete mode 100644 template/magisk_module/post-fs-data.sh delete mode 100644 template/magisk_module/post-install.example.sh delete mode 100644 template/magisk_module/riru.sh delete mode 100644 template/magisk_module/rish delete mode 100644 template/magisk_module/sepolicy.rule delete mode 100644 template/magisk_module/uninstall.sh delete mode 100644 template/magisk_module/util_functions.sh delete mode 100644 template/magisk_module/verify.sh diff --git a/template/magisk_module/.gitattributes b/template/magisk_module/.gitattributes deleted file mode 100644 index 1643c10a..00000000 --- a/template/magisk_module/.gitattributes +++ /dev/null @@ -1,9 +0,0 @@ -# Declare files that will always have LF line endings on checkout. -META-INF/** text eol=lf -*.prop text eol=lf -*.sh text eol=lf -*.md text eol=lf -sepolicy.rule text eol=lf - -# Denote all files that are truly binary and should not be modified. -lib/** binary \ No newline at end of file diff --git a/template/magisk_module/CHANGELOG.md b/template/magisk_module/CHANGELOG.md deleted file mode 100644 index 04cdbc67..00000000 --- a/template/magisk_module/CHANGELOG.md +++ /dev/null @@ -1,128 +0,0 @@ -# Changelog - -### v13.5.1 (2023-09-19) - -- Works on Android 14 -- Works on ColorOS (OPPO & OnePlus) Android 14 - -### v13.0.1 (2023-02-01) - -- Fix authentication error of `transactRemote` with `IBinder.FLAG_ONEWAY` -- Fix `rish` does not work on Android 8.x - -### v12.7.1 (2022-10-06) - -- Don't set `java.library.path` in rish (#38) -- Fix `peekUserService` not work after app process restarts -- Fix UserServices are not killed after permission is revoked -- Fix UserServices are not killed after the app is uninstalled -- Wrap hidden methods of `Instrumentation` (#41) - -### v12.6.3 (2022-06-09) - -* Works on Android 13 Beta 3 - -### v12.6.2 (2022-04-10) - -* Temporary solution for [#35](https://github.com/RikkaApps/Sui/issues/35) -* Add `updateJson`, module now can be upgraded through Magisk app - -### v12.6.1 (2022-02-23) - -* Works on Android 13 DP1 (Apps use Sui/Shizuku may need changes also) -* Create `/data/adb/sui` on start (Swithing from Riru version to zygisk version will delete this folder, causing config unable to save) - -### v12.4.0 (2022-01-09) - -- Adapt recent Magisk (Zygisk) changes -- Remove the shortcut (shows when you long-press Settings) on uninstall (The shortcut that has already added to the launcher still needs manual removal) - -### v12.3.0 - -- Zygisk support - -### v12.2.1 (2021-09-20) - -- Fix "adb install" under "adb root" -- Fix "adb root" support is not enabled for Android 11 - -### v12.2.0 (2021-09-11) - -- Add adb root support (disabled by default, see description at [GitHub release](https://github.com/RikkaApps/Sui/releases)) -- Fix using UserService will crash sui service on some devices - -### v12.1.4 (2021-08-28) - -- Make sure original extras from newActivity is not deserialized (For example, this will fix the crash of MIUI Settings "All specs" page) - -### v12.1.3 (2021-08-26) - -- Fix not working on Sony devices (Not sure if only China version ROMs have this problem) - -### v12.1.2 (2021-08-26) - -- Bug fix - -### v12.1.1 (2021-08-25) - -- Don't compile with R8 full mode - -### v12.1.0 (2021-08-25) - -- [Shizuku API 12](https://github.com/RikkaApps/Shizuku-API/releases/tag/12) -- Add interactive shell support (`post-install.sh` needs changes, see new `post-install.example.sh` for more) -- (Android 8.0+) Long press system settings from the home app, you will find the shortcut of Sui -- (Android 8.0+) Enter "Developer options" in system settings, the system will ask you to add the shortcut of Sui -- Use "the standard Android way" to create UI, the file size increases but a lot more things can achieve - -### v11.5.0 (2021-03-02) - -- Provide an experimental tool that can run commands, this tool can be used in terminal apps and adb shell (see README for more) -- Filter out packages without components -- Filter out nonexistent packages added by `MATCH_UNINSTALLED_PACKAGES` flag - -> What's the meaning of the command-line tool? There is already "su" from Magisk. -> -> This does helped me to investigate [a bug of Magisk](https://github.com/topjohnwu/Magisk/issues/3976) that happens rarely. At that time, Magisk's su is not available. - -### v11.4.5 (2021-02-21) - -- Fix random authorization dialog or management ui not showing - -### v11.4.4 (2021-02-19) - -- Fix developer options crash on Android 12 -- Works on devices that have dropped 32-bit support (Android 12 emulator or devices in the future) - -### v11.4.3 (2021-02-14) - -- Fix installation on x86 - -### v11.4.2 (2021-02-11) - -- Reduce the file size - -### v11.4.1 (2021-02-07) - -- Fix an undefined behavior -- Skip packages with no code - -### v11.4 (2021-01-26) - -- Avoid a possible race condition - -### v11.3 (2021-01-19) - -- Open management UI trough a notification, this notification will show when you are in "Developer options" - -### v11.2 (2021-01-18) - -- Management UI works more like an `Activity` rather than a window - -### v11.1 (2021-01-16) - -- Fix permission for multi-process applications - -### v11.0 (2021-01-16) - -- First public version diff --git a/template/magisk_module/META-INF/com/google/android/update-binary b/template/magisk_module/META-INF/com/google/android/update-binary deleted file mode 100644 index 28b48e58..00000000 --- a/template/magisk_module/META-INF/com/google/android/update-binary +++ /dev/null @@ -1,33 +0,0 @@ -#!/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/template/magisk_module/META-INF/com/google/android/updater-script b/template/magisk_module/META-INF/com/google/android/updater-script deleted file mode 100644 index 11d5c96e..00000000 --- a/template/magisk_module/META-INF/com/google/android/updater-script +++ /dev/null @@ -1 +0,0 @@ -#MAGISK diff --git a/template/magisk_module/customize.sh b/template/magisk_module/customize.sh deleted file mode 100644 index be1882b4..00000000 --- a/template/magisk_module/customize.sh +++ /dev/null @@ -1,127 +0,0 @@ -SKIPUNZIP=1 - -# Extract verify.sh -ui_print "- Extracting verify.sh" -unzip -o "$ZIPFILE" 'verify.sh' -d "$TMPDIR" >&2 -if [ ! -f "$TMPDIR/verify.sh" ]; then - ui_print "*********************************************************" - ui_print "! Unable to extract verify.sh!" - ui_print "! This zip may be corrupted, please try downloading again" - abort "*********************************************************" -fi -. $TMPDIR/verify.sh - -# Extract util_functions.sh -ui_print "- Extracting util_functions.sh" -extract "$ZIPFILE" 'util_functions.sh' "$TMPDIR" -. $TMPDIR/util_functions.sh - -######################################################### - -FLAVOR=@FLAVOR@ -ROOT_PATH="/data/adb/sui" - -enforce_install_from_magisk_app -check_magisk_version -check_android_version -check_arch - -mkdir $ROOT_PATH -set_perm "$ROOT_PATH" 0 0 0600 - -# Extract libs -ui_print "- Extracting module files" - -extract "$ZIPFILE" 'module.prop' "$MODPATH" -extract "$ZIPFILE" 'post-fs-data.sh' "$MODPATH" -extract "$ZIPFILE" 'uninstall.sh' "$MODPATH" -extract "$ZIPFILE" 'sepolicy.rule' "$MODPATH" - -if [ "$FLAVOR" == "zygisk" ]; then - mkdir "$MODPATH/zygisk" - - extract "$ZIPFILE" "lib/$ARCH_NAME/libsui.so" "$MODPATH/zygisk" true - mv "$MODPATH/zygisk/libsui.so" "$MODPATH/zygisk/$ARCH_NAME.so" - - if [ "$IS64BIT" = true ]; then - extract "$ZIPFILE" "lib/$ARCH_NAME_SECONDARY/libsui.so" "$MODPATH/zygisk" true - mv "$MODPATH/zygisk/libsui.so" "$MODPATH/zygisk/$ARCH_NAME_SECONDARY.so" - fi -elif [ "$FLAVOR" == "riru" ]; then - extract "$ZIPFILE" 'riru.sh' "$TMPDIR" - . $TMPDIR/riru.sh - - mkdir "$MODPATH/riru" - mkdir "$MODPATH/riru/lib" - - if [ "$IS64BIT" = true ]; then - mkdir "$MODPATH/riru/lib64" - fi - - extract "$ZIPFILE" "lib/$ARCH_NAME/lib$RIRU_MODULE_LIB_NAME.so" "$MODPATH/riru/$ARCH_DIR" true - - if [ "$IS64BIT" = true ]; then - extract "$ZIPFILE" "lib/$ARCH_NAME_SECONDARY/lib$RIRU_MODULE_LIB_NAME.so" "$MODPATH/riru/$ARCH_DIR_SECONDARY" true - fi -fi - -mkdir "$MODPATH/bin" -mkdir "$MODPATH/lib" -extract "$ZIPFILE" "lib/$ARCH_NAME/libmain.so" "$MODPATH/bin" true -extract "$ZIPFILE" "lib/$ARCH_NAME/librish.so" "$MODPATH" true -extract "$ZIPFILE" "lib/$ARCH_NAME/libadbd_wrapper.so" "$MODPATH/bin" true -extract "$ZIPFILE" "lib/$ARCH_NAME/libadbd_preload.so" "$MODPATH/lib" true - -mv "$MODPATH/bin/libmain.so" "$MODPATH/bin/sui" -mv "$MODPATH/bin/libadbd_wrapper.so" "$MODPATH/bin/adbd_wrapper" - -set_perm_recursive "$MODPATH" 0 0 0755 0644 - -extract "$ZIPFILE" 'sui.dex' "$MODPATH" -extract "$ZIPFILE" 'sui.apk' "$MODPATH" - -set_perm "$MODPATH/sui.dex" 0 0 0600 -set_perm "$MODPATH/sui.apk" 0 0 0655 -set_perm_recursive "$MODPATH/res" 0 0 0700 0600 - -ui_print "- Fetching information for SystemUI and Settings" -/system/bin/app_process -Djava.class.path="$MODPATH"/sui.dex /system/bin --nice-name=sui_installer rikka.sui.installer.Installer "$MODPATH" - -ui_print "- Extracting files for rish" -extract "$ZIPFILE" 'rish' "$MODPATH" -extract "$ZIPFILE" 'post-install.example.sh' "$ROOT_PATH" -set_perm "$MODPATH/rish" 0 2000 0770 -set_perm "$ROOT_PATH/post-install.example.sh" 0 0 0600 - -if [ -f $ROOT_PATH/post-install.sh ]; then - cat "$ROOT_PATH/post-install.sh" | grep -q "SCRIPT_VERSION=2" - if [ "$?" -eq 0 ]; then - RISH_DEX=$MODPATH/sui.dex - RISH_LIB=$MODPATH/librish.so - RISH_SCRIPT=$MODPATH/rish - ui_print "- Run /data/adb/sui/post-install.sh" - source $ROOT_PATH/post-install.sh - else - ui_print "! To use new interactive shell tool (rish), post-install.sh needs update" - ui_print "! Please check post-install.example.sh for more" - fi -else - ui_print "- Cannot find /data/adb/sui/post-install.sh" -fi - -# Remove unused files -ui_print "- Removing old files" -rm -rf /data/adb/sui/res -rm -rf /data/adb/sui/res.new -rm -f /data/adb/sui/z -rm -f /data/adb/sui/com.android.systemui -rm -f /data/adb/sui/starter -rm -f /data/adb/sui/sui.dex -rm -f /data/adb/sui/sui.dex.new -rm -f /data/adb/sui/sui_wrapper - -if [ "$(grep_prop ro.maple.enable)" == "1" ] && [ "$FLAVOR" == "zygisk" ]; then - ui_print "- Add ro.maple.enable=0" - touch "$MODPATH/system.prop" - echo "ro.maple.enable=0" >> "$MODPATH/system.prop" -fi diff --git a/template/magisk_module/module.prop b/template/magisk_module/module.prop deleted file mode 100644 index c39eea3f..00000000 --- a/template/magisk_module/module.prop +++ /dev/null @@ -1,7 +0,0 @@ -id=${id} -name=${name} -version=${version} -versionCode=${versionCode} -author=${author} -description=${description} -updateJson=${updateJson} diff --git a/template/magisk_module/post-fs-data.sh b/template/magisk_module/post-fs-data.sh deleted file mode 100644 index 5408a5c7..00000000 --- a/template/magisk_module/post-fs-data.sh +++ /dev/null @@ -1,71 +0,0 @@ -#!/system/bin/sh -MODDIR=${0%/*} -MODULE_ID=$(basename "$MODDIR") -FLAVOR=@FLAVOR@ - -if [ "$ZYGISK_ENABLED" = false ] && [ "$FLAVOR" = "zygisk" ]; then - log -p w -t "Sui" "Zygisk is disabled, skip zygisk-flavor script" - exit 1 -fi - -if [ "$ZYGISK_ENABLED" = true ] && [ "$FLAVOR" = "riru" ]; then - log -p w -t "Sui" "Zygisk is enabled, skip riru-flavor script" - exit 1 -fi - -MAGISK_VER_CODE=$(magisk -V) -if [ "$MAGISK_VER_CODE" -ge 21000 ]; then - MAGISK_PATH="$(magisk --path)/.magisk/modules/$MODULE_ID" -else - MAGISK_PATH=/sbin/.magisk/modules/$MODULE_ID -fi - -log -p i -t "Sui" "Magisk version $MAGISK_VER_CODE" -log -p i -t "Sui" "Magisk module path $MAGISK_PATH" - -enable_once="/data/adb/sui/enable_adb_root_once" -enable_forever="/data/adb/sui/enable_adb_root" -adb_root_exit=0 - -if [ -f $enable_once ]; then - log -p i -t "Sui" "adb root support is enabled for this time of boot" - rm $enable_once - enable_adb_root=true -fi - -if [ -f $enable_forever ]; then - log -p i -t "Sui" "adb root support is enabled forever" - enable_adb_root=true -fi - -if [ "$enable_adb_root" = true ]; then - log -p i -t "Sui" "Setup adb root support" - - # Run magiskpolicy manually if Magisk does not load sepolicy.rule - if [ ! -e "$(magisk --path)/.magisk/mirror/sepolicy.rules/$MODULE_ID/sepolicy.rule" ]; then - log -p e -t "Sui" "Magisk does not load sepolicy.rule..." - log -p e -t "Sui" "Exec magiskpolicy --live --apply $MAGISK_PATH/sepolicy.rule..." - magiskpolicy --live --apply "$MAGISK_PATH"/sepolicy.rule - log -p i -t "Sui" "Apply finished" - else - log -p i -t "Sui" "Magisk should have loaded sepolicy.rule correctly" - fi - - # Setup adb root support - rm "$MODDIR/bin/adb_root" - ln -s "$MODDIR/bin/sui" "$MODDIR/bin/adb_root" - chmod 700 "$MODDIR/bin/adb_root" - "$MODDIR/bin/adb_root" "$MAGISK_PATH" - adb_root_exit=$? - log -p i -t "Sui" "Exited with $adb_root_exit" -else - log -p i -t "Sui" "adb root support is disabled" -fi - -# Setup uninstaller -rm "$MODDIR/bin/uninstall" -ln -s "$MODDIR/bin/sui" "$MODDIR/bin/uninstall" - -# Run Sui server -chmod 700 "$MODDIR"/bin/sui -exec "$MODDIR"/bin/sui "$MODDIR" "$adb_root_exit" diff --git a/template/magisk_module/post-install.example.sh b/template/magisk_module/post-install.example.sh deleted file mode 100644 index b7b4a9dd..00000000 --- a/template/magisk_module/post-install.example.sh +++ /dev/null @@ -1,41 +0,0 @@ -# This script will be loaded during the installation process of Sui. -# -# It's designed to automatically copy rish. -# rish is an Android program for interacting with a shell that runs on a high-privileged daemon process (Sui server). -# -# Rename this file to /data/adb/sui/post-install.sh to allow this script to be loaded. - -# This line is required. -SCRIPT_VERSION=2 - -# Variables: -# $RISH_DEX: the path to the dex of rish -# $RISH_LIB: the path to the native library of rish -# $RISH_SCRIPT: the path to the wrapper script to start rish - -copy_rish() { - APP_APPLICATION_ID=$1 - APP_UID=$2 - DEX_TARGET=$3/$4.dex - LIB_TARGET=$3/librish.so - SCRIPT_TARGET=$3/$4 - - cp "$RISH_DEX" "$DEX_TARGET" - cp "$RISH_LIB" "$LIB_TARGET" - cp "$RISH_SCRIPT" "$SCRIPT_TARGET" - chmod 600 "$DEX_TARGET" "$LIB_TARGET" - chmod 700 "$SCRIPT_TARGET" - chown "$APP_UID":"$APP_UID" "$DEX_TARGET" "$LIB_TARGET" "$SCRIPT_TARGET" - sed -i "s/%%%RISH_APPLICATION_ID%%%/$APP_APPLICATION_ID/g" "$SCRIPT_TARGET" -} - -# Example: copy rish to /data/local/tmp (for adb) -# -#ui_print "- Copy rish to /data/local/tmp" -#copy_rish com.android.shell 2000 /data/local/tmp rish # Since every app can check if a specific file exists in /data/local/tmp, it's recommended to change the last parameter "rish" to something else - -# Example: copy rish to Termux -# -#ui_print "- Copy rish to Termux" -#APP_UID=$(stat -c '%u' /data/user/0/com.termux) -#copy_rish com.termux $APP_UID /data/user/0/com.termux/files/home rish diff --git a/template/magisk_module/riru.sh b/template/magisk_module/riru.sh deleted file mode 100644 index c3152c5b..00000000 --- a/template/magisk_module/riru.sh +++ /dev/null @@ -1,44 +0,0 @@ -#!/sbin/sh -RIRU_MODULE_LIB_NAME="@RIRU_MODULE_LIB_NAME@" - -# Variables for customize.sh -RIRU_API=0 -RIRU_MIN_COMPATIBLE_API=0 -RIRU_VERSION_CODE=0 -RIRU_VERSION_NAME="" - -# Used by util_functions.sh -RIRU_MODULE_API_VERSION=@RIRU_MODULE_API_VERSION@ -RIRU_MODULE_MIN_API_VERSION=@RIRU_MODULE_MIN_API_VERSION@ -RIRU_MODULE_MIN_RIRU_VERSION_NAME="@RIRU_MODULE_MIN_RIRU_VERSION_NAME@" - -if [ "$MAGISK_VER_CODE" -ge 21000 ]; then - MAGISK_CURRENT_RIRU_MODULE_PATH=$(magisk --path)/.magisk/modules/riru-core -else - MAGISK_CURRENT_RIRU_MODULE_PATH=/sbin/.magisk/modules/riru-core -fi - -if [ ! -d $MAGISK_CURRENT_RIRU_MODULE_PATH ]; then - ui_print "*********************************************************" - ui_print "! Riru is not installed" - ui_print "! Please install Riru from Magisk Manager or https://github.com/RikkaApps/Riru/releases" - abort "*********************************************************" -fi - -if [ -f "$MAGISK_CURRENT_RIRU_MODULE_PATH/disable" ] || [ -f "$MAGISK_CURRENT_RIRU_MODULE_PATH/remove" ]; then - ui_print "*********************************************************" - ui_print "! Riru is not enabled or will be removed" - ui_print "! Please enable Riru in Magisk first" - abort "*********************************************************" -fi - -if [ -f $MAGISK_CURRENT_RIRU_MODULE_PATH/util_functions.sh ]; then - ui_print "- Load $MAGISK_CURRENT_RIRU_MODULE_PATH/util_functions.sh" - # shellcheck disable=SC1090 - . $MAGISK_CURRENT_RIRU_MODULE_PATH/util_functions.sh -else - ui_print "*********************************************************" - ui_print "! Riru $RIRU_MODULE_MIN_RIRU_VERSION_NAME or above is required" - ui_print "! Please upgrade Riru from Magisk Manager or https://github.com/RikkaApps/Riru/releases" - abort "*********************************************************" -fi diff --git a/template/magisk_module/rish b/template/magisk_module/rish deleted file mode 100644 index 8eb15eae..00000000 --- a/template/magisk_module/rish +++ /dev/null @@ -1,11 +0,0 @@ -#!/system/bin/sh -BASEDIR=$(dirname "$0") -DEX="$BASEDIR"/rish.dex - -if [ ! -f "$DEX" ]; then - echo "Cannot find $DEX, please check post-install.sh" - exit 1 -fi - -[ -z "$RISH_APPLICATION_ID" ] && export RISH_APPLICATION_ID="%%%RISH_APPLICATION_ID%%%" -/system/bin/app_process -Djava.class.path="$DEX" -Dsui.library.path="$BASEDIR" /system/bin --nice-name=rish rikka.sui.shell.Shell "$@" diff --git a/template/magisk_module/sepolicy.rule b/template/magisk_module/sepolicy.rule deleted file mode 100644 index 0c78ecdc..00000000 --- a/template/magisk_module/sepolicy.rule +++ /dev/null @@ -1,6 +0,0 @@ -# Allow adbd to transition to magisk:s0 context -allow adbd adbd process setcurrent -allow adbd magisk process dyntransition - -# Fix "adb install" under "adb root" -allow system_server magisk unix_stream_socket { getopt getattr read write } diff --git a/template/magisk_module/uninstall.sh b/template/magisk_module/uninstall.sh deleted file mode 100644 index 0c888d21..00000000 --- a/template/magisk_module/uninstall.sh +++ /dev/null @@ -1,17 +0,0 @@ -#!/sbin/sh -MODDIR=${0%/*} -MODULES=$(dirname "$MODDIR") - -uninstall() { - chmod 700 "$MODDIR"/bin/uninstall - "$MODDIR"/bin/uninstall "$MODDIR" - rm -rf "/data/adb/sui" -} - -if [ -d "$MODULES/riru_sui" ] && [ -d "$MODULES/zygisk_sui" ]; then - if [ -f "$MODULES/riru_sui/remove" ] && [ -f "$MODULES/zygisk_sui/remove" ]; then - uninstall - fi -else - uninstall -fi diff --git a/template/magisk_module/util_functions.sh b/template/magisk_module/util_functions.sh deleted file mode 100644 index 9ba845f9..00000000 --- a/template/magisk_module/util_functions.sh +++ /dev/null @@ -1,65 +0,0 @@ -if [ "$ARCH" = "arm64" ]; then - ARCH_NAME="arm64-v8a" - ARCH_NAME_SECONDARY="armeabi-v7a" - ARCH_DIR="lib64" - ARCH_DIR_SECONDARY="lib" -elif [ "$ARCH" = "arm" ]; then - ARCH_NAME="armeabi-v7a" - ARCH_DIR="lib" -elif [ "$ARCH" = "x64" ]; then - ARCH_NAME="x86_64" - ARCH_NAME_SECONDARY="x86" - ARCH_DIR="lib64" - ARCH_DIR_SECONDARY="lib" -elif [ "$ARCH" = "x86" ]; then - ARCH_NAME="x86" - ARCH_DIR="lib" -fi - -enforce_install_from_magisk_app() { - if [ ! "$BOOTMODE" ]; then - ui_print "*********************************************************" - ui_print "! Install from recovery is NOT supported" - ui_print "! Some recovery has broken implementations, install with such recovery will finally cause Riru or Riru modules not working" - ui_print "! Please install from Magisk app" - abort "*********************************************************" - fi -} - -check_arch() { - if [ -z $ARCH_NAME ]; then - abort "! Unsupported platform: $ARCH" - else - ui_print "- Device platform: $ARCH" - fi -} - -check_android_version() { - if [ "$API" -ge 23 ]; then - ui_print "- Android SDK version: $API" - else - ui_print "*********************************************************" - ui_print "! Requires Android 6.0 (API 23) or above" - abort "*********************************************************" - fi -} - -check_magisk_version() { - ui_print "- Magisk version: $MAGISK_VER ($MAGISK_VER_CODE)" - - if [ "$FLAVOR" == "riru" ]; then - ui_print "- Installing Sui (Riru version)" - elif [ "$FLAVOR" == "zygisk" ]; then - ui_print "- Installing Sui (Zygisk version)" - - if [ "$MAGISK_VER_CODE" -lt 23016 ]; then - ui_print "*********************************************************" - ui_print "! Zygisk requires Magisk 23016+" - abort "*********************************************************" - fi - else - ui_print "*********************************************************" - ui_print "! Unsupported flavor $FLAVOR" - abort "*********************************************************" - fi -} diff --git a/template/magisk_module/verify.sh b/template/magisk_module/verify.sh deleted file mode 100644 index fc706b6f..00000000 --- a/template/magisk_module/verify.sh +++ /dev/null @@ -1,39 +0,0 @@ -TMPDIR_FOR_VERIFY="$TMPDIR/.vunzip" -mkdir "$TMPDIR_FOR_VERIFY" - -abort_verify() { - ui_print "*********************************************************" - ui_print "! $1" - ui_print "! This zip may be corrupted, please try downloading again" - abort "*********************************************************" -} - -# extract -extract() { - zip=$1 - file=$2 - dir=$3 - junk_paths=$4 - [ -z "$junk_paths" ] && junk_paths=false - opts="-o" - [ $junk_paths = true ] && opts="-oj" - - file_path="" - hash_path="" - if [ $junk_paths = true ]; then - file_path="$dir/$(basename "$file")" - hash_path="$TMPDIR_FOR_VERIFY/$(basename "$file").sha256sum" - else - file_path="$dir/$file" - hash_path="$TMPDIR_FOR_VERIFY/$file.sha256sum" - fi - - unzip $opts "$zip" "$file" -d "$dir" >&2 - [ -f "$file_path" ] || abort_verify "$file not exists" - - unzip $opts "$zip" "$file.sha256sum" -d "$TMPDIR_FOR_VERIFY" >&2 - [ -f "$hash_path" ] || abort_verify "$file.sha256sum not exists" - - (echo "$(cat "$hash_path") $file_path" | sha256sum -c -s -) || abort_verify "Failed to verify $file" - ui_print "- Verified $file" >&1 -}