Execute DDL for livebox DB if it is empty.
[platform/framework/web/data-provider-master.git] / packaging / data-provider-master.spec
1 Name: data-provider-master
2 Summary: Master service provider for liveboxes.
3 Version: 0.24.21
4 Release: 1
5 Group: HomeTF/Livebox
6 License: Flora License
7 Source0: %{name}-%{version}.tar.gz
8 BuildRequires: cmake, gettext-tools, smack, coreutils
9 BuildRequires: pkgconfig(ail)
10 BuildRequires: pkgconfig(dlog)
11 BuildRequires: pkgconfig(aul)
12 BuildRequires: pkgconfig(vconf)
13 BuildRequires: pkgconfig(sqlite3)
14 BuildRequires: pkgconfig(db-util)
15 BuildRequires: pkgconfig(glib-2.0)
16 BuildRequires: pkgconfig(gio-2.0)
17 BuildRequires: pkgconfig(libsmack)
18 BuildRequires: pkgconfig(bundle)
19 BuildRequires: pkgconfig(ecore-x)
20 BuildRequires: pkgconfig(ecore)
21 BuildRequires: pkgconfig(evas)
22 BuildRequires: pkgconfig(ecore-evas)
23 BuildRequires: pkgconfig(com-core)
24 BuildRequires: pkgconfig(heynoti)
25 BuildRequires: pkgconfig(libxml-2.0)
26 BuildRequires: pkgconfig(x11)
27 BuildRequires: pkgconfig(libdri2)
28 BuildRequires: pkgconfig(libdrm)
29 BuildRequires: pkgconfig(libtbm)
30 BuildRequires: pkgconfig(xfixes)
31 BuildRequires: pkgconfig(dri2proto)
32 BuildRequires: pkgconfig(xext)
33 BuildRequires: pkgconfig(xdamage)
34 BuildRequires: pkgconfig(pkgmgr)
35 BuildRequires: pkgconfig(livebox-service)
36 BuildRequires: pkgconfig(notification)
37 BuildRequires: pkgconfig(badge)
38 BuildRequires: pkgconfig(shortcut)
39 BuildRequires: pkgconfig(security-server)
40 Requires(post): sys-assert
41 Requires(post): dbus
42
43 %description
44 Manage the 2nd stage livebox service provider and communicate with the viewer application.
45 Keep trace on the life-cycle of the livebox and status of the service providers, viewer applications.
46
47 %prep
48 %setup -q
49
50 %build
51 cmake . -DCMAKE_INSTALL_PREFIX=%{_prefix} -DPRODUCT=private
52
53 CFLAGS="${CFLAGS} -Wall -Winline -Werror" LDFLAGS="${LDFLAGS}" make %{?jobs:-j%jobs}
54
55 %install
56 rm -rf %{buildroot}
57 %make_install
58 mkdir -p %{buildroot}/%{_datarootdir}/license
59 mkdir -p %{buildroot}/opt/usr/share/live_magazine
60 mkdir -p %{buildroot}/opt/usr/share/live_magazine/log
61 mkdir -p %{buildroot}/opt/usr/share/live_magazine/reader
62 mkdir -p %{buildroot}/opt/usr/share/live_magazine/always
63 mkdir -p %{buildroot}/opt/dbspace
64 #mkdir -p %{buildroot}/%{_sysconfdir}/rc.d/rc3.d
65 mkdir -p %{buildroot}/%{_libdir}/systemd/user/tizen-middleware.target.wants
66 touch %{buildroot}/opt/dbspace/.livebox.db
67 touch %{buildroot}/opt/dbspace/.livebox.db-journal
68 #ln -sf %{_sysconfdir}/rc.d/init.d/data-provider-master %{buildroot}/%{_sysconfdir}/rc.d/rc3.d/S99data-provider-master
69 ln -sf %{_libdir}/systemd/user/data-provider-master.service %{buildroot}/%{_libdir}/systemd/user/tizen-middleware.target.wants/data-provider-master.service
70 if [ ! -s ${buildroot}/opt/dbspace/.livebox.db ]; then
71 echo "LiveBox DB file is not exists, initiate it"
72 sqlite3 ${buildroot}/opt/dbspace/.livebox.db <<EOF
73 CREATE TABLE box_size ( pkgid TEXT NOT NULL, size_type INTEGER, preview TEXT, touch_effect INTEGER, need_frame INTEGER, FOREIGN KEY(pkgid) REFERENCES pkgmap(pkgid) ON DELETE CASCADE);
74 CREATE TABLE client (pkgid TEXT PRIMARY KEY NOT NULL, icon TEXT, name TEXT, auto_launch TEXT, pd_size TEXT, content TEXT DEFAULT 'default', nodisplay INTEGER, setup TEXT, mouse_event INTEGER, FOREIGN KEY(pkgid) REFERENCES pkgmap(pkgid) ON DELETE CASCADE);
75 CREATE TABLE groupinfo ( id INTEGER PRIMARY KEY AUTOINCREMENT, cluster TEXT NOT NULL, category TEXT NOT NULL, pkgid TEXT NOT NULL, FOREIGN KEY(pkgid) REFERENCES pkgmap(pkgid) ON DELETE CASCADE);
76 CREATE TABLE groupmap (option_id INTEGER PRIMARY KEY AUTOINCREMENT, id INTEGER, pkgid TEXT NOT NULL, ctx_item TEXT NOT NULL, FOREIGN KEY(id) REFERENCES groupinfo(id), FOREIGN KEY(pkgid) REFERENCES pkgmap(pkgid) ON DELETE CASCADE);
77 CREATE TABLE i18n ( pkgid TEXT NOT NULL, lang TEXT COLLATE NOCASE, name TEXT, icon TEXT, FOREIGN KEY(pkgid) REFERENCES pkgmap(pkgid) ON DELETE CASCADE);
78 CREATE TABLE option ( pkgid TEXT NOT NULL, option_id INTEGER, key TEXT NOT NULL, value TEXT NOT NULL, FOREIGN KEY(option_id) REFERENCES groupmap(option_id), FOREIGN KEY(pkgid) REFERENCES pkgmap(pkgid) ON DELETE CASCADE);
79 CREATE TABLE pkgmap ( pkgid TEXT PRIMARY KEY NOT NULL, appid TEXT, uiapp TEXT, prime INTEGER );
80 CREATE TABLE provider ( pkgid TEXT PRIMARY KEY NOT NULL, network INTEGER, abi TEXT, secured INTEGER, box_type INTEGER, box_src TEXT, box_group TEXT, pd_type INTEGER, pd_src TEXT, pd_group TEXT, libexec TEXT, timeout INTEGER, period TEXT, script TEXT, pinup INTEGER, FOREIGN KEY(pkgid) REFERENCES pkgmap(pkgid) ON DELETE CASCADE);
81 EOF
82 fi
83
84 %pre
85 # Executing the stop script for stopping the service of installed provider (old version)
86 if [ -x %{_sysconfdir}/rc.d/init.d/data-provider-master ]; then
87         %{_sysconfdir}/rc.d/init.d/data-provider-master stop
88 fi
89
90 %post
91 chown 5000:5000 /opt/usr/share/live_magazine
92 chmod 750 /opt/usr/share/live_magazine
93 chown 5000:5000 /opt/usr/share/live_magazine/log
94 chmod 750 /opt/usr/share/live_magazine/log
95 chown 5000:5000 /opt/usr/share/live_magazine/reader
96 chmod 750 /opt/usr/share/live_magazine/reader
97 chown 5000:5000 /opt/usr/share/live_magazine/always
98 chmod 750 /opt/usr/share/live_magazine/always
99 chown 0:5000 /opt/dbspace/.livebox.db
100 chmod 640 /opt/dbspace/.livebox.db
101 chown 0:5000 /opt/dbspace/.livebox.db-journal
102 chmod 640 /opt/dbspace/.livebox.db-journal
103 vconftool set -t bool "memory/data-provider-master/started" 0 -i -u 5000 -f -s system::vconf_system
104 echo "Successfully installed. Please start a daemon again manually"
105 echo "%{_sysconfdir}/init.d/data-provider-master start"
106
107 %files -n data-provider-master
108 %manifest data-provider-master.manifest
109 %defattr(-,root,root,-)
110 %{_sysconfdir}/rc.d/init.d/data-provider-master
111 #%{_sysconfdir}/rc.d/rc3.d/S99data-provider-master
112 %{_bindir}/data-provider-master
113 %{_bindir}/liveinfo
114 %{_prefix}/etc/package-manager/parserlib/*
115 %{_datarootdir}/data-provider-master/*
116 %{_libdir}/systemd/user/data-provider-master.service
117 %{_libdir}/systemd/user/tizen-middleware.target.wants/data-provider-master.service
118 %{_datarootdir}/license/*
119 /opt/usr/share/live_magazine/*
120 /opt/dbspace/.livebox.db
121 /opt/dbspace/.livebox.db-journal
122 /opt/etc/smack/accesses.d/*
123
124 # End of a file