Inject binaries into /system if sbin not accessible

Some Android 11+ devices have the /sbin partition but not accessible by the global shell (`PATH` doesn't contain `/sbin`). Not only custom ROMs but also some stock ROMs have the same behavior so I believe it is something we need to deal with.
Fix #6427, fix #4309, fix #5728, fix #3593
This commit is contained in:
残页 2022-12-14 05:54:55 +08:00 committed by GitHub
parent ed37ddd570
commit 33f5154269
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -614,7 +614,7 @@ void magic_mount() {
system->collect_files(module, fd); system->collect_files(module, fd);
close(fd); close(fd);
} }
if (MAGISKTMP != "/sbin") { if (MAGISKTMP != "/sbin" || !str_contains(getenv("PATH") ?: "", "/sbin")) {
// Need to inject our binaries into /system/bin // Need to inject our binaries into /system/bin
inject_magisk_bins(system); inject_magisk_bins(system);
} }