summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjiseob.jang <jiseob.jang@samsung.com>2015-08-18 23:41:21 +0900
committerjiseob.jang <jiseob.jang@samsung.com>2015-08-18 23:41:21 +0900
commit4887c4fc5a5155633737eb27d5242eb3f1ad1d1b (patch)
tree17f70ec03f9a92e8a2846c7f70318ed63ecc036e
parent58b972037b5a434c09e447ee966c8d3d0e37b1aa (diff)
downloadsync-manager-4887c4fc5a5155633737eb27d5242eb3f1ad1d1b.tar.gz
sync-manager-4887c4fc5a5155633737eb27d5242eb3f1ad1d1b.tar.bz2
sync-manager-4887c4fc5a5155633737eb27d5242eb3f1ad1d1b.zip
Change-Id: I7b44cb58a38f7c0233e2fd4643e43db39131516c Signed-off-by: jiseob.jang <jiseob.jang@samsung.com>
-rw-r--r--packaging/org.tizen.sync.conf2
-rw-r--r--packaging/org.tizen.sync.service4
-rw-r--r--packaging/sync-manager.service4
-rw-r--r--packaging/sync-manager.spec36
-rw-r--r--src/sync-client/sync_adapter.c4
-rw-r--r--src/sync-client/sync_manager.c2
-rw-r--r--src/sync-service/CMakeLists.txt14
-rw-r--r--src/sync-service/SyncManager_JsonParser.cpp2
-rw-r--r--src/sync-service/SyncManager_RepositoryEngine.cpp9
-rw-r--r--src/sync-service/SyncManager_SyncManager.cpp10
-rw-r--r--src/sync-service/SyncManager_SyncService.cpp4
-rw-r--r--src/sync-service/main.cpp2
12 files changed, 50 insertions, 43 deletions
diff --git a/packaging/org.tizen.sync.conf b/packaging/org.tizen.sync.conf
index b0ed498..c752a86 100644
--- a/packaging/org.tizen.sync.conf
+++ b/packaging/org.tizen.sync.conf
@@ -7,7 +7,7 @@
<allow send_interface="org.tizen.sync"/>
<allow receive_sender="org.tizen.sync"/>
</policy>
- <policy user="system">
+ <policy smack="User">
<allow own="org.tizen.sync"/>
<allow send_destination="org.tizen.sync"/>
<allow send_interface="org.tizen.sync"/>
diff --git a/packaging/org.tizen.sync.service b/packaging/org.tizen.sync.service
index 59ba5db..8b9aa85 100644
--- a/packaging/org.tizen.sync.service
+++ b/packaging/org.tizen.sync.service
@@ -1,6 +1,4 @@
[D-BUS Service]
Name=org.tizen.sync
Exec=/usr/bin/false
-SystemdService=sync-manager.service
-User=system
-Group=system
+#Exec=/usr/bin/sync-service
diff --git a/packaging/sync-manager.service b/packaging/sync-manager.service
index 225251a..2b02813 100644
--- a/packaging/sync-manager.service
+++ b/packaging/sync-manager.service
@@ -6,8 +6,6 @@ Type=simple
ExecStart=/usr/bin/sync-service
Restart=always
RestartSec=1
-User=system
-Group=system
[Install]
-WantedBy=multi-user.target
+WantedBy=default.target
diff --git a/packaging/sync-manager.spec b/packaging/sync-manager.spec
index 4ac8f1d..b2f090b 100644
--- a/packaging/sync-manager.spec
+++ b/packaging/sync-manager.spec
@@ -72,7 +72,7 @@ sync client provides sync adapter functionality to register sync adapters and to
%setup -q
%build
-_CONTAINER_ENABLE=ON
+_CONTAINER_ENABLE=OFF
cmake \
-DCMAKE_INSTALL_PREFIX=%{_pkgdir} \
@@ -89,17 +89,17 @@ make %{?jobs:-j%jobs}
%install
%make_install
-mkdir -p %{buildroot}%{_unitdir}/multi-user.target.wants
-#install -m 644 %SOURCE1 %{buildroot}%{_unitdir}/sync-manager.service
-ln -s ../sync-manager.service %{buildroot}%{_unitdir}/multi-user.target.wants/sync-manager.service
+mkdir -p %{buildroot}%{_unitdir_user}/default.target.wants
+install -m 644 %SOURCE1 %{buildroot}%{_unitdir_user}/sync-manager.service
+ln -s ../sync-manager.service %{buildroot}%{_unitdir_user}/default.target.wants/sync-manager.service
-mkdir -p %{buildroot}/usr/share/dbus-1/system-services
-install -m 0644 %SOURCE2 %{buildroot}/usr/share/dbus-1/system-services/org.tizen.sync.service
+#mkdir -p %{buildroot}/usr/share/dbus-1/services
+#install -m 0644 %SOURCE2 %{buildroot}/usr/share/dbus-1/services/org.tizen.sync.service
-mkdir -p %{buildroot}%{_sysconfdir}/dbus-1/system.d
-install -m 0644 %SOURCE3 %{buildroot}%{_sysconfdir}/dbus-1/system.d/
+#mkdir -p %{buildroot}%{_sysconfdir}/dbus-1/session.d
+#install -m 0644 %SOURCE3 %{buildroot}%{_sysconfdir}/dbus-1/session.d/
-mkdir -p %{buildroot}%{TZ_SYS_DATA}/sync-manager
+#mkdir -p %{buildroot}%{TZ_SYS_DATA}/sync-manager
%clean
rm -rf %{buildroot}
@@ -108,23 +108,23 @@ rm -rf %{buildroot}
%post -n libcore-sync-client-devel -p /sbin/ldconfig
%post
-chown system:system %{TZ_SYS_DATA}/sync-manager/
-systemctl enable sync-manager.service
-systemctl start sync-manager.service
+#chown system:system %{TZ_SYS_DATA}/sync-manager/
+#systemctl enable sync-manager.service
+#systemctl start sync-manager.service
%postun -n libcore-sync-client -p /sbin/ldconfig
%postun -n libcore-sync-client-devel -p /sbin/ldconfig
%files -n sync-service
%manifest sync-service.manifest
-%defattr(-,system,system,-)
-%config %{_sysconfdir}/dbus-1/system.d/org.tizen.sync.conf
+%defattr(-,root,root,-)
+#%config %{_sysconfdir}/dbus-1/session.d/org.tizen.sync.conf
%{_bindir}/*
#%{_unitdir}/*
-%{TZ_SYS_DATA}/sync-manager/
-%{_unitdir}/sync-manager.service
-%{_unitdir}/multi-user.target.wants/sync-manager.service
-/usr/share/dbus-1/system-services/org.tizen.sync.service
+#%{TZ_SYS_DATA}/sync-manager/
+%{_unitdir_user}/sync-manager.service
+%{_unitdir_user}/default.target.wants/sync-manager.service
+#usr/share/dbus-1/services/org.tizen.sync.service
%files -n libcore-sync-client
%manifest libcore-sync-client.manifest
diff --git a/src/sync-client/sync_adapter.c b/src/sync-client/sync_adapter.c
index 7ad12bc..96688ba 100644
--- a/src/sync-client/sync_adapter.c
+++ b/src/sync-client/sync_adapter.c
@@ -190,7 +190,7 @@ int sync_adapter_init(const char *capability)
GError *error = NULL;
GDBusConnection *connection = NULL;
- connection = g_bus_get_sync(G_BUS_TYPE_SYSTEM, NULL, &error);
+ connection = g_bus_get_sync(G_BUS_TYPE_SESSION, NULL, &error);
SYNC_LOGE_RET_RES(connection != NULL, SYNC_ERROR_IO_ERROR, "tizen_sync_manager_proxy_new_sync failed %s", error->message);
TizenSyncManager *ipcObj = tizen_sync_manager_proxy_new_sync(connection,
@@ -241,7 +241,7 @@ int sync_adapter_set_callbacks(sync_adapter_start_sync_cb on_start_cb, sync_adap
pid_t pid = getpid();
GError *error = NULL;
GDBusConnection *connection = NULL;
- connection = g_bus_get_sync(G_BUS_TYPE_SYSTEM, NULL, &error);
+ connection = g_bus_get_sync(G_BUS_TYPE_SESSION, NULL, &error);
SYNC_LOGE_RET_RES(connection != NULL, SYNC_ERROR_SYSTEM, "System error occured %s", error->message);
char obj_path[50];
diff --git a/src/sync-client/sync_manager.c b/src/sync-client/sync_manager.c
index fbc357b..63a043f 100644
--- a/src/sync-client/sync_manager.c
+++ b/src/sync-client/sync_manager.c
@@ -95,7 +95,7 @@ int sync_manager_connect(void)
GDBusConnection *connection = NULL;
GError *error = NULL;
- connection = g_bus_get_sync(G_BUS_TYPE_SYSTEM, NULL, &error);
+ connection = g_bus_get_sync(G_BUS_TYPE_SESSION, NULL, &error);
TizenSyncManager *ipcObj = tizen_sync_manager_proxy_new_sync(connection,
G_DBUS_PROXY_FLAGS_NONE,
diff --git a/src/sync-service/CMakeLists.txt b/src/sync-service/CMakeLists.txt
index 1b3451c..491479a 100644
--- a/src/sync-service/CMakeLists.txt
+++ b/src/sync-service/CMakeLists.txt
@@ -25,9 +25,9 @@ IF(NOT DEFINED BINDIR)
SET(BINDIR"${PREFIX}/bin")
ENDIF(NOT DEFINED BINDIR)
-IF(NOT DEFINED SYSTEMD_DIR)
- SET(SYSTEMD_DIR "${LIBDIR}/systemd/system")
-ENDIF(NOT DEFINED SYSTEMD_DIR)
+#IF(NOT DEFINED SYSTEMD_DIR)
+# SET(SYSTEMD_DIR "${LIBDIR}/systemd/system")
+#ENDIF(NOT DEFINED SYSTEMD_DIR)
IF(NOT DEFINED INCLUDEDIR)
SET(INCLUDEDIR "${PREFIX}/include")
@@ -103,9 +103,9 @@ SET(PACKAGES
libtzplatform-config
)
-#IF(_SEC_FEATURE_CONTAINER_ENABLE)
-# SET(PACKAGES ${PACKAGES} vasum)
-#ENDIF(_SEC_FEATURE_CONTAINER_ENABLE)
+IF(_SEC_FEATURE_CONTAINER_ENABLE)
+ SET(PACKAGES ${PACKAGES} vasum)
+ENDIF(_SEC_FEATURE_CONTAINER_ENABLE)
pkg_check_modules(PKGS REQUIRED ${PACKAGES})
@@ -135,4 +135,4 @@ ADD_EXECUTABLE(${PROJECT_NAME} ${SRCS} sync-manager-stub.c sync-adapter-stub.c)
TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${PKGS_LDFLAGS} "-ldl")
#TARGET_LINK_LIBRARIES(${PROJECT_NAME} core-sync-client)
INSTALL(TARGETS ${PROJECT_NAME} DESTINATION ${BINDIR})
-INSTALL(FILES ${CMAKE_SOURCE_DIR}/packaging/sync-manager.service DESTINATION ${SYSTEMD_DIR})
+#INSTALL(FILES ${CMAKE_SOURCE_DIR}/packaging/sync-manager.service DESTINATION ${SYSTEMD_DIR})
diff --git a/src/sync-service/SyncManager_JsonParser.cpp b/src/sync-service/SyncManager_JsonParser.cpp
index 9daaa1d..4657502 100644
--- a/src/sync-service/SyncManager_JsonParser.cpp
+++ b/src/sync-service/SyncManager_JsonParser.cpp
@@ -80,7 +80,7 @@ JsonParser::parseAccountData()
gboolean gRet = TRUE;
GError *error = NULL;
// gchar* filename = "/opt/usr/account.json";
- const gchar* filename = tzplatform_mkpath(TZ_SYS_DATA, "sync-manager/account.json");
+ const gchar* filename = tzplatform_mkpath(TZ_USER_DATA, "/sync-manager/account.json");
g_type_init();
diff --git a/src/sync-service/SyncManager_RepositoryEngine.cpp b/src/sync-service/SyncManager_RepositoryEngine.cpp
index d2227c0..936c3b9 100644
--- a/src/sync-service/SyncManager_RepositoryEngine.cpp
+++ b/src/sync-service/SyncManager_RepositoryEngine.cpp
@@ -42,10 +42,11 @@
*/
#define SYNC_DIRECTORY "sync-manager";
-#define PATH_ACCOUNT tzplatform_mkpath(TZ_SYS_DATA,"sync-manager/accounts.xml")
-#define PATH_SYNCJOBS tzplatform_mkpath(TZ_SYS_DATA,"sync-manager/syncjobs.xml")
-#define PATH_SYNCADAPTERS tzplatform_mkpath(TZ_SYS_DATA,"sync-manager/syncadapters.xml")
-#define PATH_STATUS tzplatform_mkpath(TZ_SYS_DATA,"sync-manager/statusinfo.bin")
+#define SYNC_DATA_DIR tzplatform_mkpath(TZ_USER_DATA, "/sync-manager")
+#define PATH_ACCOUNT tzplatform_mkpath(TZ_USER_DATA,"/sync-manager/accounts.xml")
+#define PATH_SYNCJOBS tzplatform_mkpath(TZ_USER_DATA,"/sync-manager/syncjobs.xml")
+#define PATH_SYNCADAPTERS tzplatform_mkpath(TZ_USER_DATA,"/sync-manager/syncadapters.xml")
+#define PATH_STATUS tzplatform_mkpath(TZ_USER_DATA,"/sync-manager/statusinfo.bin")
#ifndef MAX
#define MAX(a, b) a>b?a:b
diff --git a/src/sync-service/SyncManager_SyncManager.cpp b/src/sync-service/SyncManager_SyncManager.cpp
index f08e014..e9258f6 100644
--- a/src/sync-service/SyncManager_SyncManager.cpp
+++ b/src/sync-service/SyncManager_SyncManager.cpp
@@ -20,6 +20,7 @@
*/
#include <sys/time.h>
+#include <sys/stat.h>
#include <map>
#include <set>
#include <climits>
@@ -29,6 +30,7 @@
#include <glib.h>
#include <aul.h>
#include <pkgmgr-info.h>
+#include <tzplatform_config.h>
#include "sync-error.h"
#include "SyncManager_SyncManager.h"
#include "SyncManager_SyncAdapterAggregator.h"
@@ -43,6 +45,8 @@
#define VCONF_HOME_SCREEN "db/setting/homescreen/package_name"
#define VCONF_LOCK_SCREEN "file/private/lockscreen/pkgname"
+#define SYNC_DATA_DIR tzplatform_mkpath(TZ_USER_DATA, "/sync-manager")
+
int DELAY_RETRY_SYNC_IN_PROGRESS_IN_SECONDS = 10;
@@ -799,6 +803,11 @@ SyncManager::Construct(void)
__isStorageLow = (storageState == LOW_MEMORY_NORMAL) ? false : true;
int upsMode;
+
+ if (-1 == access (SYNC_DATA_DIR, F_OK)) {
+ mkdir(SYNC_DATA_DIR, 755);
+ }
+
ret = vconf_get_int(VCONFKEY_SETAPPL_PSMODE, &upsMode);
LOG_LOGE_BOOL(ret == VCONF_OK, "vconf_get_int failed");
__isUPSModeEnabled = (upsMode == SETTING_PSMODE_EMERGENCY) ? true : false;
@@ -866,6 +875,7 @@ SyncManager::Construct(void)
LOG_LOGD("Account connect failed");
Initialize();
+
return true;
}
diff --git a/src/sync-service/SyncManager_SyncService.cpp b/src/sync-service/SyncManager_SyncService.cpp
index f35f74d..c0c4890 100644
--- a/src/sync-service/SyncManager_SyncService.cpp
+++ b/src/sync-service/SyncManager_SyncService.cpp
@@ -85,7 +85,7 @@ SyncService::StartService()
LOG_LOGD("Sync manager construct failed");
}
- return res;
+ return 0;
}
TizenSyncAdapter* adapter;
@@ -735,7 +735,7 @@ OnNameLost (GDBusConnection* pConnection, const gchar* pName, gpointer userData)
static bool
__initialize_dbus()
{
- static guint ownerId = g_bus_own_name (G_BUS_TYPE_SYSTEM,
+ static guint ownerId = g_bus_own_name (G_BUS_TYPE_SESSION,
"org.tizen.sync",
G_BUS_NAME_OWNER_FLAGS_NONE,
OnBusAcquired,
diff --git a/src/sync-service/main.cpp b/src/sync-service/main.cpp
index 49b5b73..20fd4db 100644
--- a/src/sync-service/main.cpp
+++ b/src/sync-service/main.cpp
@@ -93,7 +93,7 @@ main(int argc, char **argv)
DBusError error;
dbus_error_init(&error);
- DBusConnection* pConn = dbus_bus_get(DBUS_BUS_SYSTEM, &error);
+ DBusConnection* pConn = dbus_bus_get(DBUS_BUS_SESSION, &error);
if (dbus_error_is_set(&error))
{