From 16dd30cb7b9c86bc5744ff170f45683d5c76ac0c Mon Sep 17 00:00:00 2001 From: =?utf8?q?K=C3=A9vin=20THIERRY?= Date: Thu, 13 Feb 2014 14:24:16 +0100 Subject: [PATCH] Add multi-user support MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Bug-Tizen: PTREL-271 Change-Id: I65b0d09ba91e9d072358d50950f31bd31c22c143 Signed-off-by: Kévin THIERRY --- CMakeLists.txt | 3 + include/common/common_define_internal.h | 7 ++- oma-ds-agent.manifest => oma-ds-agent.manifest.in | 2 +- oma-ds-agent.service | 3 +- ...{omads_fw_config.xml => omads_fw_config.xml.in} | 2 +- packaging/oma-ds-agent.spec | 68 +++++++++++----------- src/agent/CMakeLists.txt | 1 + 7 files changed, 46 insertions(+), 40 deletions(-) rename oma-ds-agent.manifest => oma-ds-agent.manifest.in (55%) mode change 100755 => 100644 rename oma-ds-cfg/{omads_fw_config.xml => omads_fw_config.xml.in} (96%) diff --git a/CMakeLists.txt b/CMakeLists.txt index a247e15..2839847 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -10,6 +10,9 @@ SET(PLUGINDIR "${PREFIX}/lib/${PROJECT_NAME}") SET(VERSION "0.1.66") SET(VERSION_MAJOR "0") +CONFIGURE_FILE(oma-ds-cfg/omads_fw_config.xml.in oma-ds-cfg/omads_fw_config.xml) +CONFIGURE_FILE(oma-ds-agent.manifest.in oma-ds-agent.manifest) + # pass macro defition to source files ADD_DEFINITIONS("-DPREFIX=\"${PREFIX}\"") ADD_DEFINITIONS("-DPLUGINDIR=\"${PLUGINDIR}\"") diff --git a/include/common/common_define_internal.h b/include/common/common_define_internal.h index 7187d27..e07e9d1 100755 --- a/include/common/common_define_internal.h +++ b/include/common/common_define_internal.h @@ -29,6 +29,9 @@ #include #include +/* For multi-user support */ +#include + /* #define COMMUNICATION_TYPE SYNC_AGENT_PB_ENCODING_XML */ #define COMMUNICATION_TYPE SYNC_AGENT_PB_ENCODING_WBXML_12 @@ -43,8 +46,8 @@ #define DEFINE_PLATFORM 1 #define LOW_BATTERY_LEVEL 10 -#define OMA_DS_MSG_PATH "/opt/usr/data/oma-ds/debug_msg" -#define OMA_DS_CSC_CHECK_PATH "/opt/usr/data/oma-ds/csc_check" +#define OMA_DS_MSG_PATH tzplatform_mkpath3(TZ_USER_DATA, "oma-ds", "debug_msg") +#define OMA_DS_CSC_CHECK_PATH tzplatform_mkpath3(TZ_USER_DATA, "oma-ds", "csc_check") #define ELEMENT_TEXT_VCARD "text/x-vcard" #define ELEMENT_TEXT_VCARD_30 "text/vcard" diff --git a/oma-ds-agent.manifest b/oma-ds-agent.manifest.in old mode 100755 new mode 100644 similarity index 55% rename from oma-ds-agent.manifest rename to oma-ds-agent.manifest.in index 2a338a6..df241e2 --- a/oma-ds-agent.manifest +++ b/oma-ds-agent.manifest.in @@ -3,6 +3,6 @@ - + diff --git a/oma-ds-agent.service b/oma-ds-agent.service index fe86da5..34d0387 100644 --- a/oma-ds-agent.service +++ b/oma-ds-agent.service @@ -4,7 +4,8 @@ After=calendar.service contacts-service.service pushd.service msg-service.servic [Service] #Type=forking -ConditionPathExists=/opt/usr/data/oma-ds/.oma-ds-agent-enabled +EnvironmentFile=/etc/tizen-platform.conf +ConditionPathExists=$TZ_USER_DATA/oma-ds/.oma-ds-agent-enabled ExecStart=/usr/bin/oma-ds-agent [Install] diff --git a/oma-ds-cfg/omads_fw_config.xml b/oma-ds-cfg/omads_fw_config.xml.in similarity index 96% rename from oma-ds-cfg/omads_fw_config.xml rename to oma-ds-cfg/omads_fw_config.xml.in index 96efbba..a60ff17 100644 --- a/oma-ds-cfg/omads_fw_config.xml +++ b/oma-ds-cfg/omads_fw_config.xml.in @@ -15,7 +15,7 @@ 5 - /opt/dbspace/.omasyncagent.db + @TZ_SYS_DB@/.omasyncagent.db 1 diff --git a/packaging/oma-ds-agent.spec b/packaging/oma-ds-agent.spec index 9cf9177..7531831 100755 --- a/packaging/oma-ds-agent.spec +++ b/packaging/oma-ds-agent.spec @@ -1,25 +1,26 @@ Name: oma-ds-agent Summary: OMA-DS Agent Daemon for Data Synchronization Version: 0.1.66 -Release: 1 +Release: 0 Group: Base/Device Management License: Apache-2.0 Source0: %{name}-%{version}.tar.gz -Requires(post): /sbin/ldconfig +Requires(post): /sbin/ldconfig Requires(postun): /sbin/ldconfig -BuildRequires: pkgconfig(glib-2.0) -BuildRequires: pkgconfig(libsoup-2.4) -BuildRequires: pkgconfig(sqlite3) -BuildRequires: pkgconfig(sync-agent) -BuildRequires: pkgconfig(vconf) -BuildRequires: pkgconfig(dbus-glib-1) -BuildRequires: pkgconfig(check) -BuildRequires: pkgconfig(memo) -BuildRequires: pkgconfig(contacts-service2) -BuildRequires: pkgconfig(dlog) -BuildRequires: pkgconfig(aul) -BuildRequires: expat-devel -BuildRequires: cmake +BuildRequires: pkgconfig(glib-2.0) +BuildRequires: pkgconfig(libsoup-2.4) +BuildRequires: pkgconfig(sqlite3) +BuildRequires: pkgconfig(sync-agent) +BuildRequires: pkgconfig(vconf) +BuildRequires: pkgconfig(dbus-glib-1) +BuildRequires: pkgconfig(check) +BuildRequires: pkgconfig(memo) +BuildRequires: pkgconfig(contacts-service2) +BuildRequires: pkgconfig(dlog) +BuildRequires: pkgconfig(aul) +BuildRequires: pkgconfig(libtzplatform-config) +BuildRequires: expat-devel +BuildRequires: cmake %description @@ -38,19 +39,19 @@ ds public plugins for sync-agent %build -cmake . -DCMAKE_INSTALL_PREFIX=%{_prefix} +%cmake . -DCMAKE_INSTALL_PREFIX=%{_prefix} -DTZ_SYS_DB=%TZ_SYS_DB make %{?jobs:-j%jobs} %install rm -rf %{buildroot} -if [ ! -d %{buildroot}/opt/dbspace ] +if [ ! -d %{buildroot}%{TZ_SYS_DB} ] then - mkdir -p %{buildroot}/opt/dbspace + mkdir -p %{buildroot}%{TZ_SYS_DB} fi -sqlite3 %{buildroot}/opt/dbspace/.omasyncagent.db "PRAGMA journal_mode = PERSIST; create table a(a); drop table a;" > /dev/null +sqlite3 %{buildroot}%{TZ_SYS_DB}/.omasyncagent.db "PRAGMA journal_mode = PERSIST; create table a(a); drop table a;" > /dev/null %make_install @@ -59,44 +60,41 @@ rm -rf %{buildroot} %post -if [ ! -d /opt/dbspace ] +if [ ! -d %{TZ_SYS_DB} ] then - mkdir /opt/dbspace + mkdir %{TZ_SYS_DB} fi -if [ ! -d /etc/rc.d/rc3.d ] +if [ ! -d %{_sysconfdir}/rc.d/rc3.d ] then - mkdir /etc/rc.d/rc3.d + mkdir %{_sysconfdir}/rc.d/rc3.d fi -if [ ! -d /etc/rc.d/rc5.d ] +if [ ! -d %{_sysconfdir}/rc.d/rc5.d ] then - mkdir /etc/rc.d/rc5.d + mkdir %{_sysconfdir}/rc.d/rc5.d fi -%preun - - %postun rm -f /tmp/agent_fw_event_omads* rm -f /tmp/agent_fw_noti_reply_omads* -rm -f /etc/rc.d/rc3.d/S91oma-ds-agent -rm -f /etc/rc.d/rc5.d/S91oma-ds-agent +rm -f %{_sysconfdir}/rc.d/rc3.d/S91oma-ds-agent +rm -f %{_sysconfdir}/rc.d/rc5.d/S91oma-ds-agent -rm -f /opt/dbspace/.omasyncagent.db /opt/dbspace/.omasyncagent.db-journal +rm -f %{TZ_SYS_DB}/.omasyncagent.db %{TZ_SYS_DB}/.omasyncagent.db-journal rm -rf /usr/share/oma-ds-cfg %files -%attr(600,root,root) /opt/dbspace/.omasyncagent.db -%attr(600,root,root) /opt/dbspace/.omasyncagent.db-journal +%attr(600,root,root) %{TZ_SYS_DB}/.omasyncagent.db +%attr(600,root,root) %{TZ_SYS_DB}/.omasyncagent.db-journal %manifest oma-ds-agent.manifest %defattr(-,root,root,-) /usr/share/dbus-1/system-services/com.samsung.omadsagent.service -/usr/bin/oma-ds-agent +%{_bindir}/oma-ds-agent /usr/share/oma-ds-cfg/* @@ -104,7 +102,7 @@ rm -rf /usr/share/oma-ds-cfg %defattr(644,root,root) /usr/lib/systemd/system/oma-ds-agent.service /usr/lib/systemd/system/graphical.target.wants/oma-ds-agent.service -/etc/dbus-1/system.d/com.samsung.omadsagent.conf +%{_sysconfdir}/dbus-1/system.d/com.samsung.omadsagent.conf %files -n ds-public-plugins %manifest ds-public-plugins.manifest diff --git a/src/agent/CMakeLists.txt b/src/agent/CMakeLists.txt index ee1ea32..6b20644 100755 --- a/src/agent/CMakeLists.txt +++ b/src/agent/CMakeLists.txt @@ -24,6 +24,7 @@ pkg_check_modules(LPKGS REQUIRED dlog aul dbus-glib-1 + libtzplatform-config ) ############################################# -- 2.7.4