Merge "Treblize init.rc location"
am: 76e9a180a8
Change-Id: I8415b555308b8ad489413f9e99f6e73ee9caa17e
This commit is contained in:
commit
9afcdc825d
3 changed files with 35 additions and 9 deletions
|
|
@ -476,15 +476,18 @@ exit_success:
|
||||||
static void import_late(const std::vector<std::string>& args, size_t start_index, size_t end_index) {
|
static void import_late(const std::vector<std::string>& args, size_t start_index, size_t end_index) {
|
||||||
Parser& parser = Parser::GetInstance();
|
Parser& parser = Parser::GetInstance();
|
||||||
if (end_index <= start_index) {
|
if (end_index <= start_index) {
|
||||||
// Use the default set if no path is given
|
// Fallbacks for partitions on which early mount isn't enabled.
|
||||||
static const std::vector<std::string> init_directories = {
|
if (!parser.is_system_etc_init_loaded()) {
|
||||||
"/system/etc/init",
|
parser.ParseConfig("/system/etc/init");
|
||||||
"/vendor/etc/init",
|
parser.set_is_system_etc_init_loaded(true);
|
||||||
"/odm/etc/init"
|
}
|
||||||
};
|
if (!parser.is_vendor_etc_init_loaded()) {
|
||||||
|
parser.ParseConfig("/vendor/etc/init");
|
||||||
for (const auto& dir : init_directories) {
|
parser.set_is_vendor_etc_init_loaded(true);
|
||||||
parser.ParseConfig(dir);
|
}
|
||||||
|
if (!parser.is_odm_etc_init_loaded()) {
|
||||||
|
parser.ParseConfig("/odm/etc/init");
|
||||||
|
parser.set_is_odm_etc_init_loaded(true);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
for (size_t i = start_index; i < end_index; ++i) {
|
for (size_t i = start_index; i < end_index; ++i) {
|
||||||
|
|
|
||||||
|
|
@ -992,8 +992,16 @@ int main(int argc, char** argv) {
|
||||||
std::string bootscript = property_get("ro.boot.init_rc");
|
std::string bootscript = property_get("ro.boot.init_rc");
|
||||||
if (bootscript.empty()) {
|
if (bootscript.empty()) {
|
||||||
parser.ParseConfig("/init.rc");
|
parser.ParseConfig("/init.rc");
|
||||||
|
parser.set_is_system_etc_init_loaded(
|
||||||
|
parser.ParseConfig("/system/etc/init"));
|
||||||
|
parser.set_is_vendor_etc_init_loaded(
|
||||||
|
parser.ParseConfig("/vendor/etc/init"));
|
||||||
|
parser.set_is_odm_etc_init_loaded(parser.ParseConfig("/odm/etc/init"));
|
||||||
} else {
|
} else {
|
||||||
parser.ParseConfig(bootscript);
|
parser.ParseConfig(bootscript);
|
||||||
|
parser.set_is_system_etc_init_loaded(true);
|
||||||
|
parser.set_is_vendor_etc_init_loaded(true);
|
||||||
|
parser.set_is_odm_etc_init_loaded(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
ActionManager& am = ActionManager::GetInstance();
|
ActionManager& am = ActionManager::GetInstance();
|
||||||
|
|
|
||||||
|
|
@ -41,6 +41,18 @@ public:
|
||||||
bool ParseConfig(const std::string& path);
|
bool ParseConfig(const std::string& path);
|
||||||
void AddSectionParser(const std::string& name,
|
void AddSectionParser(const std::string& name,
|
||||||
std::unique_ptr<SectionParser> parser);
|
std::unique_ptr<SectionParser> parser);
|
||||||
|
void set_is_system_etc_init_loaded(bool loaded) {
|
||||||
|
is_system_etc_init_loaded_ = loaded;
|
||||||
|
}
|
||||||
|
void set_is_vendor_etc_init_loaded(bool loaded) {
|
||||||
|
is_vendor_etc_init_loaded_ = loaded;
|
||||||
|
}
|
||||||
|
void set_is_odm_etc_init_loaded(bool loaded) {
|
||||||
|
is_odm_etc_init_loaded_ = loaded;
|
||||||
|
}
|
||||||
|
bool is_system_etc_init_loaded() { return is_system_etc_init_loaded_; }
|
||||||
|
bool is_vendor_etc_init_loaded() { return is_vendor_etc_init_loaded_; }
|
||||||
|
bool is_odm_etc_init_loaded() { return is_odm_etc_init_loaded_; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Parser();
|
Parser();
|
||||||
|
|
@ -50,6 +62,9 @@ private:
|
||||||
bool ParseConfigDir(const std::string& path);
|
bool ParseConfigDir(const std::string& path);
|
||||||
|
|
||||||
std::map<std::string, std::unique_ptr<SectionParser>> section_parsers_;
|
std::map<std::string, std::unique_ptr<SectionParser>> section_parsers_;
|
||||||
|
bool is_system_etc_init_loaded_ = false;
|
||||||
|
bool is_vendor_etc_init_loaded_ = false;
|
||||||
|
bool is_odm_etc_init_loaded_ = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue