Commit 9159f86a authored by topjohnwu's avatar topjohnwu

Improvements to system_root devices booting as recovery

parent e139f4fc
......@@ -357,6 +357,8 @@ int main(int argc, char *argv[]) {
* ***********/
int root = open("/", O_RDONLY | O_CLOEXEC);
int mnt_system = 0;
int mnt_vendor = 0;
if (cmd.skip_initramfs) {
// Clear rootfs
......@@ -384,12 +386,14 @@ int main(int argc, char *argv[]) {
link("/.backup/init", "/init");
}
// Do not go further if system_root device is booting as recovery
if (!cmd.skip_initramfs && access("/sbin/recovery", F_OK) == 0)
goto exec_init;
/* ************
* Early Mount
* ************/
int mnt_system = 0;
int mnt_vendor = 0;
struct device dev;
char partname[32];
......@@ -423,8 +427,6 @@ int main(int argc, char *argv[]) {
* Ramdisk Patches
* ****************/
// Only patch rootfs if not intended to run in recovery
if (access("/sbin/recovery", F_OK) != 0) {
// Handle ramdisk overlays
int fd = open("/overlay", O_RDONLY | O_CLOEXEC);
if (fd >= 0) {
......@@ -464,8 +466,8 @@ int main(int argc, char *argv[]) {
dump_magisk("/sbin/magisk", 0755);
patch_socket_name("/sbin/magisk");
rename("/init.bak", "/sbin/magiskinit");
}
exec_init:
// Clean up
close(root);
umount("/proc");
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment