Deprecate path /sbin/.core, switch to /sbin/.magisk

Symlink is preserved for backwards compatibility
This commit is contained in:
topjohnwu
2018-11-15 01:36:03 -05:00
parent 83ae66daea
commit 376e7977f0
7 changed files with 21 additions and 15 deletions
@@ -29,12 +29,15 @@ public class RootUtils extends Shell.Initializer {
public boolean onInit(Context context, @NonNull Shell shell) {
Shell.Job job = shell.newJob();
if (shell.isRoot()) {
if (!new SuFile("/sbin/.magisk").exists())
job.add("ln -s /sbin/.core /sbin/.magisk");
InputStream magiskUtils = context.getResources().openRawResource(R.raw.util_functions);
InputStream managerUtils = context.getResources().openRawResource(R.raw.utils);
job.add(magiskUtils).add(managerUtils);
Const.MAGISK_DISABLE_FILE = new SuFile("/cache/.disable_magisk");
SuFile file = new SuFile("/sbin/.core/img");
SuFile file = new SuFile("/sbin/.magisk/img");
if (file.exists()) {
Const.MAGISK_PATH = file;
} else if ((file = new SuFile("/dev/magisk/img")).exists()) {