From 56e3cc850cde4578ae0ec709d085ee02a4ecaac8 Mon Sep 17 00:00:00 2001 From: Sangyoon Jang Date: Thu, 23 Apr 2020 20:30:18 +0900 Subject: [PATCH] Remove preload-rw pkgs after install These packages were backuped already. Change-Id: Ibca7ca4ab358788759c90c28e9a24eee10866e97 Signed-off-by: Sangyoon Jang --- src/install_preload_pkg.c | 26 ++++++++++++-------------- 1 file changed, 12 insertions(+), 14 deletions(-) diff --git a/src/install_preload_pkg.c b/src/install_preload_pkg.c index e53ab34..48576cc 100644 --- a/src/install_preload_pkg.c +++ b/src/install_preload_pkg.c @@ -144,20 +144,7 @@ static int _install_preload_pkg(const char *backend, const char *directory, waitpid(pid, &status, 0); } - /* remove a file after installation, - * keep rw packages for factory-reset - */ - if (readonly) { - ret = remove(file_path); - if (ret < 0) { - _E("Failed to remove [%s]: [%s]", - file_path, strerror_r(errno, err_buf, - sizeof(err_buf))); - closedir(dir); - g_list_free_full(preload_rw_pkg_list, free); - return -1; - } - } else { + if (!readonly) { // make the preload-rw list pkg_info = pkgmgr_client_check_pkginfo_from_file(file_path); if (pkg_info == NULL) { @@ -170,6 +157,17 @@ static int _install_preload_pkg(const char *backend, const char *directory, pkgmgr_client_free_pkginfo(pkg_info); pkg_info = NULL; } + + /* remove a file after installation */ + ret = remove(file_path); + if (ret < 0) { + _E("Failed to remove [%s]: [%s]", file_path, + strerror_r(errno, err_buf, + sizeof(err_buf))); + closedir(dir); + g_list_free_full(preload_rw_pkg_list, free); + return -1; + } } closedir(dir); -- 2.34.1