mirror of
https://github.com/topjohnwu/Magisk.git
synced 2024-12-22 07:57:39 +00:00
Redirect /data/adb/magisk/busybox
Workaround some stupid Samsung kernel restrictions
This commit is contained in:
parent
2b759b84b0
commit
f9c7a4c933
@ -98,6 +98,13 @@ static void mount_mirrors() {
|
||||
link_mirror(system_ext)
|
||||
}
|
||||
|
||||
constexpr char bb_script[] = R"EOF(
|
||||
#!/system/bin/sh
|
||||
BB=%s
|
||||
[ -x $BB ] && exec $BB "$@"
|
||||
exec /data/adb/magisk/busybox.bin "$@"
|
||||
)EOF";
|
||||
|
||||
static bool magisk_env() {
|
||||
char buf[4096];
|
||||
|
||||
@ -145,12 +152,20 @@ static bool magisk_env() {
|
||||
unlink("/sbin/magiskhide");
|
||||
}
|
||||
|
||||
if (access(DATABIN "/busybox", X_OK) == -1)
|
||||
return false;
|
||||
if (access(DATABIN "/busybox.bin", X_OK)) {
|
||||
if (access(DATABIN "/busybox", X_OK))
|
||||
return false;
|
||||
rename(DATABIN "/busybox", DATABIN "/busybox.bin");
|
||||
}
|
||||
|
||||
sprintf(buf, "%s/" BBPATH "/busybox", MAGISKTMP.data());
|
||||
{
|
||||
auto fp = open_file(DATABIN "/busybox", "we");
|
||||
fprintf(fp.get(), bb_script, buf);
|
||||
}
|
||||
chmod(DATABIN "/busybox", 0755);
|
||||
mkdir(dirname(buf), 0755);
|
||||
cp_afc(DATABIN "/busybox", buf);
|
||||
cp_afc(DATABIN "/busybox.bin", buf);
|
||||
exec_command_async(buf, "--install", "-s", dirname(buf));
|
||||
|
||||
return true;
|
||||
|
Loading…
x
Reference in New Issue
Block a user