INSTALL(FILES ${CMAKE_BINARY_DIR}/email-service.pc DESTINATION ${LIB_INSTALL_DIR}/pkgconfig)
+INSTALL(PROGRAMS ${CMAKE_CURRENT_SOURCE_DIR}/email-service DESTINATION /etc/rc.d/init.d/)
+
# LICENSE file
INSTALL(FILES ${CMAKE_SOURCE_DIR}/LICENSE.BSD DESTINATION /usr/share/license RENAME email-service)
-INSTALL(FILES ${CMAKE_SOURCE_DIR}/email-service.rule DESTINATION /opt/etc/smack/accesses.d/)
+INSTALL(FILES ${CMAKE_SOURCE_DIR}/email-service.rule DESTINATION ${TZ_SYS_SMACK}/accesses.d/)
-INSTALL(DIRECTORY ${CMAKE_SOURCE_DIR}/res/ DESTINATION /opt/usr/data/email/res/image FILES_MATCHING PATTERN "*.png")
-INSTALL(DIRECTORY ${CMAKE_SOURCE_DIR}/res/ DESTINATION /opt/usr/data/email/res FILES_MATCHING PATTERN "*.sql")
+INSTALL(DIRECTORY ${CMAKE_SOURCE_DIR}/res/ DESTINATION ${TZ_SYS_DATA}/email/res/image FILES_MATCHING PATTERN "*.png")
+INSTALL(DIRECTORY ${CMAKE_SOURCE_DIR}/res/ DESTINATION ${TZ_SYS_DATA}/email/res FILES_MATCHING PATTERN "*.sql")
)
INCLUDE(FindPkgConfig)
-pkg_check_modules(common_pkgs REQUIRED glib-2.0 dlog dbus-1 vconf contacts-service2 uw-imap-toolkit security-server)
+pkg_check_modules(common_pkgs REQUIRED glib-2.0 dlog dbus-1 vconf contacts-service2 uw-imap-toolkit security-server libtzplatform-config)
FOREACH(flag ${common_pkgs_CFLAGS})
SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}")
extern "C"
{
#endif
-
+#include <tzplatform_config.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#define EM_DEBUG_LINE EM_DEBUG_LOG("FUNC[%s : %d]", __FUNCTION__, __LINE__)
#define EM_DEBUG_DB_EXEC(eval, expr, X) if (eval) { EM_DEBUG_LOG X; expr;} else {;}
-#define EM_DEBUG_ERROR_FILE_PATH "/opt/usr/data/email/.email_data/.critical_error.log"
+#define EM_DEBUG_ERROR_FILE_PATH tzplatform_mkpath(TZ_USER_DATA, "email/.email_data/.critical_error.log")
#define EM_DEBUG_CRITICAL_EXCEPTION(format, arg...) \
{\
FILE *fp_error = NULL;\
fclose(fp_error);\
}\
}
-#define EM_DEBUG_ALARM_LOG_FILE_PATH "/opt/usr/data/email/.email_data/.alarm.log"
+#define EM_DEBUG_ALARM_LOG_FILE_PATH tzplatform_mkpath(TZ_USER_DATA, "email/.email_data/.alarm.log")
#define EM_DEBUG_ALARM_LOG(format, arg...) \
{\
FILE *fp_error = NULL;\
#ifndef __EMAIL_INTERNAL_TYPES_H__
#define __EMAIL_INTERNAL_TYPES_H__
+#include <tzplatform_config.h>
#include "email-types.h"
#ifdef __cplusplus
#define DIR_SEPERATOR "/"
#define USERDATA_PATH "/opt/usr"
-#define DATA_PATH "/opt/usr/data"
-#define DB_PATH "/opt/usr/dbspace"
-#define EMAIL_SERVICE_DB_FILE_PATH "/opt/usr/dbspace/.email-service.db"
+#define DATA_PATH tzplatform_getenv(TZ_USER_DATA)
+#define DB_PATH tzplatform_getenv(TZ_USER_DB)
+#define EMAIL_SERVICE_DB_FILE_PATH tzplatform_mkpath(TZ_USER_DB, ".email-service.db")
-#define EMAILPATH DATA_PATH"/email"
-#define MAILHOME DATA_PATH"/email/.email_data"
-#define MAILTEMP MAILHOME"/tmp"
+#define EMAILPATH tzplatform_mkpath(TZ_USER_DATA, "email")
+#define MAILHOME tzplatform_mkpath(TZ_USER_DATA, "email/.email_data")
+#define MAILTEMP tzplatform_mkpath(TZ_USER_DATA, "email/.email_data/tmp")
#define DIRECTORY_PERMISSION 0755
#define MIME_SUBTYPE_DRM_OBJECT "vnd.oma.drm.message"
INCLUDE(FindPkgConfig)
-pkg_check_modules(storage_pkgs REQUIRED drm-client glib-2.0 dlog db-util openssl vconf secure-storage dbus-1 contacts-service2)
+pkg_check_modules(storage_pkgs REQUIRED drm-client glib-2.0 dlog db-util openssl vconf secure-storage dbus-1 contacts-service2 libtzplatform-config)
set(EXTRA_CFLAGS "")
FOREACH(flag ${storage_pkgs_CFLAGS})
INCLUDE(FindPkgConfig)
-pkg_check_modules(core_pkgs REQUIRED glib-2.0 drm-client dlog dbus-1 gthread-2.0 uw-imap-toolkit vconf vconf-internal-keys contacts-service2 secure-storage openssl accounts-svc mm-player mm-session feedback alarm-service notification libcurl libxml-2.0 cert-svc cert-svc-vcore badge capi-appfw-application icu-i18n)
+pkg_check_modules(core_pkgs REQUIRED glib-2.0 drm-client dlog dbus-1 gthread-2.0 uw-imap-toolkit vconf vconf-internal-keys contacts-service2 secure-storage openssl accounts-svc mm-player mm-session feedback alarm-service notification libcurl libxml-2.0 cert-svc cert-svc-vcore badge capi-appfw-application icu-i18n libtzplatform-config)
set(EXTRA_CFLAGS "")
FOREACH(flag ${core_pkgs_CFLAGS})
ADD_DEFINITIONS("-DNEWSSPOOL=\"/var/spool/news\"")
ADD_DEFINITIONS("-DRSHPATH=\"/usr/bin/rsh\"")
ADD_DEFINITIONS("-DMD5ENABLE=\"/etc/cram-md5.pwd\"")
-ADD_DEFINITIONS("-DSSL_CERT_DIRECTORY=\"/opt/etc/ssl/certs\"")
-ADD_DEFINITIONS("-DSSL_KEY_DIRECTORY=\"/opt/etc/ssl/certs\"")
+ADD_DEFINITIONS("-DSSL_CERT_DIRECTORY=\"${TZ_SYS_ETC}/ssl/certs\"")
+ADD_DEFINITIONS("-DSSL_KEY_DIRECTORY=\"${TZ_SYS_ETC}/ssl/certs\"")
ADD_DEFINITIONS("-DCHUNKSIZE=65536")
ADD_DEFINITIONS("-DLOCKPGM=\"\"")
ADD_DEFINITIONS("-DLOCKPGM1=\"/usr/libexec/mlock\"")
* History:
* 2006.08.16 : created
*****************************************************************************/
-
+#include <tzplatform_config.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define EMAIL_CH_SQUARE_BRACKET_S '['
#define EMAIL_CH_SQUARE_BRACKET_E ']'
#define EMAIL_CH_SPACE ' '
-#define EMAIL_NOTI_ICON_PATH EMAILPATH"/res/image/Q02_Notification_email.png"
+#define EMAIL_NOTI_ICON_PATH tzplatform_mkpath(TZ_USER_DATA, "email/res/image/Q02_Notification_email.png")
typedef struct _em_transaction_info_type_t {
int mail_id;
#include <ss_manager.h>
#include <fcntl.h>
#include <db-util.h>
+#include <tzplatform_config.h>
#define __USE_UNIX98
#define __USE_GNU
EM_DEBUG_FUNC_END();
return ret;
}
+int _xsystem(const char *argv[])
+{
+ int status = 0;
+ pid_t pid;
+ pid = fork();
+ switch (pid) {
+ case -1:
+ perror("fork failed");
+ return -1;
+ case 0:
+ /* child */
+ execvp(argv[0], (char *const *)argv);
+ _exit(-1);
+ default:
+ /* parent */
+ break;
+ }
+ if (waitpid(pid, &status, 0) == -1)
+ {
+ perror("waitpid failed");
+ return -1;
+ }
+ if (WIFSIGNALED(status))
+ {
+ perror("signal");
+ return -1;
+ }
+ if (!WIFEXITED(status))
+ {
+ /* shouldn't happen */
+ perror("should not happen");
+ return -1;
+ }
+ return WEXITSTATUS(status);
+}
+#define SCRIPT_INIT_DB "/usr/bin/email-service_init_db.sh"
INTERNAL_FUNC int em_db_open(sqlite3 **sqlite_handle, int *err_code)
{
*err_code = error;
return true;
}
-
+ /*Generate db file*/
+ struct stat sts;
+ ret = stat(EMAIL_SERVICE_DB_FILE_PATH , &sts);
+ if (ret == -1 && errno == ENOENT)
+ {
+ const char *argv_script[] = {"/bin/sh", SCRIPT_INIT_DB, NULL };
+ ret = _xsystem(argv_script);
+ }
/* db open */
EMSTORAGE_PROTECTED_FUNC_CALL(db_util_open(EMAIL_SERVICE_DB_FILE_PATH, sqlite_handle, DB_UTIL_REGISTER_HOOK_METHOD), rc);
if (SQLITE_OK != rc) {
EM_DEBUG_FUNC_END("ret [%d]", ret);
return ret;
}
-
+#define MAILHOME_UTF8 tzplatform_mkpath(TZ_USER_DATA,"email/.email_data/7/348/UTF-8")
INTERNAL_FUNC int emstorage_test(int mail_id, int account_id, char *full_address_to, char *full_address_cc, char *full_address_bcc, int *err_code)
{
_bind_stmt_field_data_string(hStmt, ALIAS_SENDER_IDX_IN_MAIL_TBL, "send_alias", 1, FROM_EMAIL_ADDRESS_LEN_IN_MAIL_TBL);
_bind_stmt_field_data_string(hStmt, ALIAS_RECIPIENT_IDX_IN_MAIL_TBL, "recipient_alias", 1, TO_EMAIL_ADDRESS_LEN_IN_MAIL_TBL);
_bind_stmt_field_data_int(hStmt, BODY_DOWNLOAD_STATUS_IDX_IN_MAIL_TBL, 1);
- _bind_stmt_field_data_string(hStmt, FILE_PATH_PLAIN_IDX_IN_MAIL_TBL, MAILHOME"/7/348/UTF-8", 0, TEXT_1_LEN_IN_MAIL_TBL);
+ _bind_stmt_field_data_string(hStmt, FILE_PATH_PLAIN_IDX_IN_MAIL_TBL, MAILHOME_UTF8, 0, TEXT_1_LEN_IN_MAIL_TBL);
_bind_stmt_field_data_string(hStmt, FILE_PATH_HTML_IDX_IN_MAIL_TBL, "", 0, TEXT_2_LEN_IN_MAIL_TBL);
_bind_stmt_field_data_int(hStmt, MAIL_SIZE_IDX_IN_MAIL_TBL, 4);
_bind_stmt_field_data_char(hStmt, FLAGS_SEEN_FIELD_IDX_IN_MAIL_TBL, 0);
*****************************************************************************/
#ifndef __EMAIL_STORAGE_H__
#define __EMAIL_STORAGE_H__
+#include <tzplatform_config.h>
#ifdef __cplusplus
extern "C"
#include "email-internal-types.h"
#define FIRST_ACCOUNT_ID 1
-#define EMAIL_SERVICE_CREATE_TABLE_QUERY_FILE_PATH "/opt/usr/data/email/res/email-service.sql"
+#define EMAIL_SERVICE_CREATE_TABLE_QUERY_FILE_PATH tzplatform_mkpath(TZ_USER_DATA,"email/res/email-service.sql")
#ifdef __FEATURE_BULK_DELETE_MOVE_UPDATE_REQUEST_OPTI__
MESSAGE(">>> current directory: ${CMAKE_CURRENT_SOURCE_DIR}")
MESSAGE(">>> Build type: ${CMAKE_BUILD_TYPE}")
-ADD_DEFINITIONS("-DSSL_CERT_DIRECTORY=\"/opt/etc/ssl/certs\"")
-ADD_DEFINITIONS("-DSSL_KEY_DIRECTORY=\"/opt/etc/ssl/certs\"")
+ADD_DEFINITIONS("-DSSL_CERT_DIRECTORY=\"${TZ_SYS_ETC}/ssl/certs\"")
+ADD_DEFINITIONS("-DSSL_KEY_DIRECTORY=\"${TZ_SYS_ETC}/ssl/certs\"")
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${VISIBILITY} -fvisibility=hidden")
--- /dev/null
+#!/bin/sh
+
+source /etc/tizen-platform.conf
+
+account_count=$(sqlite3 ${TZ_USER_DB}/.email-service.db "select COUNT(*) from mail_account_tbl")
+if [ "$(echo "$account_count" | cut -c0-1)" == "0" ]
+then
+ echo 'There is no account'
+elif [ "$(echo "$account_count" | cut -c0-1)" == "" ]
+then
+ echo 'DB failure'
+else
+ /usr/bin/email-service &
+fi
%global test_email_app_enabled 0
+
Name: email-service
Summary: E-mail Framework Middleware package
Version: 0.10.101
Source0: %{name}-%{version}.tar.gz
Source1: email.service
Source2: email-service.manifest
+Source3: email-service_init_db.sh
Requires: connman
Suggests: webkit2-efl
Requires(post): /sbin/ldconfig
BuildRequires: pkgconfig(security-server)
BuildRequires: pkgconfig(deviced)
BuildRequires: pkgconfig(icu-i18n)
+BuildRequires: pkgconfig(libtzplatform-config)
+Requires: libtzplatform-config
%description
E-mail Framework Middleware Library/Binary package
export LDFLAGS="${LDFLAGS} -Wl,--hash-style=both -Wl,--rpath=%{_libdir} -Wl,--as-needed"
%cmake . \
+-DTZ_SYS_SMACK=%TZ_SYS_SMACK \
+-DTZ_SYS_DATA=%TZ_SYS_DATA \
+-DTZ_SYS_ETC=%TZ_SYS_ETC \
%if %{test_email_app_enabled}
-DTEST_APP_SUPPORT=On
%endif
%install
mkdir -p %{buildroot}/usr/share/license
+if [ -d %{_datarootdir}/license/email-service]; then
+ rm -rf %{_datarootdir}/license/email-service
+fi
%make_install
mkdir -p %{buildroot}/usr/lib/systemd/user/tizen-middleware.target.wants
install -m 0644 %SOURCE1 %{buildroot}/usr/lib/systemd/user/
ln -sf ../email.service %{buildroot}/usr/lib/systemd/user/tizen-middleware.target.wants/
-
+install -m 0775 %{SOURCE3} %{buildroot}%{_bindir}/
%post
/sbin/ldconfig
#################################################################
-# Add preset account information
-#################################################################
-echo "[EMAIL-SERVICE] Start adding preset account information..."
-
-################################################################################################
-
-# for active sync
-vconftool set -t int db/email_handle/active_sync_handle "0" -g 6514 -s "email::vconf_active_sync_handle"
-
-# for default mail slot szie
-vconftool set -t int db/private/email-service/slot_size "100" -g 6514 -s "email::vconf_slot_size"
-
-# for latest mail id
-vconftool set -t int db/private/email-service/latest_mail_id "0" -g 6514 -s "email::vconf_latest_mail_id"
-
-# for default account id
-vconftool set -t int db/private/email-service/default_account_id "0" -g 6514 -s "email::vconf_default_account_id"
-
-# for default account id
-vconftool set -t int memory/sync/email "0" -i -g 6514 -s "email::vconf_sync_status"
-
-# for priority send
-vconftool set -t string db/private/email-service/noti_ringtone_path "/opt/usr/share/settings/Alerts/Over the horizon.mp3" -g 6514 -s "email::vconf_ringtone_path"
-vconftool set -t int db/private/email-service/noti_rep_type "0" -g 6514 -s "email::vconf_rep_type"
-vconftool set -t bool db/private/email-service/noti_notification_ticker "0" -g 6514 -s "email::vconf_notification"
-vconftool set -t bool db/private/email-service/noti_display_content_ticker "0" -g 6514 -s "email::vconf_display_content"
-vconftool set -t bool db/private/email-service/noti_badge_ticker "0" -i -g 6514 -s "email::vconf_bagdge"
-vconftool set -t int db/private/email-service/noti_private_id/1 "0" -i -g 6514
-vconftool set -t int db/private/email-service/noti_private_id/2 "0" -i -g 6514
-vconftool set -t int db/private/email-service/noti_private_id/3 "0" -i -g 6514
-vconftool set -t int db/private/email-service/noti_private_id/4 "0" -i -g 6514
-vconftool set -t int db/private/email-service/noti_private_id/5 "0" -i -g 6514
-vconftool set -t int db/private/email-service/noti_private_id/6 "0" -i -g 6514
-vconftool set -t int db/private/email-service/noti_private_id/7 "0" -i -g 6514
-vconftool set -t int db/private/email-service/noti_private_id/8 "0" -i -g 6514
-vconftool set -t int db/private/email-service/noti_private_id/9 "0" -i -g 6514
-vconftool set -t int db/private/email-service/noti_private_id/10 "0" -i -g 6514
-vconftool set -t bool db/private/email-service/noti_vibration_status "0" -g 6514 -s "email::vconf_vibration"
-vconftool set -t bool db/private/email-service/noti_vip_vibration_status "0" -g 6514 -s "email::vconf_vip_vibration"
-vconftool set -t bool db/private/email-service/noti_use_default_ringtone "1" -g 6514 -s "email::vconf_use_default_ringtone"
-vconftool set -t bool db/private/email-service/noti_vip_use_default_ringtone "1" -g 6514 -s "email::vconf_vip_use_default_ringtone"
-
-
-#################################################################
# Set executin script
#################################################################
echo "[EMAIL-SERVICE] Set executing script ..."
+mkdir -p %{buildroot}/etc/rc.d/rc3.d/
+mkdir -p %{buildroot}/etc/rc.d/rc5.d/
EMAIL_SERVICE_EXEC_SCRIPT=/etc/rc.d/init.d/email-service
EMAIL_SERVICE_BOOT_SCRIPT=/etc/rc.d/rc3.d/S70email-service
EMAIL_SERVICE_FASTBOOT_SCRIPT=/etc/rc.d/rc5.d/S70email-service
-echo '#!/bin/sh' > ${EMAIL_SERVICE_EXEC_SCRIPT}
-echo 'account_count=$(sqlite3 /opt/usr/dbspace/.email-service.db "select COUNT(*) from mail_account_tbl")' >> ${EMAIL_SERVICE_EXEC_SCRIPT}
-echo 'if [ "$(echo "$account_count" | cut -c0-1)" == "0" ]' >> ${EMAIL_SERVICE_EXEC_SCRIPT}
-echo 'then' >> ${EMAIL_SERVICE_EXEC_SCRIPT}
-echo ' echo 'There is no account'' >> ${EMAIL_SERVICE_EXEC_SCRIPT}
-echo 'elif [ "$(echo "$account_count" | cut -c0-1)" == "" ]' >> ${EMAIL_SERVICE_EXEC_SCRIPT}
-echo 'then' >> ${EMAIL_SERVICE_EXEC_SCRIPT}
-echo ' echo 'DB failure'' >> ${EMAIL_SERVICE_EXEC_SCRIPT}
-echo 'else' >> ${EMAIL_SERVICE_EXEC_SCRIPT}
-echo ' /usr/bin/email-service & ' >> ${EMAIL_SERVICE_EXEC_SCRIPT}
-echo 'fi' >> ${EMAIL_SERVICE_EXEC_SCRIPT}
+
chmod 755 ${EMAIL_SERVICE_EXEC_SCRIPT}
rm -rf ${EMAIL_SERVICE_BOOT_SCRIPT}
rm -rf ${EMAIL_SERVICE_FASTBOOT_SCRIPT}
ln -s ${EMAIL_SERVICE_EXEC_SCRIPT} ${EMAIL_SERVICE_FASTBOOT_SCRIPT}
echo "[EMAIL-SERVICE] Finish executing script ..."
-#################################################################
-# Create DB file and tables.
-#################################################################
-echo "[EMAIL-SERVICE] Creating Email Tables ..."
-mkdir -p /opt/usr
-mkdir -p /opt/usr/dbspace
-
-sqlite3 /opt/usr/dbspace/.email-service.db 'PRAGMA journal_mode = PERSIST;'
-sqlite3 /opt/usr/dbspace/.email-service.db < /opt/usr/data/email/res/email-service.sql
-
-echo "[EMAIL-SERVICE] Finish Creating Email Tables."
-
-chgrp 6006 /opt/usr/dbspace/.email-service.db*
-chmod 664 /opt/usr/dbspace/.email-service.db
-chmod 664 /opt/usr/dbspace/.email-service.db-journal
-
-mkdir -m775 -p /opt/usr/data/email/.email_data
-chgrp 6006 /opt/usr/data/email/.email_data
-chsmack -a 'email-service' /opt/usr/data/email/.email_data
-
-mkdir -m775 -p /opt/usr/data/email/.email_data/tmp
-chgrp 6006 /opt/usr/data/email/.email_data/tmp
-chsmack -a 'email-service' /opt/usr/data/email/.email_data/tmp
-
-mkdir -p /opt/share/cert-svc/certs/trusteduser/email
-chgrp 6006 /opt/share/cert-svc/certs/trusteduser/email
-
-if [ -f /opt/usr/dbspace/.email-service.db ]
-then
- chsmack -a 'email-service::db' /opt/usr/dbspace/.email-service.db*
-fi
+chgrp %TZ_SYS_USER_GROUP %{_bindir}/email-service_init_db.sh
systemctl daemon-reload
if [ $1 == 1 ]; then
%files
%manifest email-service.manifest
%if %{test_email_app_enabled}
-/usr/bin/email-test-app
+%{_bindir}/email-test-app
%endif
+%{TZ_SYS_DATA}/email/res/*
%{_bindir}/email-service
-/opt/usr/data/email/res/*
%{_libdir}/lib*.so.*
%{_libdir}/libemail-core-sound.so
%{_libdir}/libemail-core-sound.so.*
%{_unitdir_user}/tizen-middleware.target.wants/email.service
%{_datarootdir}/dbus-1/services/email-service.service
%{_datarootdir}/license/email-service
-
-/opt/etc/smack/accesses.d/email-service.rule
+%attr(0755,root,root) /etc/rc.d/init.d/email-service
+%{TZ_SYS_SMACK}/accesses.d/email-service.rule
+%{_bindir}/email-service_init_db.sh
%files devel
%{_includedir}/email-service/*.h
--- /dev/null
+#!/bin/sh
+source /etc/tizen-platform.conf
+
+#################################################################
+# Add preset account information
+#################################################################
+echo "[EMAIL-SERVICE] Start adding preset account information..."
+
+################################################################################################
+MP3_PATH=$TZ_USER_SHARE/settings/Alerts/Over the horizon.mp
+# for active sync
+vconftool set -t int db/email_handle/active_sync_handle "0" -g 6514 -s "email::vconf_active_sync_handle"
+
+# for default mail slot szie
+vconftool set -t int db/private/email-service/slot_size "100" -g 6514 -s "email::vconf_slot_size"
+
+# for latest mail id
+vconftool set -t int db/private/email-service/latest_mail_id "0" -g 6514 -s "email::vconf_latest_mail_id"
+
+# for default account id
+vconftool set -t int db/private/email-service/default_account_id "0" -g 6514 -s "email::vconf_default_account_id"
+
+# for default account id
+vconftool set -t int memory/sync/email "0" -i -g 6514 -s "email::vconf_sync_status"
+
+# for priority send
+vconftool set -t string db/private/email-service/noti_ringtone_path "3" -g 6514 -s "email::vconf_ringtone_path"
+vconftool set -t int db/private/email-service/noti_rep_type "0" -g 6514 -s "email::vconf_rep_type"
+vconftool set -t bool db/private/email-service/noti_notification_ticker "0" -g 6514 -s "email::vconf_notification"
+vconftool set -t bool db/private/email-service/noti_display_content_ticker "0" -g 6514 -s "email::vconf_display_content"
+vconftool set -t bool db/private/email-service/noti_badge_ticker "0" -i -g 6514 -s "email::vconf_bagdge"
+vconftool set -t int db/private/email-service/noti_private_id/1 "0" -i -g 6514
+vconftool set -t int db/private/email-service/noti_private_id/2 "0" -i -g 6514
+vconftool set -t int db/private/email-service/noti_private_id/3 "0" -i -g 6514
+vconftool set -t int db/private/email-service/noti_private_id/4 "0" -i -g 6514
+vconftool set -t int db/private/email-service/noti_private_id/5 "0" -i -g 6514
+vconftool set -t int db/private/email-service/noti_private_id/6 "0" -i -g 6514
+vconftool set -t int db/private/email-service/noti_private_id/7 "0" -i -g 6514
+vconftool set -t int db/private/email-service/noti_private_id/8 "0" -i -g 6514
+vconftool set -t int db/private/email-service/noti_private_id/9 "0" -i -g 6514
+vconftool set -t int db/private/email-service/noti_private_id/10 "0" -i -g 6514
+vconftool set -t bool db/private/email-service/noti_vibration_status "0" -g 6514 -s "email::vconf_vibration"
+vconftool set -t bool db/private/email-service/noti_vip_vibration_status "0" -g 6514 -s "email::vconf_vip_vibration"
+vconftool set -t bool db/private/email-service/noti_use_default_ringtone "1" -g 6514 -s "email::vconf_use_default_ringtone"
+vconftool set -t bool db/private/email-service/noti_vip_use_default_ringtone "1" -g 6514 -s "email::vconf_vip_use_default_ringtone"
+
+
+#################################################################
+# Create DB file and tables.
+#################################################################
+echo "[EMAIL-SERVICE] Creating Email Tables ..."
+mkdir -p /opt/usr
+mkdir -p ${TZ_USER_DB}
+
+mv ${TZ_SYS_DATA}/email/res/email-service.sql ${TZ_USER_DATA}/email/res/
+mv ${TZ_SYS_DATA}/email/res/image/Q02_Notification_email.png ${TZ_USER_DATA}/email/res/
+sqlite3 ${TZ_USER_DB}/.email-service.db 'PRAGMA journal_mode = PERSIST;'
+sqlite3 ${TZ_USER_DB}/.email-service.db < ${TZ_USER_DATA}/email/res/email-service.sql
+
+echo "[EMAIL-SERVICE] Finish Creating Email Tables."
+
+chgrp 6006 ${TZ_USER_DB}/.email-service.db*
+chmod 664 ${TZ_USER_DB}/.email-service.db
+chmod 664 ${TZ_USER_DB}/.email-service.db-journal
+
+mkdir -m775 -p ${TZ_USER_DATA}/email/.email_data
+chgrp 6006 ${TZ_USER_DATA}/email/.email_data
+chsmack -a 'email-service' ${TZ_USER_DATA}/email/.email_data
+
+mkdir -m775 -p ${TZ_USER_DATA}/email/.email_data/tmp
+chgrp 6006 ${TZ_USER_DATA}/email/.email_data/tmp
+chsmack -a 'email-service' ${TZ_USER_DATA}/email/.email_data/tmp
+
+mkdir -p ${TZ_SYS_SHARE}/cert-svc/certs/trusteduser/email
+chgrp 6006 ${TZ_SYS_SHARE}/cert-svc/certs/trusteduser/email
+
+if [ -f ${TZ_USER_DB}/.email-service.db ]
+then
+ chsmack -a 'email-service::db' ${TZ_USER_DB}/.email-service.db*
+fi
+
+