Reset installer when the original manager launched

This commit is contained in:
LoveSy 2020-12-03 02:21:43 +08:00 committed by solohsu
parent 72d320d819
commit 71dbc9450e
1 changed files with 12 additions and 1 deletions

View File

@ -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<true>(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<true>(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());