Initial commit : separated from ca-certificate package for easy modification by produ...
[platform/core/security/ca-certificates-ext.git] / packaging / ca-certificates-ext.spec
1 Summary:        System wide CA certificates resource for a specific product
2 Name:           ca-certificates-ext
3 Version:        0.0.1
4 Release:        0
5 License:        Apache-2.0
6 Group:          Security/Certificate Management
7 Source0:        %{name}-%{version}.tar.gz
8 BuildArch:      noarch
9 BuildRequires:  ca-certificates-devel
10 BuildRequires:  cmake
11 BuildRequires:  coreutils
12 BuildRequires:  findutils
13 Requires: filesystem
14 Requires: security-config
15 Requires: ca-certificates
16
17 %description
18 Utilities for system wide CA certificate installation or deinstallation for a specific product
19
20
21 %define user_name security_fw
22 %define group_name security_fw
23 %define smack_domain_name System::Shared
24
25
26 %define ro_data_dir %{?TZ_SYS_RO_SHARE:%TZ_SYS_RO_SHARE}%{!?TZ_SYS_RO_SHARE:%_datadir}
27 %define certs_ext_dir %{ro_data_dir}/%{name}
28 %define certs_ext_add %{certs_ext_dir}/certs_add
29 %define certs_ext_del %{certs_ext_dir}/certs_del
30
31
32 %prep
33 %setup -q
34
35 %build
36 %cmake . -DVERSION=%version \
37          -DCERTS_EXT_DIR=%{certs_ext_dir} \
38          -DCERTS_EXT_ADD=%{certs_ext_add} \
39          -DCERTS_EXT_DEL=%{certs_ext_del}
40
41 %install
42 %make_install
43
44 %post
45 # remove README file before processing
46 rm %{certs_ext_add}/README
47 rm %{certs_ext_del}/README
48
49 # add certificates for a specific product
50 find %{certs_ext_add} -type f -exec cp  {} %{TZ_SYS_RO_CA_CERTS_ORIG} \;
51 # delete certificates not to be used in a specific product
52 DEL_LIST=`find %{certs_ext_del} -type f -printf "%f "`
53 for cert in ${DEL_LIST}
54 do
55         rm -f %{TZ_SYS_RO_CA_CERTS_ORIG}/${cert}
56 done
57
58 # regenerate symbolic files and bundle files
59 %{TZ_SYS_RO_CA_CERTS_SCRIPT}/concat-cacerts.sh \
60     %{TZ_SYS_RO_CA_CERTS_ORIG} \
61     %{TZ_SYS_CA_BUNDLE}
62
63 %{TZ_SYS_RO_CA_CERTS_SCRIPT}/gen-symlinks.sh \
64     "" \
65     %{TZ_SYS_CA_CERTS} \
66     %{TZ_SYS_RO_CA_CERTS} \
67     %{TZ_SYS_RO_CA_CERTS_ORIG} \
68     %{TZ_SYS_CA_BUNDLE} \
69         %{TZ_SYS_RO_CA_BUNDLE}
70
71 # remove all files
72 rm -rf %{certs_ext_dir}
73
74 %files
75 %manifest %{name}.manifest
76 %license LICENSE
77 %dir %{certs_ext_add}
78 %attr(444, root, root) %{certs_ext_add}/*
79 %dir %{certs_ext_del}
80 %attr(444, root, root) %{certs_ext_del}/*
81