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.
11 # Default platform is Tizen, setup Fedora with --define 'platform_type FEDORA'
12 %{!?platform_type:%define platform_type "TIZEN"}
13 # Default build with dbus
14 %{!?without_dbus:%define without_dbus 0}
15 # Default build with systemd
16 %{!?without_systemd:%define without_systemd 0}
22 Source0: %{name}-%{version}.tar.gz
25 Summary: Daemon for managing zones
27 BuildRequires: boost-devel
28 BuildRequires: pkgconfig(glib-2.0)
29 BuildRequires: lxc-devel
30 BuildRequires: readline-devel
31 BuildRequires: pkgconfig(sqlite3)
33 %if !%{without_systemd}
34 BuildRequires: pkgconfig(libsystemd-daemon)
35 BuildRequires: pkgconfig(libsystemd-journal)
37 %if %{platform_type} == "TIZEN"
38 BuildRequires: libjson-devel >= 0.10
40 Requires(post): libcap-tools
42 BuildRequires: json-c-devel
43 Requires: lxc-templates
45 Requires(post): libcap
47 Conflicts: vasum-daemon < 1:0
50 This package provides a daemon used to manage zones - start, stop and switch
51 between them. A process from inside a zone can request a switch of context
52 (display, input devices) to the other zone.
55 %if %{platform_type} == "TIZEN"
56 %manifest packaging/vasum.manifest
58 %defattr(644,root,root,755)
59 %attr(755,root,root) %{_bindir}/vasum-server
60 %attr(755,root,root) %{_sbindir}/vasum-check-config
62 %dir /etc/vasum/templates
63 %config /etc/vasum/daemon.conf
64 %attr(755,root,root) /etc/vasum/templates/*.sh
65 %config /etc/vasum/templates/*.conf
66 %if !%{without_systemd}
67 %{_unitdir}/vasum.service
68 %{_unitdir}/vasum.socket
69 %{_unitdir}/multi-user.target.wants/vasum.service
72 %config /etc/dbus-1/system.d/org.tizen.vasum.host.conf
74 %dir %{_datadir}/zones
80 %{!?build_type:%define build_type "RELEASE"}
82 %if %{build_type} == "DEBUG" || %{build_type} == "PROFILING" || %{build_type} == "CCOV"
83 CFLAGS="$CFLAGS -Wp,-U_FORTIFY_SOURCE"
84 CXXFLAGS="$CXXFLAGS -Wp,-U_FORTIFY_SOURCE"
87 %cmake . -DVERSION=%{version} \
88 -DCMAKE_BUILD_TYPE=%{build_type} \
89 -DSCRIPT_INSTALL_DIR=%{script_dir} \
90 -DSYSTEMD_UNIT_DIR=%{_unitdir} \
91 -DDATA_DIR=%{_datadir} \
92 -DPYTHON_SITELIB=%{python_sitelib} \
93 -DVASUM_USER=%{vsm_user} \
94 -DINPUT_EVENT_GROUP=%{input_event_group} \
95 -DDISK_GROUP=%{disk_group} \
96 -DTTY_GROUP=%{tty_group} \
97 -DWITHOUT_DBUS=%{?without_dbus} \
98 -DWITHOUT_SYSTEMD=%{?without_systemd}
99 make -k %{?jobs:-j%jobs}
103 %if !%{without_systemd}
104 mkdir -p %{buildroot}/%{_unitdir}/multi-user.target.wants
105 ln -s ../vasum.service %{buildroot}/%{_unitdir}/multi-user.target.wants/vasum.service
107 mkdir -p %{buildroot}/%{_datadir}/zones
108 %if %{platform_type} == "TIZEN"
109 ln -s tizen.conf %{buildroot}/etc/vasum/templates/default.conf
111 ln -s fedora-minimal.conf %{buildroot}/etc/vasum/templates/default.conf
118 %if !%{without_systemd}
119 # Refresh systemd services list after installation
121 systemctl daemon-reload || :
125 # set needed caps on the binary to allow restart without loosing them
126 setcap CAP_SYS_ADMIN,CAP_MAC_OVERRIDE,CAP_SYS_TTY_CONFIG+ei %{_bindir}/vasum-server
129 %if !%{without_systemd}
130 # Stop the service before uninstall
132 systemctl stop vasum.service || :
137 %if !%{without_systemd}
138 # Refresh systemd services list after uninstall/upgrade
139 systemctl daemon-reload || :
140 if [ $1 -ge 1 ]; then
141 # TODO: at this point an appropriate notification should show up
142 eval `systemctl show vasum --property=MainPID`
143 if [ -n "$MainPID" -a "$MainPID" != "0" ]; then
146 echo "Vasum updated. Reboot is required for the changes to take effect..."
148 echo "Vasum removed. Reboot is required for the changes to take effect..."
152 ## Client Package ##############################################################
154 Summary: Vasum Client
155 Group: Development/Libraries
156 Requires: vasum = %{epoch}:%{version}-%{release}
157 Conflicts: vasum < 1:0
158 Requires(post): /sbin/ldconfig
159 Requires(postun): /sbin/ldconfig
162 Library interface to the vasum daemon
164 %post -n vasum-client -p /sbin/ldconfig
166 %postun -n vasum-client -p /sbin/ldconfig
169 %if %{platform_type} == "TIZEN"
170 %manifest packaging/libvasum-client.manifest
172 %defattr(644,root,root,755)
173 %attr(755,root,root) %{_libdir}/libvasum-client.so.%{version}
174 %{_libdir}/libvasum-client.so.0
176 ## Devel Package ###############################################################
178 Summary: Vasum Client Devel
179 Group: Development/Libraries
180 Requires: vasum = %{epoch}:%{version}-%{release}
181 Requires: vasum-client = %{epoch}:%{version}-%{release}
184 Development package including the header files for the client library
187 %if %{platform_type} == "TIZEN"
188 %manifest packaging/vasum.manifest
190 %defattr(644,root,root,755)
191 %{_libdir}/libvasum-client.so
193 %{_libdir}/pkgconfig/vasum-client.pc
196 ## Zone Support Package ###################################################
197 %package zone-support
198 Summary: Vasum Support
199 Group: Security/Other
201 %description zone-support
202 Zones support installed inside every zone.
205 %if %{platform_type} == "TIZEN"
206 %manifest packaging/vasum-zone-support.manifest
208 %defattr(644,root,root,755)
209 %config /etc/dbus-1/system.d/org.tizen.vasum.zone.conf
212 ## Zone Daemon Package ####################################################
214 Summary: Vasum Zones Daemon
215 Group: Security/Other
216 Requires: vasum-zone-support = %{epoch}:%{version}-%{release}
218 %description zone-daemon
219 Daemon running inside every zone.
222 %if %{platform_type} == "TIZEN"
223 %manifest packaging/vasum-zone-daemon.manifest
225 %defattr(644,root,root,755)
226 %attr(755,root,root) %{_bindir}/vasum-zone-daemon
227 %config /etc/dbus-1/system.d/org.tizen.vasum.zone.daemon.conf
230 ## Command Line Interface ######################################################
232 Summary: Vasum Command Line Interface
233 Group: Security/Other
234 Requires: vasum-client = %{epoch}:%{version}-%{release}
237 Command Line Interface for vasum.
240 %defattr(644,root,root,755)
241 %attr(755,root,root) %{_bindir}/vsm
243 %package cli-completion
244 Summary: Vasum Command Line Interface bash completion
245 Group: Security/Other
246 Requires: vasum-cli = %{epoch}:%{version}-%{release}
247 #Requires: bash-completion
249 %description cli-completion
250 Command Line Interface bash completion for vasum.
252 %files cli-completion
253 %attr(755,root,root) %{_sysconfdir}/bash_completion.d/vsm-completion.sh
255 ## Test Package ################################################################
258 Group: Development/Libraries
259 Requires: vasum = %{epoch}:%{version}-%{release}
260 Requires: vasum-client = %{epoch}:%{version}-%{release}
262 %if %{platform_type} == "TIZEN"
268 Unit tests for both: server and client and integration tests.
271 %if !%{without_systemd}
272 systemctl daemon-reload || :
273 systemctl enable vasum-socket-test.socket || :
274 systemctl start vasum-socket-test.socket || :
278 %if !%{without_systemd}
279 systemctl stop vasum-socket-test.socket || :
280 systemctl disable vasum-socket-test.socket || :
284 %if !%{without_systemd}
285 systemctl daemon-reload || :
289 %if %{platform_type} == "TIZEN"
290 %manifest packaging/vasum-server-tests.manifest
292 %defattr(644,root,root,755)
293 %attr(755,root,root) %{_bindir}/vasum-server-unit-tests
294 %if !%{without_systemd}
295 %attr(755,root,root) %{_bindir}/vasum-socket-test
297 %attr(755,root,root) %{script_dir}/vsm_all_tests.py
298 %attr(755,root,root) %{script_dir}/vsm_int_tests.py
299 %attr(755,root,root) %{script_dir}/vsm_launch_test.py
300 %{script_dir}/vsm_test_parser.py
301 %config /etc/vasum/tests/*.conf
303 %config /etc/vasum/tests/dbus/*.conf
304 %config /etc/dbus-1/system.d/org.tizen.vasum.tests.conf
306 %config /etc/vasum/tests/provision/*.conf
307 %config /etc/vasum/tests/templates/*.conf
308 %attr(755,root,root) /etc/vasum/tests/templates/*.sh
309 %config /etc/vasum/tests/utils/*.txt
310 %{python_sitelib}/vsm_integration_tests
311 %if !%{without_systemd}
312 %{_unitdir}/vasum-socket-test.socket
313 %{_unitdir}/vasum-socket-test.service
316 ## libLogger Package ###########################################################
317 %package -n libLogger
318 Summary: Logger library
319 Group: Security/Other
320 Requires(post): /sbin/ldconfig
321 Requires(postun): /sbin/ldconfig
323 %description -n libLogger
324 The package provides libLogger library.
326 %post -n libLogger -p /sbin/ldconfig
328 %postun -n libLogger -p /sbin/ldconfig
331 %defattr(644,root,root,755)
332 %{_libdir}/libLogger.so.0
333 %attr(755,root,root) %{_libdir}/libLogger.so.%{version}
335 %package -n libLogger-devel
336 Summary: Development logger library
337 Group: Development/Libraries
338 Requires: libLogger = %{epoch}:%{version}-%{release}
340 %description -n libLogger-devel
341 The package provides libLogger development tools and libs.
343 %files -n libLogger-devel
344 %defattr(644,root,root,755)
345 %{_libdir}/libLogger.so
346 %{_includedir}/vasum-tools/logger
347 %{_libdir}/pkgconfig/libLogger.pc
350 ## libSimpleDbus Package #######################################################
351 %package -n libSimpleDbus
352 Summary: Simple dbus library
353 Group: Security/Other
354 Requires(post): /sbin/ldconfig
355 Requires(postun): /sbin/ldconfig
357 %description -n libSimpleDbus
358 The package provides libSimpleDbus library.
360 %post -n libSimpleDbus -p /sbin/ldconfig
362 %postun -n libSimpleDbus -p /sbin/ldconfig
364 %files -n libSimpleDbus
365 %defattr(644,root,root,755)
366 %{_libdir}/libSimpleDbus.so.0
367 %attr(755,root,root) %{_libdir}/libSimpleDbus.so.%{version}
369 %package -n libSimpleDbus-devel
370 Summary: Development Simple dbus library
371 Group: Development/Libraries
372 Requires: libSimpleDbus = %{epoch}:%{version}-%{release}
373 Requires: pkgconfig(libLogger)
375 %description -n libSimpleDbus-devel
376 The package provides libSimpleDbus development tools and libs.
378 %files -n libSimpleDbus-devel
379 %defattr(644,root,root,755)
380 %{_libdir}/libSimpleDbus.so
381 %{_includedir}/vasum-tools/dbus
382 %{_libdir}/pkgconfig/libSimpleDbus.pc
385 ## libConfig Package ##########################################################
386 %package -n libConfig
387 Summary: Config library
388 Group: Security/Other
389 %if %{platform_type} == "TIZEN"
390 Requires: libjson >= 0.10
394 Requires(post): /sbin/ldconfig
395 Requires(postun): /sbin/ldconfig
397 %description -n libConfig
398 The package provides libConfig library.
400 %post -n libConfig -p /sbin/ldconfig
402 %postun -n libConfig -p /sbin/ldconfig
405 %defattr(644,root,root,755)
406 %{_libdir}/libConfig.so.0
407 %attr(755,root,root) %{_libdir}/libConfig.so.%{version}
409 %package -n libConfig-devel
410 Summary: Development Config library
411 Group: Development/Libraries
412 Requires: libConfig = %{epoch}:%{version}-%{release}
413 Requires: boost-devel
414 Requires: pkgconfig(libLogger)
415 %if %{platform_type} == "TIZEN"
416 Requires: libjson-devel >= 0.10
418 Requires: json-c-devel
421 %description -n libConfig-devel
422 The package provides libConfig development tools and libs.
424 %files -n libConfig-devel
425 %defattr(644,root,root,755)
426 %{_libdir}/libConfig.so
427 %{_includedir}/vasum-tools/config
428 %{_libdir}/pkgconfig/libConfig.pc
430 ## libIpc Package #######################################################
433 Group: Security/Other
436 BuildRequires: libuuid-devel
437 Requires(post): /sbin/ldconfig
438 Requires(postun): /sbin/ldconfig
440 %description -n libIpc
441 The package provides libIpc library.
443 %post -n libIpc -p /sbin/ldconfig
445 %postun -n libIpc -p /sbin/ldconfig
448 %defattr(644,root,root,755)
449 %{_libdir}/libIpc.so.0
450 %attr(755,root,root) %{_libdir}/libIpc.so.%{version}
452 %package -n libIpc-devel
453 Summary: Development IPC library
454 Group: Development/Libraries
455 Requires: libIpc = %{epoch}:%{version}-%{release}
456 Requires: pkgconfig(libLogger)
457 Requires: pkgconfig(libConfig)
459 %description -n libIpc-devel
460 The package provides libIpc development tools and libs.
462 %files -n libIpc-devel
463 %defattr(644,root,root,755)
465 %{_includedir}/vasum-tools/ipc
466 %{_libdir}/pkgconfig/libIpc.pc
468 ## liblxcpp Package ###########################################################
470 Summary: lxcpp library
471 Group: Security/Other
472 Requires(post): /sbin/ldconfig
473 Requires(postun): /sbin/ldconfig
475 %description -n liblxcpp
476 The package provides liblxcpp library.
478 %post -n liblxcpp -p /sbin/ldconfig
480 %postun -n liblxcpp -p /sbin/ldconfig
483 %defattr(644,root,root,755)
484 %{_libdir}/liblxcpp.so.0
485 %attr(755,root,root) %{_libexecdir}/lxcpp-guard
486 %attr(755,root,root) %{_libexecdir}/lxcpp-attach
487 %attr(755,root,root) %{_libdir}/liblxcpp.so.%{version}
489 %package -n liblxcpp-devel
490 Summary: Development lxcpp library
491 Group: Development/Libraries
492 Requires: liblxcpp = %{epoch}:%{version}-%{release}
494 %description -n liblxcpp-devel
495 The package provides liblxcpp development tools and libs.
497 %files -n liblxcpp-devel
498 %defattr(644,root,root,755)
499 %{_libdir}/liblxcpp.so
501 %{_libdir}/pkgconfig/liblxcpp.pc