#include <tzplatform_config.h>
#define USR_MANIFEST_DIRECTORY tzplatform_getenv(TZ_SYS_RO_PACKAGES)
+#define OPT_USR_MANIFEST_DIRECTORY tzplatform_getenv(TZ_SYS_RW_PACKAGES)
+#define RW_PKG_DIRECTORY tzplatform_getenv(TZ_SYS_RW_APP)
+#define SKEL_DIRECTORY tzplatform_mkpath(TZ_SYS_ETC, "skel/apps_rw")
#define PKGMGR_FOTA_PATH tzplatform_mkpath(TZ_SYS_GLOBALUSER_DATA, \
"pkgmgr/fota")
return 0;
}
+static void __remove_pkg_directories(const char *pkgid)
+{
+ int i;
+ int ret;
+ char buf[BUF_SIZE];
+ const char *base_dirs[] = {
+ OPT_USR_MANIFEST_DIRECTORY,
+ RW_PKG_DIRECTORY,
+ SKEL_DIRECTORY,
+ NULL
+ };
+
+ for (i = 0; base_dirs[i] != NULL; i++) {
+ ret = snprintf(buf, sizeof(buf), "%s/%s", base_dirs[i], pkgid);
+ if (ret < 0 || ret > sizeof(buf)) {
+ printf("snprintf fail\n");
+ continue;
+ }
+ if (!access(buf, F_OK)) {
+ if (remove_directory(buf))
+ _LOGE("failed to remove directory: %s", buf);
+ }
+ }
+}
+
static int __process_rw_fota(GHashTable *preload_rw_table)
{
FILE *fp = NULL;
_LOG("pkgid[%s] is deleted pkg\n", pkgid);
__delete_preload_rw_table(preload_rw_table,
pkgid);
+ /* maybe there are pkg directories which are
+ * extracted from opt.zip by FOTA
+ */
+ __remove_pkg_directories(pkgid);
FREE_AND_NULL(pkgid);
continue;
}