From: Kévin THIERRY Date: Tue, 18 Mar 2014 07:56:30 +0000 (+0100) Subject: Add multi-user support X-Git-Tag: accepted/tizen/ivi/panda/20140403.015126^0 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=86928fe02c0c455d4873815ffc11acc0c418e45e;p=platform%2Fcore%2Fappfw%2Fapp2sd.git Add multi-user support The DB was considered a system/global DB so this patch doesn't change that. If the DB is meant to be a per user DB, "TZ_SYS_DB" will need to be replaced with "TZ_USER_DB". Also set a valid group tag. Bug-Tizen: PTREL-327 Change-Id: I2006c70cde18e55aadcc0006dad87776e721c231 Signed-off-by: Kévin THIERRY --- diff --git a/inc/app2ext_interface.h b/inc/app2ext_interface.h index 2177ddc..8b932d4 100755 --- a/inc/app2ext_interface.h +++ b/inc/app2ext_interface.h @@ -51,6 +51,10 @@ extern "C" { #include #include + +/* For multi-user support */ +#include + #ifdef LOG_TAG #undef LOG_TAG #endif @@ -66,7 +70,7 @@ extern "C" { #define APP2EXT_SUCCESS 0 #define MMC_PATH "/opt/storage/sdcard" #define APP2SD_PATH MMC_PATH"/app2sd/" -#define APP_INSTALLATION_PATH "/opt/usr/apps/" +#define APP_INSTALLATION_PATH tzplatform_mkpath(TZ_USER_APP, "") /** * Enum for application installation location diff --git a/packaging/app2sd.spec b/packaging/app2sd.spec index f139eaa..ceec704 100755 --- a/packaging/app2sd.spec +++ b/packaging/app2sd.spec @@ -1,8 +1,8 @@ Name: app2sd Summary: Application installation on external memory Version: 0.5.27 -Release: 1 -Group: Application Framework/Application Installer +Release: 0 +Group: Application Framework/Package Management License: Apache-2.0 Source0: %{name}-%{version}.tar.gz Source1001: app2sd.manifest @@ -14,6 +14,7 @@ BuildRequires: pkgconfig(libssl) BuildRequires: pkgconfig(openssl) BuildRequires: pkgconfig(pkgmgr-info) BuildRequires: pkgconfig(vconf) +BuildRequires: pkgconfig(libtzplatform-config) %description Tizen application installation on external memory diff --git a/plugin/app2sd/CMakeLists.txt b/plugin/app2sd/CMakeLists.txt index fa4aaea..05e885a 100755 --- a/plugin/app2sd/CMakeLists.txt +++ b/plugin/app2sd/CMakeLists.txt @@ -3,7 +3,7 @@ PROJECT(app2sd C) ### Required packages INCLUDE(FindPkgConfig) -pkg_check_modules(pkgs REQUIRED libssl dlog openssl db-util pkgmgr-info vconf) +pkg_check_modules(pkgs REQUIRED libssl dlog openssl db-util pkgmgr-info vconf libtzplatform-config) FOREACH(flag ${pkgs_CFLAGS}) SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}") diff --git a/plugin/app2sd/inc/app2sd_interface.h b/plugin/app2sd/inc/app2sd_interface.h index a59cb9a..ad4ff65 100755 --- a/plugin/app2sd/inc/app2sd_interface.h +++ b/plugin/app2sd/inc/app2sd_interface.h @@ -58,7 +58,7 @@ extern "C" { * It should be called before actual installation is done. * @pre vfat type sd card must be present. * @post Installation is done by package installer. - Encryption password is saved in db /opt/dbspace/.app2sd.db + Encryption password is saved in db TZ_SYS_DB/.app2sd.db * @param[in] appname application package name * [Ex: com.samsung.calculator] *This entry is parsed from application package control/manifest file. diff --git a/plugin/app2sd/src/app2sd_interface.c b/plugin/app2sd/src/app2sd_interface.c index 86b48e7..089cd12 100755 --- a/plugin/app2sd/src/app2sd_interface.c +++ b/plugin/app2sd/src/app2sd_interface.c @@ -29,8 +29,11 @@ #include #include +/* For multi-user support */ +#include + #define MAX_BUF_LEN 1024 -#define APP2SD_TMP_PATH "/opt/usr/apps/tmp" +#define APP2SD_TMP_PATH tzplatform_mkpath(TZ_USER_APP, "tmp") int app2sd_pre_app_install(const char *pkgid, GList* dir_list, int size) diff --git a/plugin/app2sd/src/app2sd_internals_registry.c b/plugin/app2sd/src/app2sd_internals_registry.c index 4f9c57e..991c5aa 100755 --- a/plugin/app2sd/src/app2sd_internals_registry.c +++ b/plugin/app2sd/src/app2sd_internals_registry.c @@ -34,6 +34,10 @@ #include #include #include + +/* For multi-user support */ +#include + #define MAX_QUERY_LEN 4096 #define PASSWORD_LENGTH 64 /* @@ -41,7 +45,7 @@ */ /*sqlite db code*/ -#define APP2SD_DB_FILE "/opt/dbspace/.app2sd.db" +#define APP2SD_DB_FILE tzplatform_mkpath(TZ_SYS_DB, ".app2sd.db") sqlite3 *app2sd_db; #define QUERY_CREATE_TABLE_APP2SD "create table app2sd \ (pkgid text primary key,\