Add libSimpleDbus, libLogger, libConfig source code to Vasum.
[platform/core/security/vasum.git] / packaging / vasum.spec
1 %define script_dir %{_sbindir}
2 # Vasum Server's user info - it should already exist in the system
3 %define vsm_user          security-containers
4 # The group that has read and write access to /dev/input/event* devices.
5 # It may vary between platforms.
6 %define input_event_group input
7 # The group has access to /dev/loop* devices.
8 %define disk_group disk
9 # The group that has write access to /dev/tty* devices.
10 %define tty_group tty
11
12 Name:           vasum
13 Version:        0.1.1
14 Release:        0
15 Source0:        %{name}-%{version}.tar.gz
16 License:        Apache-2.0
17 Group:          Security/Other
18 Summary:        Daemon for managing zones
19 BuildRequires:  cmake
20 BuildRequires:  boost-devel
21 BuildRequires:  libjson-devel >= 0.10
22 BuildRequires:  libcap-ng-devel
23 BuildRequires:  lxc-devel
24 BuildRequires:  pkgconfig(glib-2.0)
25 BuildRequires:  pkgconfig(libsystemd-journal)
26 BuildRequires:  pkgconfig(libsystemd-daemon)
27 BuildRequires:  pkgconfig(sqlite3)
28 Requires(post): libcap-tools
29 Requires:       bridge-utils
30
31 %description
32 This package provides a daemon used to manage zones - start, stop and switch
33 between them. A process from inside a zone can request a switch of context
34 (display, input devices) to the other zone.
35
36 %files
37 %manifest packaging/vasum.manifest
38 %defattr(644,root,root,755)
39 %attr(755,root,root) %{_bindir}/vasum-server
40 %dir /etc/vasum
41 %dir /etc/vasum/zones
42 %dir /etc/vasum/lxc-templates
43 %dir /etc/vasum/templates
44 %config /etc/vasum/daemon.conf
45 %attr(755,root,root) /etc/vasum/lxc-templates/*.sh
46 %config /etc/vasum/templates/*.conf
47 %{_unitdir}/vasum.service
48 %{_unitdir}/vasum.socket
49 %{_unitdir}/multi-user.target.wants/vasum.service
50 %config /etc/dbus-1/system.d/org.tizen.vasum.host.conf
51 %dir %{_datadir}/.zones
52
53 %prep
54 %setup -q
55
56 %build
57 %{!?build_type:%define build_type "RELEASE"}
58
59 %if %{build_type} == "DEBUG" || %{build_type} == "PROFILING"
60     CFLAGS="$CFLAGS -Wp,-U_FORTIFY_SOURCE"
61     CXXFLAGS="$CXXFLAGS -Wp,-U_FORTIFY_SOURCE"
62 %endif
63
64 %cmake . -DVERSION=%{version} \
65          -DCMAKE_BUILD_TYPE=%{build_type} \
66          -DSCRIPT_INSTALL_DIR=%{script_dir} \
67          -DSYSTEMD_UNIT_DIR=%{_unitdir} \
68          -DDATA_DIR=%{_datadir} \
69          -DPYTHON_SITELIB=%{python_sitelib} \
70          -DVASUM_USER=%{vsm_user} \
71          -DINPUT_EVENT_GROUP=%{input_event_group} \
72          -DDISK_GROUP=%{disk_group} \
73          -DTTY_GROUP=%{tty_group}
74 make -k %{?jobs:-j%jobs}
75
76 %install
77 %make_install
78 mkdir -p %{buildroot}/%{_unitdir}/multi-user.target.wants
79 ln -s ../vasum.service %{buildroot}/%{_unitdir}/multi-user.target.wants/vasum.service
80 mkdir -p %{buildroot}/%{_datadir}/.zones
81
82 %clean
83 rm -rf %{buildroot}
84
85 %post
86 # Refresh systemd services list after installation
87 if [ $1 == 1 ]; then
88     systemctl daemon-reload || :
89 fi
90 # set needed caps on the binary to allow restart without loosing them
91 setcap CAP_SYS_ADMIN,CAP_MAC_OVERRIDE,CAP_SYS_TTY_CONFIG+ei %{_bindir}/vasum-server
92
93 %preun
94 # Stop the service before uninstall
95 if [ $1 == 0 ]; then
96      systemctl stop vasum.service || :
97 fi
98
99 %postun
100 # Refresh systemd services list after uninstall/upgrade
101 systemctl daemon-reload || :
102 if [ $1 -ge 1 ]; then
103     # TODO: at this point an appropriate notification should show up
104     eval `systemctl show vasum --property=MainPID`
105     if [ -n "$MainPID" -a "$MainPID" != "0" ]; then
106         kill -USR1 $MainPID
107     fi
108     echo "Vasum updated. Reboot is required for the changes to take effect..."
109 else
110     echo "Vasum removed. Reboot is required for the changes to take effect..."
111 fi
112
113 ## Client Package ##############################################################
114 %package client
115 Summary:          Vasum Client
116 Group:            Development/Libraries
117 Requires:         vasum = %{version}-%{release}
118 Requires(post):   /sbin/ldconfig
119 Requires(postun): /sbin/ldconfig
120
121 %description client
122 Library interface to the vasum daemon
123
124 %files client
125 %manifest packaging/libvasum-client.manifest
126 %defattr(644,root,root,755)
127 %attr(755,root,root) %{_libdir}/libvasum.so.0.0.1
128 %{_libdir}/libvasum.so.0
129
130 %post client -p /sbin/ldconfig
131
132 %postun client -p /sbin/ldconfig
133
134
135 ## Devel Package ###############################################################
136 %package devel
137 Summary:          Vasum Client Devel
138 Group:            Development/Libraries
139 Requires:         vasum = %{version}-%{release}
140 Requires:         vasum-client = %{version}-%{release}
141
142 %description devel
143 Development package including the header files for the client library
144
145 %files devel
146 %manifest packaging/vasum.manifest
147 %defattr(644,root,root,755)
148 %{_libdir}/libvasum.so
149 %{_includedir}/vasum
150 %{_libdir}/pkgconfig/*.pc
151
152
153 ## Zone Support Package ###################################################
154 # TODO move to a separate repository
155 %package zone-support
156 Summary:          Vasum Support
157 Group:            Security/Other
158
159 %description zone-support
160 Zones support installed inside every zone.
161
162 %files zone-support
163 %manifest packaging/vasum-zone-support.manifest
164 %defattr(644,root,root,755)
165 %config /etc/dbus-1/system.d/org.tizen.vasum.zone.conf
166
167
168 ## Zone Daemon Package ####################################################
169 # TODO move to a separate repository
170 %package zone-daemon
171 Summary:          Vasum Zones Daemon
172 Group:            Security/Other
173 Requires:         vasum-zone-support = %{version}-%{release}
174
175 %description zone-daemon
176 Daemon running inside every zone.
177
178 %files zone-daemon
179 %manifest packaging/vasum-zone-daemon.manifest
180 %defattr(644,root,root,755)
181 %attr(755,root,root) %{_bindir}/vasum-zone-daemon
182 %config /etc/dbus-1/system.d/org.tizen.vasum.zone.daemon.conf
183
184
185 ## Command Line Interface ######################################################
186 %package cli
187 Summary:          Vasum Command Line Interface
188 Group:            Security/Other
189 Requires:         vasum-client = %{version}-%{release}
190
191 %description cli
192 Command Line Interface for vasum.
193
194 %files cli
195 %defattr(644,root,root,755)
196 %attr(755,root,root) %{_bindir}/vasum-cli
197
198 %package cli-completion
199 Summary:          Vasum Command Line Interface bash completion
200 Group:            Security/Other
201 Requires:         vasum-cli = %{version}-%{release}
202 #Requires:         bash-completion
203
204 %description cli-completion
205 Command Line Interface bash completion.
206
207 %files cli-completion
208 %attr(755,root,root) %{_sysconfdir}/bash_completion.d/vasum-cli-completion.sh
209
210 ## Test Package ################################################################
211 %package tests
212 Summary:          Vasum Tests
213 Group:            Development/Libraries
214 Requires:         vasum = %{version}-%{release}
215 Requires:         vasum-client = %{version}-%{release}
216 Requires:         python
217 Requires:         python-xml
218 Requires:         boost-test
219
220 %description tests
221 Unit tests for both: server and client and integration tests.
222
223 %post tests
224 systemctl daemon-reload
225 systemctl enable vasum-socket-test.socket
226 systemctl start vasum-socket-test.socket
227
228 %preun tests
229 systemctl stop vasum-socket-test.socket
230 systemctl disable vasum-socket-test.socket
231
232 %postun tests
233 systemctl daemon-reload
234
235 %files tests
236 %manifest packaging/vasum-server-tests.manifest
237 %defattr(644,root,root,755)
238 %attr(755,root,root) %{_bindir}/vasum-server-unit-tests
239 %attr(755,root,root) %{_bindir}/vasum-socket-test
240 %attr(755,root,root) %{script_dir}/vsm_all_tests.py
241 %attr(755,root,root) %{script_dir}/vsm_int_tests.py
242 %attr(755,root,root) %{script_dir}/vsm_launch_test.py
243 %{script_dir}/vsm_test_parser.py
244 %config /etc/vasum/tests
245 %attr(755,root,root) /etc/vasum/tests/lxc-templates
246 %{python_sitelib}/vsm_integration_tests
247 %config /etc/dbus-1/system.d/org.tizen.vasum.tests.conf
248 %{_unitdir}/vasum-socket-test.socket
249 %{_unitdir}/vasum-socket-test.service