From 71dbc9450e8101dc86ad35691b1441c868dba96c Mon Sep 17 00:00:00 2001 From: LoveSy Date: Thu, 3 Dec 2020 02:21:43 +0800 Subject: [PATCH] Reset installer when the original manager launched --- edxp-core/src/main/cpp/main/src/config_manager.cpp | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/edxp-core/src/main/cpp/main/src/config_manager.cpp b/edxp-core/src/main/cpp/main/src/config_manager.cpp index 04d22687..49fd2e2f 100644 --- a/edxp-core/src/main/cpp/main/src/config_manager.cpp +++ b/edxp-core/src/main/cpp/main/src/config_manager.cpp @@ -292,7 +292,7 @@ namespace edxp { fs::perms::others_exec); path_chown(prefs_path, uid, 0); } - if (pkg_name == installer_pkg_name_) { + if (pkg_name == installer_pkg_name_ || pkg_name == kPrimaryInstallerPkgName) { auto conf_path = GetConfigPath(); if (!path_exists(conf_path)) { fs::create_directories(conf_path); @@ -309,6 +309,17 @@ namespace edxp { if (const auto &[r_uid, r_gid] = path_own(log_path); r_uid != uid) { path_chown(log_path, uid, 0, true); } + + if (pkg_name == kPrimaryInstallerPkgName) { + try { + auto installer_pkg_name_path = GetConfigPath("installer"); + if (path_exists(installer_pkg_name_path)) { + fs::remove(installer_pkg_name_path); + } + } catch (const fs::filesystem_error &e) { + LOGE("%s", e.what()); + } + } } } catch (const fs::filesystem_error &e) { LOGE("%s", e.what());