Add multi-user support.
[platform/core/pim/libaccounts-svc.git] / packaging / libaccounts-svc.spec
index 8d78dc2..080941a 100755 (executable)
@@ -3,10 +3,11 @@ Name:       libaccounts-svc
 Summary:    Account DB library
 Version:    0.2.52
 Release:    1
-Group:      TO_BE/FILLED_IN
+Group:      Social & Content/Utilities
 License:    Apache-2.0
 Source0:    libaccounts-svc-%{version}.tar.gz
 Source1001:    libaccounts-svc.manifest
+Source1002:     accounts_DB.sh
 
 BuildRequires:  cmake
 BuildRequires:  pkgconfig(glib-2.0)
@@ -18,6 +19,8 @@ BuildRequires:  pkgconfig(capi-appfw-application)
 BuildRequires:  pkgconfig(libxml-2.0)
 BuildRequires:  pkgconfig(pkgmgr-info)
 BuildRequires:  pkgconfig(aul)
+BuildRequires:  pkgconfig(libtzplatform-config)
+Requires: libtzplatform-config
 Requires(post): /sbin/ldconfig
 Requires(post): /usr/bin/sqlite3
 Requires(postun): /sbin/ldconfig
@@ -27,14 +30,13 @@ Account DB libraryXB-Public-Package: no
 
 %package devel
 Summary:    Development files for %{name}
-Group:      Development/Libraries
 Requires:   %{name} = %{version}-%{release}
 %description devel
 Development files for %{name}
 
 %prep
 %setup -q
-cp %{SOURCE1001} .
+cp %{SOURCE1001} %{SOURCE1002} .
 
 %build
 export CFLAGS="${CFLAGS} -fPIC -fvisibility=hidden"
@@ -46,39 +48,15 @@ make %{?jobs:-j%jobs}
 rm -rf %{buildroot}
 %make_install
 
+install -D -m 0750 %{SOURCE1002} %{buildroot}%{_datadir}/%{name}/accounts_DB.sh
+
 rm -rf %{buildroot}%{_libdir}/accounts-svc
 
 %post
+
 /sbin/ldconfig
-if [ ! -d /opt/dbspace ]
-then
-        mkdir -p /opt/dbspace
-fi
-if [ ! -f /opt/dbspace/.account.db ]
-#rm -rf /opt/dbspace/.account.db*
-then
-       sqlite3 /opt/dbspace/.account.db 'PRAGMA journal_mode = PERSIST;
-        CREATE TABLE if not exists label (AppId TEXT, Label TEXT, Locale TEXT);
-        CREATE TABLE if not exists account_type (_id INTEGER PRIMARY KEY AUTOINCREMENT, AppId TEXT,
-        ServiceProviderId TEXT, IconPath TEXT, SmallIconPath TEXT, MultipleAccountSupport INT);
-        CREATE TABLE if not exists account_custom (AccountId INTEGER, AppId TEXT, Key TEXT, Value TEXT);
-        CREATE TABLE if not exists account (_id INTEGER PRIMARY KEY AUTOINCREMENT, user_name TEXT, email_address TEXT, display_name TEXT, icon_path TEXT,
-        source TEXT, package_name TEXT, access_token TEXT, domain_name TEXT, auth_type INTEGER, secret INTEGER, sync_support INTEGER,
-        txt_custom0 TEXT, txt_custom1 TEXT, txt_custom2 TEXT, txt_custom3 TEXT, txt_custom4 TEXT,
-        int_custom0 INTEGER, int_custom1 INTEGER, int_custom2 INTEGER, int_custom3 INTEGER, int_custom4 INTEGER);
-        CREATE TABLE if not exists capability (_id INTEGER PRIMARY KEY AUTOINCREMENT, key TEXT, value INTEGER,
-        package_name TEXT, user_name TEXT,  account_id INTEGER, FOREIGN KEY (account_id) REFERENCES account(_id));
-       CREATE TABLE if not exists provider_feature (app_id TEXT, key TEXT);'
-fi
-
-mkdir -p /opt/usr/share/account
-chown 5000:5000 /opt/dbspace/.account.db
-chown 5000:5000 /opt/dbspace/.account.db-journal
-chown 5000:5000 /opt/usr/share/account
-
-chmod 660 /opt/dbspace/.account.db
-chmod 660 /opt/dbspace/.account.db-journal
-chmod 755 /opt/usr/share/account
+%{_datadir}/%{name}/accounts_DB.sh
+
 
 #set message key value to NULL
 vconftool set -t string db/account/msg '' -g 6514
@@ -91,6 +69,7 @@ vconftool set -t string db/account/msg '' -g 6514
 %defattr(-,root,root,-)
 %{_libdir}/*.so.*
 %{_bindir}/account-xml-verify
+%{_datadir}/%{name}/accounts_DB.sh
 
 %files devel
 %manifest %{name}.manifest
@@ -98,4 +77,5 @@ vconftool set -t string db/account/msg '' -g 6514
 %{_libdir}/*.so
 %{_libdir}/pkgconfig/accounts-svc.pc
 %{_includedir}/*.h
+%{_datadir}/%{name}/accounts_DB.sh
 %{_bindir}/account-xml-verify