You've already forked Magisk
mirror of
https://github.com/topjohnwu/Magisk.git
synced 2025-09-06 06:36:58 +00:00
Cleanup magiskinit code
This commit is contained in:
+10
-10
@@ -56,7 +56,7 @@ static int dump_manager(const char *path, mode_t mode) {
|
||||
|
||||
class RecoveryInit : public BaseInit {
|
||||
public:
|
||||
RecoveryInit(char *argv[], cmdline *cmd) : BaseInit(argv, cmd) {}
|
||||
RecoveryInit(char *argv[], BootConfig *cmd) : BaseInit(argv, cmd) {}
|
||||
void start() override {
|
||||
LOGD("Ramdisk is recovery, abort\n");
|
||||
rename("/.backup/init", "/init");
|
||||
@@ -141,25 +141,25 @@ int main(int argc, char *argv[]) {
|
||||
return 1;
|
||||
|
||||
BaseInit *init;
|
||||
cmdline cmd{};
|
||||
BootConfig config{};
|
||||
|
||||
if (argc > 1 && argv[1] == "selinux_setup"sv) {
|
||||
setup_klog();
|
||||
init = new SecondStageInit(argv);
|
||||
} else {
|
||||
// This will also mount /sys and /proc
|
||||
load_kernel_info(&cmd);
|
||||
load_kernel_info(&config);
|
||||
|
||||
if (cmd.skip_initramfs)
|
||||
init = new SARInit(argv, &cmd);
|
||||
else if (cmd.force_normal_boot)
|
||||
init = new FirstStageInit(argv, &cmd);
|
||||
if (config.skip_initramfs)
|
||||
init = new SARInit(argv, &config);
|
||||
else if (config.force_normal_boot)
|
||||
init = new FirstStageInit(argv, &config);
|
||||
else if (access("/sbin/recovery", F_OK) == 0 || access("/system/bin/recovery", F_OK) == 0)
|
||||
init = new RecoveryInit(argv, &cmd);
|
||||
init = new RecoveryInit(argv, &config);
|
||||
else if (check_two_stage())
|
||||
init = new FirstStageInit(argv, &cmd);
|
||||
init = new FirstStageInit(argv, &config);
|
||||
else
|
||||
init = new RootFSInit(argv, &cmd);
|
||||
init = new RootFSInit(argv, &config);
|
||||
}
|
||||
|
||||
// Run the main routine
|
||||
|
||||
Reference in New Issue
Block a user