Properly detect hosts file

This commit is contained in:
topjohnwu
2017-09-25 17:55:40 +08:00
parent a3abb86daa
commit 5762ded601
2 changed files with 5 additions and 4 deletions

View File

@@ -221,12 +221,12 @@ public class SettingsActivity extends Activity implements Topic.Subscriber {
enabled = prefs.getBoolean("hosts", false);
if (enabled) {
getShell().su_raw(
"cp -af /system/etc/hosts /magisk/.core/hosts",
"mount -o bind /magisk/.core/hosts /system/etc/hosts");
"cp -af /system/etc/hosts " + MagiskManager.MAGISK_HOST_FILE,
"mount -o bind " + MagiskManager.MAGISK_HOST_FILE + " /system/etc/hosts");
} else {
getShell().su_raw(
"umount -l /system/etc/hosts",
"rm -f /magisk/.core/hosts");
"rm -f " + MagiskManager.MAGISK_HOST_FILE);
}
break;
case "su_access":