You've already forked KsuWebUIStandalone
mirror of
https://github.com/5ec1cff/KsuWebUIStandalone.git
synced 2025-09-06 06:37:11 +00:00
20 lines
478 B
Kotlin
20 lines
478 B
Kotlin
package io.github.a13e300.ksuwebui
|
|
|
|
import com.topjohnwu.superuser.Shell
|
|
|
|
inline fun <T> withNewRootShell(
|
|
globalMnt: Boolean = false,
|
|
block: Shell.() -> T
|
|
): T {
|
|
return createRootShell(globalMnt).use(block)
|
|
}
|
|
|
|
fun createRootShell(globalMnt: Boolean = false): Shell {
|
|
Shell.enableVerboseLogging = BuildConfig.DEBUG
|
|
val builder = Shell.Builder.create()
|
|
if (globalMnt) {
|
|
builder.setFlags(Shell.FLAG_MOUNT_MASTER)
|
|
}
|
|
return builder.build()
|
|
}
|