Skip to content

Commit

Permalink
修复内核启动失败后的不能启动问题
Browse files Browse the repository at this point in the history
  • Loading branch information
Adlyq committed Feb 8, 2022
1 parent 47ff263 commit 527be87
Show file tree
Hide file tree
Showing 7 changed files with 14 additions and 8 deletions.
2 changes: 1 addition & 1 deletion app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ android {
minSdkVersion 26
targetSdkVersion 32
versionCode gitCommitCount.toInteger()
versionName "4.4"
versionName "4.5"
versionNameSuffix = ".r${gitCommitCount}.${gitCommitHash}"

testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
Expand Down
4 changes: 3 additions & 1 deletion app/src/main/assets/CFM_Start.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,10 @@ else
MAGISK_PATH="/data/adb/modules"
fi

if [ "$1" == "false" ] ; then
if [ "$1" == "false" ] && [ -f ${MAGISK_PATH}/Clash_For_Magisk/disable ]; then
rm -f ${MAGISK_PATH}/Clash_For_Magisk/disable
else
touch "$2"/../run/cmdRunning
"$2"/clash.service -s && "$2"/clash.tproxy -s
rm -rf "$2"/../run/cmdRunning
fi
4 changes: 3 additions & 1 deletion app/src/main/assets/CFM_Stop.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,10 @@ else
MAGISK_PATH="/data/adb/modules"
fi

if [ "$1" == "false" ] ; then
if [ "$1" == "false" ] && ! [ -f ${MAGISK_PATH}/Clash_For_Magisk/disable ]; then
touch ${MAGISK_PATH}/Clash_For_Magisk/disable
else
touch "$2"/../run/cmdRunning
"$2"/clash.service -k && "$2"/clash.tproxy -k
rm -rf "$2"/../run/cmdRunning
fi
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@

touch "$2"/../run/cmdRunning
"$2"/clash.service -k
"$2"/clash.service -s
"$2"/clash.tool -u
rm -rf "$2"/../run/cmdRunning
5 changes: 4 additions & 1 deletion app/src/main/java/com/dashboard/kotlin/MainPage.kt
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,10 @@ class MainPage : Fragment() {

setStatusCmdRunning()
GlobalScope.async {
doAssestsShellFile("CFM_Restart.sh")
SuiHelper.suCmd("touch ${ClashConfig.clashPath}/run/cmdRunning && " +
"${ClashConfig.scriptsPath}/clash.tool -u &&" +
" rm -rf ${ClashConfig.scriptsPath}/../run/cmdRunning")
//doAssestsShellFile("CFM_Update_GeoX.sh")
}
}
else -> return@setOnMenuItemClickListener false
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/res/menu/menu_restart.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@
<item
android:id="@+id/menu_restart"
android:icon="@drawable/ic_restart"
android:title="@string/menu_restart"
android:title="@string/menu_update"
app:showAsAction="always"/>
</menu>
2 changes: 1 addition & 1 deletion app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,5 @@
<string name="title_mmdb_download">MMDB 下载</string>
<string name="hint_core_path">内核路径</string>
<string name="hint_scripts_path">脚本路径</string>
<string name="menu_restart">仅重启内核</string>
<string name="menu_update">更新GeoX</string>
</resources>

0 comments on commit 527be87

Please sign in to comment.