Fix init.rc path detection

Fix #4319
Some devices store init.rc into the new path but still have the legacy /init.rc file
This commit is contained in:
残页 2021-10-29 18:21:20 +08:00 committed by GitHub
parent 2954eb4bdc
commit 89c2c21774
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -285,12 +285,12 @@ void SARBase::patch_rootdir() {
} }
// Patch init.rc // Patch init.rc
if (access("/init.rc", F_OK) == 0) { if (access(NEW_INITRC, F_OK) == 0) {
patch_init_rc("/init.rc", ROOTOVL "/init.rc", tmp_dir.data());
} else {
// Android 11's new init.rc // Android 11's new init.rc
xmkdirs(dirname(ROOTOVL NEW_INITRC), 0755); xmkdirs(dirname(ROOTOVL NEW_INITRC), 0755);
patch_init_rc(NEW_INITRC, ROOTOVL NEW_INITRC, tmp_dir.data()); patch_init_rc(NEW_INITRC, ROOTOVL NEW_INITRC, tmp_dir.data());
} else {
patch_init_rc("/init.rc", ROOTOVL "/init.rc", tmp_dir.data());
} }
// Extract magisk // Extract magisk