Add several options

This commit is contained in:
topjohnwu
2016-11-09 05:17:50 +08:00
parent e76dba0f84
commit 8a8f24f93e
16 changed files with 73 additions and 58 deletions
@@ -350,28 +350,6 @@ public class Async {
}
}
public static class LinkBusyBox extends RootTask<Void, Void, Void> {
private boolean link;
public LinkBusyBox(boolean b) {
link = b;
}
@Override
protected Void doInBackground(Void... voids) {
if (link) {
Shell.su(
"rm -rf /magisk/.core/busybox",
"ln -s /data/busybox /magisk/.core/busybox"
);
} else {
Shell.su("rm -rf /magisk/.core/busybox");
}
return null;
}
}
public static class MagiskHide extends RootTask<Object, Void, Void> {
@Override
protected Void doInBackground(Object... params) {
@@ -39,6 +39,9 @@ public class Shell {
rootSTDOUT = new StreamGobbler(rootShell.getInputStream(), rootOutList, true);
rootSTDOUT.start();
// Setup umask
su("umask 022");
List<String> ret = su("echo -BOC-", "id");
if (ret == null) {
@@ -55,7 +55,8 @@ public class Utils {
}
public static boolean createFile(String path) {
String command = "touch " + path + " 2>/dev/null; if [ -f " + path + " ]; then echo true; else echo false; fi";
String folder = path.substring(0, path.lastIndexOf('/'));
String command = "mkdir -p " + folder + " 2>/dev/null; touch " + path + " 2>/dev/null; if [ -f \"" + path + "\" ]; then echo true; else echo false; fi";
return Shell.rootAccess() && Boolean.parseBoolean(Shell.su(command).get(0));
}