From a0392483681087cf0c664efa61ea8b82b11c559e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=AC=A8=E8=9B=8Bovo?= Date: Tue, 10 Oct 2023 01:05:25 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=9E=E9=AA=8C=E6=80=A7=E6=94=AF=E6=8C=81?= =?UTF-8?q?=20KernelSU?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Magisk_Module/install_Module_Script.sh | 15 +++++++ .../assets/usr/kr-script/Util_Functions.sh | 42 ++++++------------- 2 files changed, 27 insertions(+), 30 deletions(-) diff --git a/app/src/main/assets/usr/kr-script/Magisk_Module/install_Module_Script.sh b/app/src/main/assets/usr/kr-script/Magisk_Module/install_Module_Script.sh index 19c35eb..79d684f 100644 --- a/app/src/main/assets/usr/kr-script/Magisk_Module/install_Module_Script.sh +++ b/app/src/main/assets/usr/kr-script/Magisk_Module/install_Module_Script.sh @@ -8,6 +8,21 @@ . $Core + +# START:KernelSU +if [[ $Magisk_Type = ksu ]]; then + echo '检测到 KernelSU,执行标准模块安装方式' + echo '注意:目前 KernelSU 为实验性支持,可能存在未知问题' + echo '---' + ZIPFILE="$3" + $Ksud module install "$ZIPFILE" + echo '---' + echo '安装线程退出' + exit 0 +fi +# END:KernelSU + +# Magisk if [[ $1 = -Do_Not_Check ]]; then shift mask diff --git a/app/src/main/assets/usr/kr-script/Util_Functions.sh b/app/src/main/assets/usr/kr-script/Util_Functions.sh index 8e8b223..28e7d97 100644 --- a/app/src/main/assets/usr/kr-script/Util_Functions.sh +++ b/app/src/main/assets/usr/kr-script/Util_Functions.sh @@ -1,14 +1,19 @@ #Custom variable -export Util_Functions_Code=2023082001 +export Util_Functions_Code=2023101001 export SDdir=/data/media/0 export Magisk=`$which magisk` +export Ksud=`$which ksud` export Modules_Dir=/data/adb/modules if $Have_ROOT; then if [[ -x $Magisk ]]; then [[ `$Magisk -v | grep 'alpha'` != '' ]] && export Magisk_Type=alpha [[ `$Magisk -v | grep 'lite'` != '' ]] && export Magisk_Type=lite [[ $Magisk_Type = lite ]] && export Modules_Dir=/data/adb/lite_modules - fi + elif [[ `$Ksud -V | grep 'ksud'` != '' ]]; then + export Magisk_Type=ksu + export Ksu_Kernel_Version=`$Ksud debug version | awk -F ': ' '{printf $2}'` + export Ksu_Manager_Version=`$Ksud -V | awk -F ' ' '{printf $2}'` + fi fi export Script_Dir=$TMPDIR/tmp export install_MOD=$ShellScript/Magisk_Module/install_Module_Script.sh @@ -52,6 +57,10 @@ export lu3=$GJZS/XianShua #Function mask() { + if [[ $Magisk_Type = ksu ]]; then + echo "已安装KernelSU内核版本:$Ksu_Kernel_Version" + echo "已安装KernelSU管理器版本:$Ksu_Manager_Version" + else export Magisk=`$which magisk` export MAGISKTMP=`$Magisk --path 2>/dev/null` [[ -z "$MAGISKTMP" ]] && export MAGISKTMP=/sbin @@ -91,6 +100,7 @@ mask() { versionCode=`grep_prop versionCode "$Module_XinXi"` fi fi + fi } adb() ( @@ -179,33 +189,6 @@ adbsu() { fi } -Install_curl() { - curl -where &>/dev/null && return 0 - unzip --help &>/dev/null || return 1 - wget -where &>/dev/null || return 1 - [[ ! -f $Load ]] && return 1 - local jian jian2 - . $Load curl - - jian=$TMPDIR/curl.zip - jian2=$Script_Dir/META-INF/com/google/android/update-binary - WGET -c -O $jian "http://d0.ananas.chaoxing.com/download/$url" - [[ ! -f "$jian" ]] && abort "!下载文件失败" - echo "- 开始安装curl" - rm -rf $Script_Dir - mkdir -p $Script_Dir - unzip -oq "$jian" 'META-INF/com/google/android/update-binary' -d $Script_Dir - - if [[ -f "$jian2" ]]; then - sh "$jian2" $Package_name 1 "$jian" - PATH="$PATH" - else - abort "!解压文件失败" - fi - rm -f $jian -} - - Install_Applet2() { JCe="$PeiZhi_File/Applet_Installed.log" [[ -f "$JCe" ]] && JCe3=`cat $JCe` @@ -295,7 +278,6 @@ Start_Installing_Busybox() { } Installing_Busybox() { - Install_curl Start_Installing_Busybox . $Load Install_Applet [[ ! -d $lu ]] && mkdir -p $lu &>/dev/null