Skip to content
This repository has been archived by the owner on Jun 3, 2024. It is now read-only.

Commit

Permalink
实验性支持 KernelSU
Browse files Browse the repository at this point in the history
  • Loading branch information
liuran001 committed Oct 9, 2023
1 parent 8ff562c commit a039248
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 30 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
42 changes: 12 additions & 30 deletions app/src/main/assets/usr/kr-script/Util_Functions.sh
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -91,6 +100,7 @@ mask() {
versionCode=`grep_prop versionCode "$Module_XinXi"`
fi
fi
fi
}

adb() (
Expand Down Expand Up @@ -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`
Expand Down Expand Up @@ -295,7 +278,6 @@ Start_Installing_Busybox() {
}

Installing_Busybox() {
Install_curl
Start_Installing_Busybox
. $Load Install_Applet
[[ ! -d $lu ]] && mkdir -p $lu &>/dev/null
Expand Down

0 comments on commit a039248

Please sign in to comment.