Rename rules to preinit

It is possible that we will allow more preinit files for modules.
Rename the partition and folders from rules to preinit.
This commit is contained in:
topjohnwu
2023-03-16 04:07:00 -07:00
committed by John Wu
parent 7048aa1014
commit 4e2b88b3d0
18 changed files with 110 additions and 118 deletions

View File

@@ -506,14 +506,14 @@ string find_apk_path(const char *pkg) {
return path.append("/base.apk");
}
string find_rules_dir(const char *base_dir) {
string rules_dir = base_dir;
if (access((rules_dir + "/unencrypted").data(), F_OK) == 0) {
rules_dir += "/unencrypted/magisk";
} else if (access((rules_dir + "/adb").data(), F_OK) == 0) {
rules_dir += "/adb/modules";
string resolve_preinit_dir(const char *base_dir) {
string dir = base_dir;
if (access((dir + "/unencrypted").data(), F_OK) == 0) {
dir += "/unencrypted/magisk";
} else if (access((dir + "/adb").data(), F_OK) == 0) {
dir += "/adb/modules";
} else {
rules_dir += "/magisk";
dir += "/magisk";
}
return rules_dir;
return dir;
}

View File

@@ -107,7 +107,7 @@ void frm_rf(int dirfd);
void clone_dir(int src, int dest);
std::vector<mount_info> parse_mount_info(const char *pid);
std::string find_apk_path(const char *pkg);
std::string find_rules_dir(const char *base_dir);
std::string resolve_preinit_dir(const char *base_dir);
using sFILE = std::unique_ptr<FILE, decltype(&fclose)>;
using sDIR = std::unique_ptr<DIR, decltype(&closedir)>;