mirror of
https://github.com/topjohnwu/Magisk.git
synced 2026-01-12 21:14:15 -08:00
Update all hardcode paths in app and script
This commit is contained in:
@@ -6,7 +6,8 @@ import java.io.File
|
||||
object Const {
|
||||
|
||||
// Paths
|
||||
const val MAGISK_PATH = "/sbin/.magisk/modules"
|
||||
lateinit var MAGISKTMP: String
|
||||
val MAGISK_PATH get() = "$MAGISKTMP/modules"
|
||||
var MAGISK_DISABLE_FILE = File("xxx")
|
||||
const val TMP_FOLDER_PATH = "/dev/tmp"
|
||||
const val MAGISK_LOG = "/cache/magisk.log"
|
||||
@@ -25,8 +26,8 @@ object Const {
|
||||
object Version {
|
||||
const val MIN_VERSION = "v19.0"
|
||||
const val MIN_VERCODE = 19000
|
||||
const val CONNECT_MODE = 20100
|
||||
const val PROVIDER_CONNECT = 20102
|
||||
const val PROVIDER_CONNECT = 20200
|
||||
const val DYNAMIC_PATH = 20400
|
||||
}
|
||||
|
||||
object ID {
|
||||
|
||||
@@ -62,7 +62,7 @@ class Module(path: String) : BaseModule() {
|
||||
|
||||
companion object {
|
||||
|
||||
private const val PERSIST = "/sbin/.magisk/mirror/persist/magisk"
|
||||
private val PERSIST get() = "${Const.MAGISKTMP}/mirror/persist/magisk"
|
||||
|
||||
@WorkerThread
|
||||
fun loadModules(): List<Module> {
|
||||
|
||||
@@ -18,22 +18,20 @@ class RootInit : Shell.Initializer() {
|
||||
|
||||
fun init(context: Context, shell: Shell): Boolean {
|
||||
val job = shell.newJob()
|
||||
if (Info.env.magiskVersionCode >= Const.Version.DYNAMIC_PATH)
|
||||
job.add("MAGISKTMP=$(magisk --path)/.magisk")
|
||||
else
|
||||
job.add("MAGISKTMP=/sbin/.magisk")
|
||||
job.add(context.rawResource(R.raw.manager))
|
||||
if (shell.isRoot) {
|
||||
job.add(context.rawResource(R.raw.util_functions))
|
||||
.add("SHA1=`grep_prop SHA1 /sbin/.magisk/config`")
|
||||
Const.MAGISK_DISABLE_FILE = SuFile("/cache/.disable_magisk")
|
||||
}
|
||||
|
||||
job.add(
|
||||
"export BOOTMODE=true",
|
||||
"mount_partitions",
|
||||
"get_flags",
|
||||
"run_migrations"
|
||||
).exec()
|
||||
job.add("mm_init").exec()
|
||||
|
||||
fun getvar(name: String) = ShellUtils.fastCmd(shell, "echo \$$name").toBoolean()
|
||||
|
||||
Const.MAGISKTMP = ShellUtils.fastCmd(shell, "echo \$MAGISKTMP")
|
||||
Info.keepVerity = getvar("KEEPVERITY")
|
||||
Info.keepEnc = getvar("KEEPFORCEENCRYPT")
|
||||
Info.isSAR = getvar("SYSTEM_ROOT")
|
||||
|
||||
Reference in New Issue
Block a user