manager: Allow to use other su to install

This commit is contained in:
weishu
2024-04-15 12:32:20 +08:00
parent 2e2992a1c2
commit b1a225799a

View File

@@ -50,11 +50,20 @@ fun createRootShell(globalMnt: Boolean = false): Shell {
} else { } else {
builder.build(getKsuDaemonPath(), "debug", "su") builder.build(getKsuDaemonPath(), "debug", "su")
} }
} catch (e: Throwable) {
Log.w(TAG, "ksu failed: ", e)
try {
if (globalMnt) {
builder.build("su")
} else {
builder.build("su", "-mm")
}
} catch (e: Throwable) { } catch (e: Throwable) {
Log.e(TAG, "su failed: ", e) Log.e(TAG, "su failed: ", e)
builder.build("sh") builder.build("sh")
} }
} }
}
fun execKsud(args: String, newShell: Boolean = false): Boolean { fun execKsud(args: String, newShell: Boolean = false): Boolean {
val shell = if (newShell) createRootShell() else getRootShell() val shell = if (newShell) createRootShell() else getRootShell()