Re-add busybox
Add check for proper install, install if not. Needed for flashing zips.
This commit is contained in:
parent
3b0cec9db6
commit
dac85757b3
@ -10,6 +10,7 @@ import android.support.v7.app.AppCompatActivity;
|
|||||||
import com.topjohnwu.magisk.services.MonitorService;
|
import com.topjohnwu.magisk.services.MonitorService;
|
||||||
import com.topjohnwu.magisk.utils.Async;
|
import com.topjohnwu.magisk.utils.Async;
|
||||||
import com.topjohnwu.magisk.utils.Logger;
|
import com.topjohnwu.magisk.utils.Logger;
|
||||||
|
import com.topjohnwu.magisk.utils.Shell;
|
||||||
import com.topjohnwu.magisk.utils.Utils;
|
import com.topjohnwu.magisk.utils.Utils;
|
||||||
|
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
@ -64,6 +65,23 @@ public class SplashActivity extends AppCompatActivity {
|
|||||||
|
|
||||||
// Initialize
|
// Initialize
|
||||||
|
|
||||||
|
|
||||||
|
if (Shell.rootAccess()) {
|
||||||
|
if (!Utils.busyboxInstalled()) {
|
||||||
|
String busybox = getApplicationContext().getApplicationInfo().nativeLibraryDir + "/libbusybox.so";
|
||||||
|
Shell.su(
|
||||||
|
"rm -rf /data/busybox",
|
||||||
|
"mkdir -p /data/busybox",
|
||||||
|
"cp -af " + busybox + " /data/busybox/busybox",
|
||||||
|
"chmod 755 /data/busybox /data/busybox/busybox",
|
||||||
|
"chcon u:object_r:system_file:s0 /data/busybox /data/busybox/busybox",
|
||||||
|
"/data/busybox/busybox --install -s /data/busybox",
|
||||||
|
"rm -f /data/busybox/su",
|
||||||
|
"export PATH=/data/busybox:$PATH"
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
new Async.CheckUpdates(this).execute();
|
new Async.CheckUpdates(this).execute();
|
||||||
new Async.LoadModules(this).execute();
|
new Async.LoadModules(this).execute();
|
||||||
new Async.LoadRepos(this).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
|
new Async.LoadRepos(this).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
|
||||||
|
@ -91,6 +91,17 @@ public class Utils {
|
|||||||
return Boolean.parseBoolean(ret.get(0));
|
return Boolean.parseBoolean(ret.get(0));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static boolean busyboxInstalled() {
|
||||||
|
List<String> ret;
|
||||||
|
String command = "if [ -d /data/busybox ]; then echo true; else echo false; fi";
|
||||||
|
if (Shell.rootAccess()) {
|
||||||
|
ret = Shell.su(command);
|
||||||
|
} else {
|
||||||
|
ret = Shell.sh(command);
|
||||||
|
}
|
||||||
|
return Boolean.parseBoolean(ret.get(0));
|
||||||
|
}
|
||||||
|
|
||||||
public static boolean rootEnabled() {
|
public static boolean rootEnabled() {
|
||||||
List<String> ret;
|
List<String> ret;
|
||||||
String command = "if [ -z $(which su) ]; then echo false; else echo true; fi";
|
String command = "if [ -z $(which su) ]; then echo false; else echo true; fi";
|
||||||
|
Loading…
Reference in New Issue
Block a user