Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 9c3d87d4 authored by Alex Light's avatar Alex Light
Browse files

Update BOOTCLASSPATH environment variable search location

The BOOTCLASSPATH environemnt variable is now set by its own
/etc/classpath file instead of init.environ.rc. Update otapreopt to
match this new location.

Test: manually OTA cuttlefish
Bug: 181182967
Change-Id: Iebdb112cbf1536e6468f8b73f5ff076b893058f9
parent c36d001a
Loading
Loading
Loading
Loading
+26 −16
Original line number Diff line number Diff line
@@ -195,8 +195,18 @@ private:
        //   export NAME VALUE
        // For simplicity, don't respect string quotation. The values we are interested in can be
        // encoded without them.
        // init.environ.rc and etc/classpath have the same format for
        // environment variable exports and can be matched by the same regex.
        // TODO Just like with the system-properties above we really should have
        // common code between init and otapreopt to deal with reading these
        // things. See b/181182967
        static constexpr const char* kEnvironmentVariableSources[] = {
                "/init.environ.rc", "/etc/classpath"
        };

        std::regex export_regex("\\s*export\\s+(\\S+)\\s+(\\S+)");
        bool parse_result = ParseFile("/init.environ.rc", [&](const std::string& line) {
        for (const char* env_vars_file : kEnvironmentVariableSources) {
            bool parse_result = ParseFile(env_vars_file, [&](const std::string& line) {
                std::smatch export_match;
                if (!std::regex_match(line, export_match, export_regex)) {
                    return true;
@@ -216,7 +226,7 @@ private:
            if (!parse_result) {
                return false;
            }

        }
        if (system_properties_.GetProperty(kAndroidDataPathPropertyName) == nullptr) {
            return false;
        }