mirror of
https://github.com/topjohnwu/Magisk.git
synced 2024-11-27 20:15:29 +00:00
Let ShellInitializer run in BusyBox environment
This commit is contained in:
parent
b885ccbd63
commit
68c448bc34
@ -57,7 +57,7 @@ dependencies {
|
||||
fullImplementation "com.android.support:recyclerview-v7:${rootProject.ext.supportLibVersion}"
|
||||
fullImplementation "com.android.support:cardview-v7:${rootProject.ext.supportLibVersion}"
|
||||
fullImplementation "com.android.support:design:${rootProject.ext.supportLibVersion}"
|
||||
fullImplementation 'com.github.topjohnwu:libsu:1.2.0'
|
||||
fullImplementation 'com.github.topjohnwu:libsu:1.3.0'
|
||||
fullImplementation 'com.atlassian.commonmark:commonmark:0.11.0'
|
||||
fullImplementation 'org.kamranzafar:jtar:2.3'
|
||||
fullImplementation 'com.jakewharton:butterknife:8.8.1'
|
||||
|
@ -6,20 +6,26 @@ import android.support.annotation.NonNull;
|
||||
import com.topjohnwu.magisk.R;
|
||||
import com.topjohnwu.superuser.BusyBox;
|
||||
import com.topjohnwu.superuser.Shell;
|
||||
import com.topjohnwu.superuser.ShellUtils;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.InputStream;
|
||||
|
||||
public class ShellInitializer extends Shell.Initializer {
|
||||
|
||||
static {
|
||||
BusyBox.BB_PATH = new File(Const.BUSYBOX_PATH);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onRootShellInit(Context context, @NonNull Shell shell) throws Exception {
|
||||
BusyBox.BB_PATH = new File(Const.BUSYBOX_PATH);
|
||||
try (InputStream magiskUtils = context.getResources().openRawResource(R.raw.util_functions);
|
||||
InputStream managerUtils = context.getResources().openRawResource(R.raw.utils)
|
||||
) {
|
||||
shell.loadInputStream(null, null, magiskUtils);
|
||||
shell.loadInputStream(null, null, managerUtils);
|
||||
shell.execTask((in, err, out) -> {
|
||||
ShellUtils.pump(magiskUtils, in);
|
||||
ShellUtils.pump(managerUtils, in);
|
||||
});
|
||||
}
|
||||
shell.run(null, null,
|
||||
"mount_partitions",
|
||||
|
Loading…
Reference in New Issue
Block a user