Merge "Migrate to openssl3" into tizen
[platform/core/security/ode.git] / packaging / ode.spec
1 Name:    ode
2 Version: 0.0.5
3 Release: 0
4 License: Apache-2.0
5 Source0: file://%{name}-%{version}.tar.gz
6 Summary: Tizen device encryption and secure erase manager
7 Group:   Security/Service
8 Requires: systemd
9 Requires: e2fsprogs
10 BuildRequires: gcc
11 BuildRequires: cmake
12 BuildRequires: gettext-tools
13 BuildRequires: pkgconfig(klay)
14 BuildRequires: pkgconfig(vconf)
15 BuildRequires: pkgconfig(glib-2.0)
16 BuildRequires: pkgconfig(libtzplatform-config)
17 BuildRequires: pkgconfig(cynara-client)
18 BuildRequires: pkgconfig(openssl3)
19 BuildRequires: pkgconfig(libsmack)
20 BuildRequires: pkgconfig(blkid)
21 BuildRequires: pkgconfig(capi-system-device)
22 BuildRequires: pkgconfig(libsystemd)
23 BuildRequires: pkgconfig(ext2fs)
24 BuildRequires: pkgconfig(com_err)
25 BuildRequires: pkgconfig(gio-2.0)
26 Requires: cryptsetup
27
28 %global key_storage_plugin_dir %{_libdir}/ode-key-storage-plugin/
29 %global softreset_dir /usr/system/RestoreDir/softreset/
30 %define upgrade_script_dir /usr/share/upgrade/scripts/
31 %global socket_path %{TZ_SYS_RUN}/.ode.sock
32 %global dbus_system_services_dir %{_datadir}/dbus-1/system-services/
33 %global dbus_conf_dir %{_sysconfdir}/dbus-1/system.d/
34 %global dbus_name org.tizen.%{name}
35
36 %description
37 The ode package provides a daemon which is responsible for encrypting/decryption storages and secure erasing.
38
39 %files
40 %manifest ode.manifest
41 %defattr(644,root,root,755)
42 %attr(755,root,root) %{_bindir}/oded
43 %{_unitdir}/ode.service
44 %{_unitdir}/ode.socket
45 %{dbus_system_services_dir}/%{dbus_name}.service
46 %{dbus_conf_dir}/%{dbus_name}.conf
47 %attr(700,root,root) %{TZ_SYS_SBIN}/ode-admin-cli
48 %attr(700,root,root) %{softreset_dir}/ode_softreset.sh
49 %attr(750,root,system_share) %{TZ_SYS_SBIN}/ode-fota
50 %{_datadir}/%{name}
51 %dir %{key_storage_plugin_dir}
52 %attr(755,root,root) %{upgrade_script_dir}/500.ode_upgrade.sh
53
54 %prep
55 %setup -q
56
57 %build
58 %{!?build_type:%define build_type "RELEASE"}
59
60 %if %{build_type} == "DEBUG" || %{build_type} == "PROFILING" || %{build_type} == "CCOV"
61         CFLAGS="$CFLAGS -Wp,-U_FORTIFY_SOURCE"
62         CXXFLAGS="$CXXFLAGS -Wp,-U_FORTIFY_SOURCE"
63 %endif
64
65 %cmake . -DVERSION=%{version} \
66          -DCMAKE_BUILD_TYPE=%{build_type} \
67          -DRUN_DIR=%{TZ_SYS_RUN} \
68          -DBIN_DIR=%{TZ_SYS_BIN} \
69          -DSBIN_DIR=%{TZ_SYS_SBIN} \
70          -DSYSTEMD_UNIT_DIR=%{_unitdir} \
71          -DAPP_INSTALL_PREFIX="%{TZ_SYS_RO_APP}" \
72          -DAPP_SHARE_PACKAGES_DIR="%{TZ_SYS_RO_PACKAGES}" \
73          -DSOFTRESET_DIR="%{softreset_dir}" \
74          -DKEY_STORAGE_PLUGIN_DIR="%{key_storage_plugin_dir}" \
75          -DUPGRADE_SCRIPT_DIR="%{upgrade_script_dir}" \
76          -DSOCKET_PATH="%{socket_path}" \
77          -DBUS_SYSTEM_SERVICES_DIR="%{dbus_system_services_dir}" \
78          -DBUS_CONF_DIR="%{dbus_conf_dir}" \
79          -DBUS_NAME="%{dbus_name}"
80
81 make %{?jobs:-j%jobs}
82
83 %install
84 %make_install
85
86 %clean
87 rm -rf %{buildroot}
88
89 %pre
90 if [ $1 = 2 ]; then
91     # upgrade
92     systemctl stop ode.service
93 fi
94
95 %post
96 systemctl enable ode.socket
97 if [ $1 = 1 ]; then
98     # installation
99     systemctl start ode.socket
100 elif [ $1 = 2 ]; then
101     # update
102     systemctl daemon-reload
103     systemctl restart ode.socket
104 fi
105
106 %preun
107 if [ $1 = 0 ]; then
108     # uninstall
109     systemctl disable ode.socket
110     systemctl stop ode.socket
111     systemctl stop ode.service
112 fi
113
114 ## ODE Client Package ########################################################
115 %package -n libode
116 Summary: Library for Tizen device encryption and secure erase
117 Group: Security/Libraries
118 BuildRequires: pkgconfig(libtzplatform-config)
119 Requires: %{name} = %{version}-%{release}
120 Requires(post): /sbin/ldconfig
121 Requires(postun): /sbin/ldconfig
122
123 %description -n libode
124 The libode package contains the libraries needed to encrypt/decrypt storages and secure erasing.
125
126 %post -n libode -p /sbin/ldconfig
127
128 %postun -n libode -p /sbin/ldconfig
129
130 %files -n libode
131 %manifest ode.manifest
132 %defattr(644,root,root,755)
133 %attr(755,root,root) %{_libdir}/libode.so.%{version}
134 %{_libdir}/libode.so.0
135
136 ## Devel Package ##############################################################
137 %package -n libode-devel
138 Summary: Libraries and header files for device encryption client development
139 Group: Development/Libraries
140 Requires: libode = %{version}-%{release}
141
142 %description -n libode-devel
143 The libode-devel package includes the libraries and header files necessary for
144 developing device encryption client program.
145
146 %files -n libode-devel
147 %manifest ode.manifest
148 %defattr(644,root,root,755)
149 %{_libdir}/libode.so
150 %{_includedir}/ode
151 %{_libdir}/pkgconfig/ode.pc
152
153 ## Plugin Devel Package ##############################################################
154 %package ksp-devel
155 Summary: Header files for key storage plugin development
156 Group: Development/Libraries
157
158 %description ksp-devel
159 The ode-ksp-devel package includes header files necessary for key storage
160 plugin development
161
162 %files ksp-devel
163 %manifest ode.manifest
164 %defattr(644,root,root,755)
165 %{_includedir}/ode-key-storage-plugin
166 %{_libdir}/pkgconfig/ode-key-storage-plugin.pc
167
168 ## Unittest Package ###########################################################
169 %package unit-tests
170 Summary: Unit tests to verify components of device encryption
171 Group: Security/Testing
172 Requires: libode = %{version}-%{release}
173
174 %description unit-tests
175 The libode-devel package includes the libraries and header files necessary for
176 developing device encryption client program.
177
178 %files unit-tests
179 %manifest ode.manifest
180 %defattr(644,root,root,755)
181 %attr(755,root,root) %{_bindir}/ode-engine-unit-tests
182
183 ## Dummy key storage plugin Package ###########################################################
184 %package dummy-ksp
185 Summary: Dummy key storage plugin for FOTA binary upgrade testing
186 Group: Security/Testing
187
188 %description dummy-ksp
189 The ode-dummy-ksp package includes the dummy key storage plugin that can be used
190 for testing the binary upgrade process (FOTA). The plugin will be used by ode to
191 store the master encryption key in a file to use during FOTA process.
192
193 %files dummy-ksp
194 %manifest ode.manifest
195 %attr(755,root,root) %{key_storage_plugin_dir}/*