remove hardcoded path for multiuser support 51/16451/2 accepted/tizen_3.0.2014.q3_common accepted/tizen_3.0.m14.3_ivi tizen_3.0.2014.q3_common tizen_3.0.m14.2_ivi tizen_3.0.m14.3_ivi accepted/tizen/ivi/20140627.154733 submit/tizen_common/20140521.163740 submit/tizen_common/20140522.130648 submit/tizen_common/20140522.135644 submit/tizen_ivi/20140618.000000 submit/tizen_ivi/20140618.000001 submit/tizen_ivi/20140619.000000 submit/tizen_ivi/20140622.000000 submit/tizen_ivi/20140623.000000 submit/tizen_ivi/20140624.064036 submit/tizen_ivi/20140626.125712 submit/tizen_ivi/20140626.130032 submit/tizen_ivi/20140626.144348 tizen_3.0.2014.q3_common_release tizen_3.0.m14.2_ivi_release tizen_3.0.m14.3_ivi_release
authorJean-Benoit MARTIN <jean-benoit.martin@open.eurogiciel.org>
Fri, 7 Feb 2014 13:45:02 +0000 (14:45 +0100)
committerJean-Benoit MARTIN <jean-benoit.martin@open.eurogiciel.org>
Tue, 8 Apr 2014 07:56:39 +0000 (09:56 +0200)
Bug-Tizen: PTREL-295

Change-Id: Ia834e7aefdad357cac3e1d8092afd730d4faa4aa
Signed-off-by: Jean-Benoit MARTIN <jean-benoit.martin@open.eurogiciel.org>
CMakeLists.txt
include/notification_db.h
notification_DB_init.sh [new file with mode: 0644]
packaging/notification.spec
src/notification_setting.c

index fe012ea..4c230df 100755 (executable)
@@ -6,7 +6,6 @@ SET(EXEC_PREFIX "\${prefix}")
 SET(LIBDIR ${LIB_INSTALL_DIR})
 SET(INCLUDEDIR "\${prefix}/include/${PROJECT_NAME}")
 SET(ICONDIR "${PREFIX}/share/${PROJECT_NAME}")
-SET(DBDIR "/opt/dbspace")
 SET(DBFILE ".notification.db")
 SET(MAJOR_VER 0)
 SET(VERSION ${MAJOR_VER}.1.0)
@@ -51,6 +50,7 @@ pkg_check_modules(pkgs REQUIRED
        com-core
        ecore
        eina
+       libtzplatform-config
 )
 
 FOREACH(flag ${pkgs_CFLAGS})
@@ -64,7 +64,6 @@ SET(CMAKE_SKIP_BUILD_RPATH TRUE)
 
 ADD_DEFINITIONS("-DPREFIX=\"${PREFIX}\"")
 ADD_DEFINITIONS("-DICONDIR=\"${ICONDIR}\"")
-ADD_DEFINITIONS("-DDBDIR=\"${DBDIR}\"")
 ADD_DEFINITIONS("-DDBFILE=\"${DBFILE}\"")
 
 ADD_LIBRARY(${PROJECT_NAME} SHARED ${SRCS})
@@ -81,8 +80,9 @@ FOREACH(hfile ${HEADERS-DEVEL})
 ENDFOREACH(hfile)
 
 CONFIGURE_FILE(${PROJECT_NAME}-service.pc.in ${PROJECT_NAME}-service.pc @ONLY)
-INSTALL(FILES ${CMAKE_BINARY_DIR}/${PROJECT_NAME}-service.pc DESTINATION lib/pkgconfig)
+INSTALL(FILES ${CMAKE_BINARY_DIR}/${PROJECT_NAME}-service.pc DESTINATION ${LIB_INSTALL_DIR}/pkgconfig)
 
 FOREACH(hfile ${HEADERS-SERVICE-DEVEL})
        INSTALL(FILES ${CMAKE_SOURCE_DIR}/${hfile} DESTINATION include/${PROJECT_NAME}/service)
 ENDFOREACH(hfile)
+INSTALL(FILES ${CMAKE_SOURCE_DIR}/notification_DB_init.sh DESTINATION ${SHARE_INSTALL_PREFIX}/${PROJECT_NAME})
index c9e3f79..fb9b2d5 100755 (executable)
 
 #include <bundle.h>
 #include <sqlite3.h>
-
-#ifndef DBDIR
-#error "DBDIR not defined"
-#endif
+#include <tzplatform_config.h>
 
 #ifndef DBFILE
 #error "DBFILE not defined"
 #endif
 
-#define DBPATH DBDIR"/"DBFILE
+#define DBPATH tzplatform_mkpath(TZ_SYS_DB,DBFILE)
 
 #define NOTIFICATION_QUERY_MAX 4096
 
diff --git a/notification_DB_init.sh b/notification_DB_init.sh
new file mode 100644 (file)
index 0000000..d815f61
--- /dev/null
@@ -0,0 +1,100 @@
+#!/bin/sh
+
+source /etc/tizen-platform.conf
+
+if [ ! -d $TZ_SYS_DB ]
+then
+       mkdir $TZ_SYS_DB
+fi
+
+if [ ! -f $TZ_SYS_DB/.notification.db ]
+then
+       sqlite3 $TZ_SYS_DB/.notification.db 'PRAGMA journal_mode = PERSIST;
+               create  table if not exists noti_list (
+                       type INTEGER NOT NULL,
+                       layout INTEGER NOT NULL default 0,
+                       caller_pkgname TEXT NOT NULL,
+                       launch_pkgname TEXT,
+                       image_path TEXT,
+                       group_id INTEGER default 0,
+                       internal_group_id INTEGER default 0,
+                       priv_id INTERGER NOT NULL,
+                       title_key TEXT,
+                       b_text TEXT,
+                       b_key TEXT,
+                       b_format_args TEXT,
+                       num_format_args INTEGER default 0,
+                       text_domain TEXT,
+                       text_dir TEXT,
+                       time INTEGER default 0,  
+                       insert_time INTEGER default 0,
+                       args TEXT,
+                       group_args TEXT,
+                       b_execute_option TEXT,
+                       b_service_responding TEXT,
+                       b_service_single_launch TEXT,
+                       b_service_multi_launch TEXT,
+                       sound_type INTEGER default 0,
+                       sound_path TEXT,
+                       vibration_type INTEGER default 0,
+                       vibration_path TEXT,
+                       led_operation INTEGER default 0,
+                       led_argb INTEGER default 0,
+                       led_on_ms INTEGER default -1,
+                       led_off_ms INTEGER default -1,
+                       flags_for_property INTEGER default 0,
+                       flag_simmode INTEGER default 0,
+                       display_applist INTEGER,
+                       progress_size DOUBLE default 0,
+                       progress_percentage DOUBLE default 0,
+                       rowid INTEGER PRIMARY KEY AUTOINCREMENT,
+                       UNIQUE (caller_pkgname, priv_id)  
+               );
+               create table if not exists noti_group_data (
+                       caller_pkgname TEXT NOT NULL,
+                       group_id INTEGER default 0,
+                       badge INTEGER default 0,
+                       title TEXT,
+                       content TEXT,
+                       loc_title TEXT,
+                       loc_content TEXT,
+                       count_display_title INTEGER,
+                       count_display_content INTEGER,
+                       rowid INTEGER PRIMARY KEY AUTOINCREMENT,
+                       UNIQUE (caller_pkgname, group_id)
+               );
+               create  table if not exists ongoing_list (
+                       caller_pkgname TEXT NOT NULL,
+                       launch_pkgname TEXT,
+                       icon_path TEXT,
+                       group_id INTEGER default 0,
+                       internal_group_id INTEGER default 0,
+                       priv_id INTERGER NOT NULL,
+                       title TEXT,
+                       content TEXT,
+                       default_content TEXT,
+                       loc_title TEXT,
+                       loc_content TEXT,
+                       loc_default_content TEXT,
+                       text_domain TEXT,
+                       text_dir TEXT,
+                       args TEXT,
+                       group_args TEXT,
+                       flag INTEGER default 0,
+                       progress_size DOUBLE default 0,
+                       progress_percentage DOUBLE default 0,
+                       rowid INTEGER PRIMARY KEY AUTOINCREMENT,
+                       UNIQUE (caller_pkgname, priv_id)
+               );
+       '
+fi
+
+users_gid=$(getent group $TZ_SYS_USER_GROUP | cut -f3 -d':')
+
+chown :$TZ_SYS_USER_GROUP $TZ_SYS_DB/.notification.db
+chown :$TZ_SYS_USER_GROUP $TZ_SYS_DB/.notification.db-journal
+chmod 640 $TZ_SYS_DB/.notification.db
+chmod 640 $TZ_SYS_DB/.notification.db-journal
+chsmack -a 'notification::db' $TZ_SYS_DB/.notification.db*
+SMACK_OPTION="-s system::vconf_misc"
+vconftool set -t string memory/private/libstatus/message "" -i -g $users_gid -f  $SMACK_OPTION
index 24a8523..a84edd5 100755 (executable)
@@ -20,6 +20,8 @@ BuildRequires: pkgconfig(dbus-glib-1)
 BuildRequires: pkgconfig(com-core)
 BuildRequires: pkgconfig(ecore)
 BuildRequires: pkgconfig(eina)
+BuildRequires: pkgconfig(libtzplatform-config)
+Requires:      libtzplatform-config
 
 BuildRequires: cmake
 Requires(post): /sbin/ldconfig
@@ -65,101 +67,7 @@ rm -rf %{buildroot}
 
 %post
 /sbin/ldconfig
-
-if [ ! -d /opt/dbspace ]
-then
-       mkdir /opt/dbspace
-fi
-
-if [ ! -f /opt/dbspace/.notification.db ]
-then
-       sqlite3 /opt/dbspace/.notification.db 'PRAGMA journal_mode = PERSIST;
-               create  table if not exists noti_list ( 
-                       type INTEGER NOT NULL,
-                       layout INTEGER NOT NULL default 0,
-                       caller_pkgname TEXT NOT NULL,
-                       launch_pkgname TEXT,
-                       image_path TEXT,
-                       group_id INTEGER default 0,  
-                       internal_group_id INTEGER default 0,  
-                       priv_id INTERGER NOT NULL,  
-                       title_key TEXT,
-                       b_text TEXT,
-                       b_key TEXT,
-                       b_format_args TEXT,
-                       num_format_args INTEGER default 0,
-                       text_domain TEXT,
-                       text_dir TEXT,
-                       time INTEGER default 0,  
-                       insert_time INTEGER default 0,  
-                       args TEXT,  
-                       group_args TEXT,  
-                       b_execute_option TEXT,
-                       b_service_responding TEXT,
-                       b_service_single_launch TEXT,
-                       b_service_multi_launch TEXT,
-                       sound_type INTEGER default 0,
-                       sound_path TEXT,
-                       vibration_type INTEGER default 0,
-                       vibration_path TEXT,
-                       led_operation INTEGER default 0,
-                       led_argb INTEGER default 0,
-                       led_on_ms INTEGER default -1,
-                       led_off_ms INTEGER default -1,
-                       flags_for_property INTEGER default 0,
-                       flag_simmode INTEGER default 0,
-                       display_applist INTEGER,
-                       progress_size DOUBLE default 0,
-                       progress_percentage DOUBLE default 0,
-                       rowid INTEGER PRIMARY KEY AUTOINCREMENT,        
-                       UNIQUE (caller_pkgname, priv_id)  
-               ); 
-               create table if not exists noti_group_data (
-                       caller_pkgname TEXT NOT NULL,
-                       group_id INTEGER default 0,
-                       badge INTEGER default 0,
-                       title TEXT,
-                       content TEXT,
-                       loc_title TEXT,
-                       loc_content TEXT,
-                       count_display_title INTEGER,
-                       count_display_content INTEGER,
-                       rowid INTEGER PRIMARY KEY AUTOINCREMENT,
-                       UNIQUE (caller_pkgname, group_id)
-               );
-               create  table if not exists ongoing_list ( 
-                       caller_pkgname TEXT NOT NULL,
-                       launch_pkgname TEXT,
-                       icon_path TEXT,
-                       group_id INTEGER default 0,
-                       internal_group_id INTEGER default 0,  
-                       priv_id INTERGER NOT NULL,
-                       title TEXT,
-                       content TEXT,
-                       default_content TEXT,
-                       loc_title TEXT,
-                       loc_content TEXT,
-                       loc_default_content TEXT,
-                       text_domain TEXT,
-                       text_dir TEXT,
-                       args TEXT,  
-                       group_args TEXT,  
-                       flag INTEGER default 0,
-                       progress_size DOUBLE default 0,
-                       progress_percentage DOUBLE default 0,
-                       rowid INTEGER PRIMARY KEY AUTOINCREMENT,        
-                       UNIQUE (caller_pkgname, priv_id)  
-               ); 
-       '
-fi
-
-chown :5000 /opt/dbspace/.notification.db
-chown :5000 /opt/dbspace/.notification.db-journal
-chmod 640 /opt/dbspace/.notification.db
-chmod 640 /opt/dbspace/.notification.db-journal
-chsmack -a 'notification::db' /opt/dbspace/.notification.db*
-SMACK_OPTION="-s system::vconf_misc"
-vconftool set -t string memory/private/libstatus/message "" -i -g 5000 -f  $SMACK_OPTION
+%{_datadir}/%{name}/notification_DB_init.sh
 
 %postun -p /sbin/ldconfig
 
@@ -167,6 +75,7 @@ vconftool set -t string memory/private/libstatus/message "" -i -g 5000 -f  $SMAC
 %manifest notification.manifest
 %defattr(-,root,root,-)
 %{_libdir}/libnotification.so*
+%attr(0755,root,root) %{_datadir}/%{name}/notification_DB_init.sh
 /usr/share/license/%{name}
 
 %files devel
index 6fac097..69aca51 100755 (executable)
 #include <notification_ipc.h>
 #include <notification_setting.h>
 #include <notification_internal.h>
+#include <tzplatform_config.h>
 
 #define NOTIFICATION_SETTING_DB "notification_setting"
-#define NOTIFICATION_SETTING_DB_PATH "/opt/usr/dbspace/.notification_parser.db"
+#define NOTIFICATION_SETTING_DB_PATH tzplatform_mkpath(TZ_USER_DB,".notification_parser.db")
 
 struct _notification_setting_h {
        char *appid;