From dd2e8e58306aae5fdf5126e4dd39632f9191b84a Mon Sep 17 00:00:00 2001 From: Jean-Benoit MARTIN Date: Mon, 24 Mar 2014 15:08:39 +0100 Subject: [PATCH] Remove hardcoded path for multiuser support Bug-Tizen: PTREL-311 Change-Id: I2533ea48982f63b24031f540c104ce34ffab908f Signed-off-by: Jean-Benoit MARTIN --- CMakeLists.txt | 2 +- initdb/src/initdb.c | 8 ++++---- packaging/ail.spec | 30 +++++++++++++++--------------- src/ail_private.h | 3 ++- tool/src/ail_fota.c | 8 ++++---- tool/src/initdb.c | 8 ++++---- 6 files changed, 30 insertions(+), 29 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 1a8f40e..cf9de2c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -33,7 +33,7 @@ INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/include) INCLUDE(FindPkgConfig) -pkg_check_modules(LPKGS REQUIRED glib-2.0 sqlite3 dlog db-util xdgmime vconf) +pkg_check_modules(LPKGS REQUIRED glib-2.0 sqlite3 dlog db-util xdgmime vconf libtzplatform-config) STRING(REPLACE ";" " " EXTRA_CFLAGS "${LPKGS_CFLAGS}") SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} -fvisibility=hidden") diff --git a/initdb/src/initdb.c b/initdb/src/initdb.c index e9847d3..4d58945 100755 --- a/initdb/src/initdb.c +++ b/initdb/src/initdb.c @@ -35,10 +35,10 @@ #define OWNER_ROOT 0 #define GROUP_MENU 6010 #define BUFSZE 1024 -#define OPT_DESKTOP_DIRECTORY "/opt/share/applications" -#define USR_DESKTOP_DIRECTORY "/usr/share/applications" -#define APP_INFO_DB_FILE "/opt/dbspace/.app_info.db" -#define APP_INFO_DB_FILE_JOURNAL "/opt/dbspace/.app_info.db-journal" +#define OPT_DESKTOP_DIRECTORY tzplatform_getenv(TZ_SYS_RW_DESKTOP_APP) +#define USR_DESKTOP_DIRECTORY tzplatform_getenv(TZ_SYS_RO_DESKTOP_APP) +#define APP_INFO_DB_FILE tzplatform_mkpath(TZ_SYS_DB,".app_info.db") +#define APP_INFO_DB_FILE_JOURNAL tzplatform_mkpath(TZ_SYS_DB,".app_info.db-journal") #define APP_INFO_DB_LABEL "ail::db" #ifdef _E diff --git a/packaging/ail.spec b/packaging/ail.spec index 18b7c9b..7f061d3 100755 --- a/packaging/ail.spec +++ b/packaging/ail.spec @@ -13,6 +13,7 @@ BuildRequires: pkgconfig(dlog) BuildRequires: pkgconfig(sqlite3) BuildRequires: pkgconfig(vconf) BuildRequires: pkgconfig(xdgmime) +BuildRequires: pkgconfig(libtzplatform-config) Provides: libail = %{version}-%{release} %description @@ -46,8 +47,8 @@ make %{?_smp_mflags} %install %make_install -mkdir -p %{buildroot}/opt/dbspace/ -mkdir -p %{buildroot}/opt/share/applications/ +mkdir -p %{buildroot}%{TZ_SYS_DB}/ +mkdir -p %{buildroot}%{TZ_SYS_RW_DESKTOP_APP}/ %post /sbin/ldconfig @@ -73,34 +74,33 @@ update_DAC_for_db_file() fi } ail_initdb -mkdir -p /usr/share/applications -mkdir -p /opt/share/applications -mkdir -p /opt/dbspace/ +mkdir -p %{TZ_SYS_RO_DESKTOP_APP} +mkdir -p %{TZ_SYS_RW_DESKTOP_APP} +mkdir -p %{TZ_SYS_DB} -update_DAC_for_db_file /opt/dbspace/.app_info.db -update_DAC_for_db_file /opt/dbspace/.app_info.db-journal +update_DAC_for_db_file %{TZ_SYS_DB}/.app_info.db +update_DAC_for_db_file %{TZ_SYS_DB}/.app_info.db-journal %postun /sbin/ldconfig if [ $1 == 0 ]; then -rm -f /opt/dbspace/.app_info.db* +rm -f %{TZ_SYS_DB}/.app_info.db* fi %files %manifest %{name}.manifest %license LICENSE -%dir /opt/share/applications +%dir %{TZ_SYS_RW_DESKTOP_APP} %{_bindir}/ail_initdb +%{_bindir}/ail_initdb +%{_bindir}/ail_fota +%{_bindir}/ail_desktop +%{_bindir}/ail_filter +%{_bindir}/ail_package %{_datadir}/install-info/* %{_libdir}/libail.so.0 %{_libdir}/libail.so.0.1.0 -/usr/bin/ail_initdb -/usr/bin/ail_fota -/usr/bin/ail_desktop -/usr/bin/ail_filter -/usr/bin/ail_package -/usr/share/install-info/* %files devel %manifest %{name}.manifest diff --git a/src/ail_private.h b/src/ail_private.h index 4891c82..efa2f66 100755 --- a/src/ail_private.h +++ b/src/ail_private.h @@ -27,6 +27,7 @@ #include #include +#include #ifndef EXPORT_API #define EXPORT_API __attribute__ ((visibility("default"))) @@ -91,7 +92,7 @@ enum { #define ELEMENT_BOOL(e) ((struct element_bool *)(e)) #define AIL_SQL_QUERY_MAX_LEN 2048 -#define APP_INFO_DB "/opt/dbspace/.app_info.db" +#define APP_INFO_DB tzplatform_mkpath(TZ_SYS_DB,".app_info.db") #define ELEMENT_TYPE(e, t) do { \ if(e->prop >= E_AIL_PROP_STR_MIN && e->prop <= E_AIL_PROP_STR_MAX) t= (int)VAL_TYPE_STR; \ diff --git a/tool/src/ail_fota.c b/tool/src/ail_fota.c index 334388f..3c0dbca 100644 --- a/tool/src/ail_fota.c +++ b/tool/src/ail_fota.c @@ -35,10 +35,10 @@ #define OWNER_ROOT 0 #define GROUP_MENU 6010 #define BUFSZE 1024 -#define OPT_DESKTOP_DIRECTORY "/opt/share/applications" -#define USR_DESKTOP_DIRECTORY "/usr/share/applications" -#define APP_INFO_DB_FILE "/opt/dbspace/.app_info.db" -#define APP_INFO_DB_FILE_JOURNAL "/opt/dbspace/.app_info.db-journal" +#define OPT_DESKTOP_DIRECTORY tzplatform_getenv(TZ_SYS_RW_DESKTOP_APP) +#define USR_DESKTOP_DIRECTORY tzplatform_getenv(TZ_SYS_RO_DESKTOP_APP) +#define APP_INFO_DB_FILE tzplatform_mkpath(TZ_SYS_DB,".app_info.db") +#define APP_INFO_DB_FILE_JOURNAL tzplatform_mkpath(TZ_SYS_DB,".app_info.db-journal") #define APP_INFO_DB_LABEL "ail::db" #ifdef _E diff --git a/tool/src/initdb.c b/tool/src/initdb.c index 1bba847..ff49c9a 100755 --- a/tool/src/initdb.c +++ b/tool/src/initdb.c @@ -35,10 +35,10 @@ #define OWNER_ROOT 0 #define GROUP_MENU 6010 #define BUFSZE 1024 -#define OPT_DESKTOP_DIRECTORY "/opt/share/applications" -#define USR_DESKTOP_DIRECTORY "/usr/share/applications" -#define APP_INFO_DB_FILE "/opt/dbspace/.app_info.db" -#define APP_INFO_DB_FILE_JOURNAL "/opt/dbspace/.app_info.db-journal" +#define OPT_DESKTOP_DIRECTORY tzplatform_getenv(TZ_SYS_RW_DESKTOP_APP) +#define USR_DESKTOP_DIRECTORY tzplatform_getenv(TZ_SYS_RO_DESKTOP_APP) +#define APP_INFO_DB_FILE tzplatform_mkpath(TZ_SYS_DB,".app_info.db") +#define APP_INFO_DB_FILE_JOURNAL tzplatform_mkpath(TZ_SYS_DB,".app_info.db-journal") #define APP_INFO_DB_LABEL "ail::db" #ifdef _E -- 2.7.4