From cc94b25aa675fc061d456568f60fe56d536a540f Mon Sep 17 00:00:00 2001 From: =?utf8?q?K=C3=A9vin=20THIERRY?= Date: Mon, 27 Jan 2014 17:17:43 +0100 Subject: [PATCH] Add multi-user support MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Bug-Tizen: PTREL-339 Change-Id: I1f6145ffaee1ee2fa80b24bb160e6de9251aec18 Signed-off-by: Kévin THIERRY --- CMakeLists.txt | 2 +- packaging/librua.spec | 11 ++++++----- test/rua-test.c | 5 ++++- 3 files changed, 11 insertions(+), 7 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 5110cfb..29acdc2 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -14,7 +14,7 @@ SET(SRCS INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/include) INCLUDE(FindPkgConfig) -pkg_check_modules(pkgs REQUIRED sqlite3 db-util) +pkg_check_modules(pkgs REQUIRED sqlite3 db-util libtzplatform-config) FOREACH(flag ${pkgs_CFLAGS}) SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}") diff --git a/packaging/librua.spec b/packaging/librua.spec index dc8621e..b19b615 100644 --- a/packaging/librua.spec +++ b/packaging/librua.spec @@ -1,15 +1,16 @@ Name: librua Version: 0.1.0 -Release: 34 +Release: 0 License: Apache-2.0 Summary: Recently used application Group: Application Framework/Libraries Source0: librua-%{version}.tar.gz -Source1001: librua.manifest +Source1001: librua.manifest BuildRequires: cmake BuildRequires: sqlite3 BuildRequires: pkgconfig(db-util) BuildRequires: pkgconfig(sqlite3) +BuildRequires: pkgconfig(libtzplatform-config) %description Recently used application library @@ -31,8 +32,8 @@ make %{?_smp_mflags} %install %make_install -mkdir -p %{buildroot}/opt/dbspace -sqlite3 %{buildroot}/opt/dbspace/.rua.db < data/rua_db.sql +mkdir -p %{buildroot}%{TZ_SYS_DB} +sqlite3 %{buildroot}%{TZ_SYS_DB}/.rua.db < data/rua_db.sql %post -p /sbin/ldconfig @@ -41,7 +42,7 @@ sqlite3 %{buildroot}/opt/dbspace/.rua.db < data/rua_db.sql %files %manifest %{name}.manifest %defattr(-,root,root,-) -%config(noreplace) %attr(0660,root,app) /opt/dbspace/.rua.db* +%config(noreplace) %attr(0660,root,%{TZ_SYS_USER_GROUP}) %{TZ_SYS_DB}/.rua.db* %{_libdir}/librua.so.* %license LICENSE diff --git a/test/rua-test.c b/test/rua-test.c index 6fdd2e0..bcd6913 100644 --- a/test/rua-test.c +++ b/test/rua-test.c @@ -25,6 +25,9 @@ #include #include +/* For multi-user support */ +#include + #include "rua.h" int __add_history(char *pkgname) @@ -33,7 +36,7 @@ int __add_history(char *pkgname) struct rua_rec rec; char apppath[FILENAME_MAX] = ""; - snprintf(apppath, "/opt/apps/%s", pkgname, FILENAME_MAX); + apppath = tzplatform_mkpath(TZ_SYS_RW_APP, pkgname); memset(&rec, 0, sizeof(rec)); rec.pkg_name = pkgname; rec.app_path = apppath; -- 2.7.4