#define OPT_MANIFEST_DIRECTORY tzplatform_getenv(TZ_SYS_RW_PACKAGES)
#define USR_MANIFEST_DIRECTORY tzplatform_getenv(TZ_SYS_RO_PACKAGES)
#define PACKAGE_INFO_DB_FILE tzplatform_mkpath(TZ_SYS_DB, ".pkgmgr_parser.db")
+#define PACKAGE_INFO_DB_FILE_JOURNAL tzplatform_mkpath(TZ_SYS_DB, ".pkgmgr_parser.db-journal")
#define PKG_PARSER_DB_FILE tzplatform_mkpath(TZ_SYS_DB, ".pkgmgr_parser.db")
#define PKG_PARSER_DB_FILE_JOURNAL tzplatform_mkpath(TZ_SYS_DB, ".pkgmgr_parser.db-journal")
#define PKG_CERT_DB_FILE tzplatform_mkpath(TZ_SYS_DB, ".pkgmgr_cert.db")
#define PKG_CERT_DB_FILE_JOURNAL tzplatform_mkpath(TZ_SYS_DB, ".pkgmgr_cert.db-journal")
-#define PKG_INFO_DB_LABEL "pkgmgr::db"
+#define PKG_INFO_DB_LABEL "System"
#ifdef _E
#undef _E
static int pkg_fota_give_smack()
{
int ret = 0;
+ char *label;
+
+ label = getUserDBLabel();
- const char *argv_parser[] = { "/usr/bin/chsmack", "-a", PKG_INFO_DB_LABEL, PKG_PARSER_DB_FILE, NULL };
+ const char *argv_parser[] = { "/usr/bin/chsmack", "-a", label, getUserPkgParserDBPath(), NULL };
ret = pkg_fota_xsystem(argv_parser);
if (ret == -1) {
+ free(label);
_E("exec : argv_parser fail");
return -1;
}
- const char *argv_parserjn[] = { "/usr/bin/chsmack", "-a", PKG_INFO_DB_LABEL, PKG_PARSER_DB_FILE_JOURNAL, NULL };
+ const char *argv_parserjn[] = { "/usr/bin/chsmack", "-a", label, getUserPkgParserJournalDBPath(), NULL };
ret = pkg_fota_xsystem(argv_parserjn);
if (ret == -1) {
+ free(label);
_E("exec : argv_parserjn fail");
return -1;
}
- const char *argv_cert[] = { "/usr/bin/chsmack", "-a", PKG_INFO_DB_LABEL, PKG_CERT_DB_FILE, NULL };
+ const char *argv_cert[] = { "/usr/bin/chsmack", "-a", label, getUserPkgCertDBPath(), NULL };
ret = pkg_fota_xsystem(argv_cert);
if (ret == -1) {
+ free(label);
_E("exec : argv_cert fail");
return -1;
}
- const char *argv_certjn[] = { "/usr/bin/chsmack", "-a", PKG_INFO_DB_LABEL, PKG_CERT_DB_FILE_JOURNAL, NULL };
+ const char *argv_certjn[] = { "/usr/bin/chsmack", "-a", label, getUserPkgCertJournalDBPath(), NULL };
ret = pkg_fota_xsystem(argv_certjn);
if (ret == -1) {
+ free(label);
_E("exec : argv_certjn fail");
return -1;
}
return 0;
}
-
int main(int argc, char *argv[])
{
int ret;
if (!__is_authorized()) {
_E("You are not an authorized user!\n");
- return -1;
+ } else {
+ const char *argv_rm[] = { "/bin/rm", getUserPkgParserDBPath(), NULL };
+ pkg_fota_xsystem(argv_rm);
+ const char *argv_rmjn[] = { "/bin/rm", getUserPkgParserJournalDBPath(), NULL };
+ pkg_fota_xsystem(argv_rmjn);
}
/* This is for AIL initializing */
_E("cannot load usr manifest directory.");
}
- ret = pkg_fota_change_perm(PACKAGE_INFO_DB_FILE);
+ ret = pkg_fota_change_perm(getUserPkgParserDBPath());
if (ret == -1) {
_E("cannot chown.");
return -1;
}
- ret = pkg_fota_give_smack();
- if (ret == -1) {
- _E("cannot pkg_fota_give_smack.");
- return -1;
+ ret = pkg_fota_give_smack();
+ if (ret == -1) {
+ _E("cannot pkg_fota_give_smack.");
+ return -1;
+ }
}
-
return 0;
}
#define OPT_MANIFEST_DIRECTORY tzplatform_getenv(TZ_SYS_RW_PACKAGES)
#define USR_MANIFEST_DIRECTORY tzplatform_getenv(TZ_SYS_RO_PACKAGES)
#define PACKAGE_INFO_DB_FILE tzplatform_mkpath(TZ_SYS_DB, ".pkgmgr_parser.db")
+#define PACKAGE_INFO_DB_FILE_JOURNAL tzplatform_mkpath(TZ_SYS_DB, ".pkgmgr_parser.db-journal")
#define PKG_PARSER_DB_FILE tzplatform_mkpath(TZ_SYS_DB, ".pkgmgr_parser.db")
#define PKG_PARSER_DB_FILE_JOURNAL tzplatform_mkpath(TZ_SYS_DB, ".pkgmgr_parser.db-journal")
#define PKG_CERT_DB_FILE tzplatform_mkpath(TZ_SYS_DB, ".pkgmgr_cert.db")
#define PKG_CERT_DB_FILE_JOURNAL tzplatform_mkpath(TZ_SYS_DB, ".pkgmgr_cert.db-journal")
-#define PKG_INFO_DB_LABEL "User"
+#define PKG_INFO_DB_LABEL "System"
#ifdef _E
#undef _E
if (!__is_authorized()) {
_E("You are not an authorized user!\n");
return -1;
+ } else {
+ const char *argv_rm[] = { "/bin/rm", PACKAGE_INFO_DB_FILE, NULL };
+ initdb_xsystem(argv_rm);
+ const char *argv_rmjn[] = { "/bin/rm", PACKAGE_INFO_DB_FILE_JOURNAL, NULL };
+ initdb_xsystem(argv_rmjn);
}
/* This is for AIL initializing */
_E("cannot chown.");
return -1;
}
-
const char *argv_parser[] = { "/usr/bin/chsmack", "-a", PKG_INFO_DB_LABEL, PKG_PARSER_DB_FILE, NULL };
initdb_xsystem(argv_parser);
const char *argv_parserjn[] = { "/usr/bin/chsmack", "-a", PKG_INFO_DB_LABEL, PKG_PARSER_DB_FILE_JOURNAL, NULL };