Merge "Treblize init.rc location" am: 76e9a180a8 am: 9afcdc825d

am: 19e3517a91

Change-Id: If71b2951ff92f83c61c175a03923085c0ea38edd
This commit is contained in:
Jaekyun Seok 2017-02-25 02:55:57 +00:00 committed by android-build-merger
commit ef99ced7f8
3 changed files with 35 additions and 9 deletions

View file

@ -476,15 +476,18 @@ exit_success:
static void import_late(const std::vector<std::string>& args, size_t start_index, size_t end_index) {
Parser& parser = Parser::GetInstance();
if (end_index <= start_index) {
// Use the default set if no path is given
static const std::vector<std::string> init_directories = {
"/system/etc/init",
"/vendor/etc/init",
"/odm/etc/init"
};
for (const auto& dir : init_directories) {
parser.ParseConfig(dir);
// Fallbacks for partitions on which early mount isn't enabled.
if (!parser.is_system_etc_init_loaded()) {
parser.ParseConfig("/system/etc/init");
parser.set_is_system_etc_init_loaded(true);
}
if (!parser.is_vendor_etc_init_loaded()) {
parser.ParseConfig("/vendor/etc/init");
parser.set_is_vendor_etc_init_loaded(true);
}
if (!parser.is_odm_etc_init_loaded()) {
parser.ParseConfig("/odm/etc/init");
parser.set_is_odm_etc_init_loaded(true);
}
} else {
for (size_t i = start_index; i < end_index; ++i) {

View file

@ -992,8 +992,16 @@ int main(int argc, char** argv) {
std::string bootscript = property_get("ro.boot.init_rc");
if (bootscript.empty()) {
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 {
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();

View file

@ -41,6 +41,18 @@ public:
bool ParseConfig(const std::string& path);
void AddSectionParser(const std::string& name,
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:
Parser();
@ -50,6 +62,9 @@ private:
bool ParseConfigDir(const std::string& path);
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