Commit 5ce29c30 authored by topjohnwu's avatar topjohnwu

Fix sepolicy copying

parent 70d67728
...@@ -25,6 +25,7 @@ object Const { ...@@ -25,6 +25,7 @@ object Const {
fun atLeast_20_2() = Info.env.magiskVersionCode >= 20200 || isCanary() fun atLeast_20_2() = Info.env.magiskVersionCode >= 20200 || isCanary()
fun atLeast_20_4() = Info.env.magiskVersionCode >= 20400 || isCanary() fun atLeast_20_4() = Info.env.magiskVersionCode >= 20400 || isCanary()
fun atLeast_21_0() = Info.env.magiskVersionCode >= 21000 || isCanary() fun atLeast_21_0() = Info.env.magiskVersionCode >= 21000 || isCanary()
fun atLeast_21_2() = Info.env.magiskVersionCode >= 21200 || isCanary()
fun isCanary() = Info.env.magiskVersionCode % 100 != 0 fun isCanary() = Info.env.magiskVersionCode % 100 != 0
} }
...@@ -36,7 +37,6 @@ object Const { ...@@ -36,7 +37,6 @@ object Const {
// notifications // notifications
const val MAGISK_UPDATE_NOTIFICATION_ID = 4 const val MAGISK_UPDATE_NOTIFICATION_ID = 4
const val APK_UPDATE_NOTIFICATION_ID = 5 const val APK_UPDATE_NOTIFICATION_ID = 5
const val HIDE_MANAGER_NOTIFICATION_ID = 8
const val UPDATE_NOTIFICATION_CHANNEL = "update" const val UPDATE_NOTIFICATION_CHANNEL = "update"
const val PROGRESS_NOTIFICATION_CHANNEL = "progress" const val PROGRESS_NOTIFICATION_CHANNEL = "progress"
const val CHECK_MAGISK_UPDATE_WORKER_ID = "magisk_update" const val CHECK_MAGISK_UPDATE_WORKER_ID = "magisk_update"
......
...@@ -27,13 +27,13 @@ class LocalModule(path: String) : Module() { ...@@ -27,13 +27,13 @@ class LocalModule(path: String) : Module() {
val dir = "$PERSIST/$id" val dir = "$PERSIST/$id"
if (enable) { if (enable) {
disableFile.delete() disableFile.delete()
if (Const.Version.isCanary()) if (Const.Version.atLeast_21_2())
Shell.su("copy_sepolicy_rules").submit() Shell.su("copy_sepolicy_rules").submit()
else else
Shell.su("mkdir -p $dir", "cp -af $ruleFile $dir").submit() Shell.su("mkdir -p $dir", "cp -af $ruleFile $dir").submit()
} else { } else {
!disableFile.createNewFile() !disableFile.createNewFile()
if (Const.Version.isCanary()) if (Const.Version.atLeast_21_2())
Shell.su("copy_sepolicy_rules").submit() Shell.su("copy_sepolicy_rules").submit()
else else
Shell.su("rm -rf $dir").submit() Shell.su("rm -rf $dir").submit()
...@@ -45,13 +45,13 @@ class LocalModule(path: String) : Module() { ...@@ -45,13 +45,13 @@ class LocalModule(path: String) : Module() {
set(remove) { set(remove) {
if (remove) { if (remove) {
removeFile.createNewFile() removeFile.createNewFile()
if (Const.Version.isCanary()) if (Const.Version.atLeast_21_2())
Shell.su("copy_sepolicy_rules").submit() Shell.su("copy_sepolicy_rules").submit()
else else
Shell.su("rm -rf $PERSIST/$id").submit() Shell.su("rm -rf $PERSIST/$id").submit()
} else { } else {
!removeFile.delete() !removeFile.delete()
if (Const.Version.isCanary()) if (Const.Version.atLeast_21_2())
Shell.su("copy_sepolicy_rules").submit() Shell.su("copy_sepolicy_rules").submit()
else else
Shell.su("cp -af $ruleFile $PERSIST/$id").submit() Shell.su("cp -af $ruleFile $PERSIST/$id").submit()
......
## v8.0.5
- Fix sepolicy rule copying
## v8.0.4 ## v8.0.4
- A lot of stability changes and minor bug fixes - A lot of stability changes and minor bug fixes
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment