Add upgrade script
[platform/core/security/libwebappenc.git] / packaging / libwebappenc.spec
1 Name:    libwebappenc
2 Summary: Web application encryption service
3 Version: 0.1.0
4 Release: 1
5 Group:   Security/Libraries
6 License: Apache-2.0 and BSL-1.0
7 Source0: %{name}-%{version}.tar.gz
8
9 Requires(post):   /sbin/ldconfig
10 Requires(postun): /sbin/ldconfig
11
12 BuildRequires: cmake
13 BuildRequires: pkgconfig(dlog)
14 BuildRequires: pkgconfig(openssl)
15 BuildRequires: pkgconfig(key-manager)
16 BuildRequires: pkgconfig(libtzplatform-config)
17
18 %description
19 Web application encryption and decryption service
20
21 %package devel
22 Summary:    Web application encryption service (development files)
23 License:    Apache-2.0
24 Group:      Security/Development
25 Requires:   %{name} = %{version}-%{release}
26
27 %description devel
28 Web application encryption and decryption service (development files)
29
30 %package test
31 Summary:    Web application encryption service (test)
32 License:    Apache-2.0 and BSL-1.0
33 Group:      Security/Development
34 BuildRequires: boost-devel
35 Requires:      %{name} = %{version}-%{release}
36
37 %description test
38 Web application encryption and decryption service (test)
39
40 %define user_name          security_fw
41 %define group_name         security_fw
42 %define smack_domain       System
43 %define bin_dir            %TZ_SYS_BIN
44 %define rw_share_dir       %TZ_SYS_SHARE
45 %define upgrade_dir        %TZ_SYS_RO_SHARE/upgrade
46 %define upgrade_script_dir %{upgrade_dir}/scripts
47 %define upgrade_data_dir   %{upgrade_dir}/data
48
49 %prep
50 %setup -q
51
52 %build
53 %{!?build_type:%define build_type "Release"}
54 %cmake . -DPREFIX=%{_prefix} \
55          -DEXEC_PREFIX=%{_exec_prefix} \
56          -DINCLUDEDIR=%{_includedir} \
57          -DLIBDIR=%{_libdir} \
58          -DSYSTEMD_UNIT_DIR=%{_unitdir} \
59          -DCMAKE_BUILD_TYPE=%{build_type} \
60          -DRW_SHARE_DIR=%rw_share_dir \
61          -DUPGRADE_DATA_DIR=%upgrade_data_dir \
62          -DUPGRADE_SCRIPT_DIR=%upgrade_script_dir \
63          -DUSER_NAME=%user_name \
64          -DGROUP_NAME=%group_name \
65          -DSMACK_DOMAIN=%smack_domain \
66          -DBINDIR=%bin_dir
67
68 make %{?jobs:-j%jobs}
69
70 %install
71 %make_install
72 %install_service multi-user.target.wants webappenc-initializer.service
73
74 %post
75 /sbin/ldconfig
76 systemctl daemon-reload
77 if [ $1 = 1 ]; then
78     # installation
79     systemctl start webappenc-initializer.service
80 fi
81
82 if [ $1 = 2 ]; then
83     # update
84     systemctl restart webappenc-initializer.service
85 fi
86
87 %postun
88 /sbin/ldconfig
89 if [ $1 = 0 ]; then
90     # uninstall
91     systemctl daemon-reload
92 fi
93
94 %files
95 %manifest %{name}.manifest
96 %license LICENSE
97 %license LICENSE.BSL-1.0
98 %{_libdir}/%{name}.so.*
99 %{_unitdir}/webappenc-initializer.service
100 %{_unitdir}/multi-user.target.wants/webappenc-initializer.service
101 %{bin_dir}/wae_initializer
102 %dir %attr(770, %user_name, %group_name) %{rw_share_dir}/wae
103 %dir %attr(770, %user_name, %group_name) %{rw_share_dir}/wae/app_dek
104 %attr(660, %user_name, %group_name) %{rw_share_dir}/wae/app_dek/*
105
106 %attr(775,root,root) %{upgrade_script_dir}/wae-upgrade.sh
107 %{upgrade_data_dir}/wae/app_dek/*
108
109 %files devel
110 %{_includedir}/*
111 %{_libdir}/pkgconfig/%{name}.pc
112 %{_libdir}/%{name}.so
113
114 %files test
115 %manifest %{name}-test.manifest
116 %license LICENSE
117 %license LICENSE.BSL-1.0
118 %{bin_dir}/wae_tests
119 %{_libdir}/libwae_tests_common.so*