]>
Commit | Line | Data |
---|---|---|
e09fc276 SB |
1 | # --- swtpm rpm-spec --- |
2 | ||
3 | %define name @PACKAGE@ | |
4 | %define version @VERSION@ | |
5 | %define release 1 | |
6 | ||
7 | Summary: TPM Emulator | |
8 | Name: %{name} | |
9 | Version: %{version} | |
83ef6c97 | 10 | Release: %{release}.dev2%{?dist} |
e09fc276 SB |
11 | License: BSD |
12 | Group: Applications/Emulators | |
13 | Source: %{name}-%{version}.tar.gz | |
14 | BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root | |
15 | ||
16 | # due to gnutls backlevel API: | |
17 | %if 0%{?rhel} >= 7 || 0%{?fedora} >= 19 | |
18 | %define with_gnutls 1 | |
19 | %else | |
20 | %define with_gnutls 0 | |
21 | %endif | |
22 | ||
23 | BuildRequires: automake autoconf bash coreutils libtool sed | |
fbc596ab | 24 | BuildRequires: libtpms-devel >= 0.6.0 fuse-devel glib2-devel gmp-devel |
5c7f8386 | 25 | BuildRequires: expect bash net-tools nss-devel socat python-twisted |
e09fc276 | 26 | %if %{with_gnutls} |
95d41f7f | 27 | BuildRequires: gnutls >= 3.1.0 gnutls-devel gnutls-utils |
5db666e8 | 28 | BuildRequires: libtasn1-devel libtasn1 |
ba2f0af6 SB |
29 | %if 0%{?fedora} |
30 | BuildRequires: libtasn1-tools | |
31 | %endif | |
e09fc276 | 32 | %endif |
5db666e8 SB |
33 | %if 0%{?fedora} > 16 |
34 | BuildRequires: kernel-modules-extra | |
35 | %endif | |
36 | ||
fbc596ab | 37 | Requires: fuse libtpms >= 0.6.0 |
5db666e8 SB |
38 | %if 0%{?fedora} > 16 |
39 | Requires: kernel-modules-extra | |
40 | %endif | |
e09fc276 SB |
41 | |
42 | %description | |
43 | TPM emulator built on libtpms providing TPM functionality for QEMU VMs | |
44 | ||
45 | %package libs | |
46 | Summary: Common libraries for TPM emulators | |
47 | Group: System Environment/Libraries | |
48 | License: BSD | |
49 | ||
50 | %description libs | |
51 | A library with callback functions for libtpms based TPM emulator | |
52 | ||
53 | %package cuse | |
54 | Summary: TPM emulator with CUSE interface | |
55 | Group: Applications/Emulators | |
5f1ef956 | 56 | License: BSD |
e09fc276 SB |
57 | BuildRequires: selinux-policy-devel |
58 | ||
59 | %description cuse | |
60 | TPM Emulator with CUSE interface | |
61 | ||
62 | %package devel | |
63 | Summary: Include files for the TPM emulator's CUSE interface for usage by clients | |
64 | Group: Development/Libraries | |
65 | Requires: %{name}%{?_isa} = %{version}-%{release} | |
66 | ||
67 | %description devel | |
68 | Include files for the TPM emulator's CUSE interface. | |
69 | ||
70 | %package tools | |
71 | Summary: Tools for the TPM emulator | |
72 | License: BSD | |
73 | Group: Applications/Emulators | |
74 | Requires: swtpm fuse | |
95d41f7f | 75 | Requires: trousers >= 0.3.9 tpm-tools >= 1.3.8-6 expect bash net-tools gnutls-utils |
e09fc276 SB |
76 | |
77 | %description tools | |
78 | Tools for the TPM emulator from the swtpm package | |
79 | ||
80 | %files | |
81 | %defattr(-,root,root,-) | |
82 | %attr( 755, root, root) %{_bindir}/swtpm | |
83 | %{_mandir}/man8/swtpm.8* | |
929a1129 SB |
84 | %attr( 755, root, root) %{_datadir}/swtpm/swtpm.pp |
85 | %attr( 755, root, root) %{_datadir}/swtpm/swtpm_svirt.pp | |
e09fc276 SB |
86 | |
87 | %files cuse | |
88 | %defattr(-,root,root,-) | |
89 | %attr( 755, root, root) %{_bindir}/swtpm_cuse | |
90 | %{_mandir}/man8/swtpm_cuse.8* | |
929a1129 | 91 | %attr( 755, root, root) %{_datadir}/swtpm/swtpmcuse.pp |
e09fc276 SB |
92 | |
93 | %files libs | |
94 | %{_libdir}/libswtpm_libtpms.so.* | |
95 | ||
96 | %files devel | |
97 | %defattr(-, root, root, -) | |
98 | %{_libdir}/libswtpm_libtpms.so | |
99 | ||
100 | %dir %{_includedir}/%{name} | |
101 | %attr(644, root, root) %{_includedir}/%{name}/*.h | |
39d0c3de | 102 | %{_mandir}/man3/swtpm_ioctls.3* |
e09fc276 SB |
103 | |
104 | %files tools | |
105 | %defattr(-,root,root,-) | |
106 | %attr( 755, root, root) %{_bindir}/swtpm_bios | |
107 | %if %{with_gnutls} | |
108 | %attr( 755, root, root) %{_bindir}/swtpm_cert | |
109 | %endif | |
110 | %attr( 755, root, root) %{_bindir}/swtpm_setup | |
c4ac0a11 | 111 | %attr( 755, @TSS_USER@ , @TSS_GROUP@) %{_bindir}/swtpm_setup.sh |
e09fc276 SB |
112 | %attr( 755, root, root) %{_bindir}/swtpm_ioctl |
113 | %{_mandir}/man8/swtpm_bios.8* | |
114 | %{_mandir}/man8/swtpm_cert.8* | |
115 | %{_mandir}/man8/swtpm_ioctl.8* | |
116 | %{_mandir}/man8/swtpm-localca.conf.8* | |
117 | %{_mandir}/man8/swtpm-localca.options.8* | |
070d313c | 118 | %{_mandir}/man8/swtpm-localca.8* |
e09fc276 SB |
119 | %{_mandir}/man8/swtpm_setup.8* |
120 | %{_mandir}/man8/swtpm_setup.conf.8* | |
121 | %{_mandir}/man8/swtpm_setup.sh.8* | |
122 | %config(noreplace) %{_sysconfdir}/swtpm_setup.conf | |
123 | %config(noreplace) %{_sysconfdir}/swtpm-localca.options | |
124 | %config(noreplace) %{_sysconfdir}/swtpm-localca.conf | |
070d313c | 125 | %attr( 755, root, root) %{_datadir}/@PACKAGE@/swtpm-localca |
c4ac0a11 | 126 | %attr( 755, @TSS_USER@, @TSS_GROUP@) %{_localstatedir}/lib/swtpm-localca |
e09fc276 SB |
127 | |
128 | ||
129 | %prep | |
130 | %setup -q | |
131 | ||
132 | %build | |
133 | ||
dfd53161 | 134 | NOCONFIGURE=1 ./autogen.sh |
e09fc276 | 135 | %configure \ |
e09fc276 | 136 | %if %{with_gnutls} |
dfd53161 | 137 | --with-gnutls |
969edf6f | 138 | %endif |
e09fc276 SB |
139 | |
140 | make %{?_smp_mflags} | |
141 | ||
142 | %check | |
7d0fec4f | 143 | make %{?_smp_mflags} check |
e09fc276 SB |
144 | |
145 | %install | |
146 | ||
147 | make %{?_smp_mflags} install DESTDIR=${RPM_BUILD_ROOT} | |
148 | rm -f ${RPM_BUILD_ROOT}%{_libdir}/*.a ${RPM_BUILD_ROOT}%{_libdir}/*.la | |
149 | ||
929a1129 SB |
150 | %post |
151 | if [ -n "$(type -p semodule)" ]; then | |
152 | for pp in /usr/share/swtpm/swtpm.pp /usr/share/swtpm/swtpm_svirt.pp ; do | |
153 | echo "Activating SELinux policy $pp" | |
154 | semodule -i $pp | |
155 | done | |
156 | fi | |
157 | ||
158 | if [ -n "$(type -p restorecon)" ]; then | |
159 | restorecon /usr/bin/swtpm | |
160 | fi | |
161 | ||
162 | %postun | |
163 | if [ $1 -eq 0 ]; then | |
164 | if [ -n "$(type -p semodule)" ]; then | |
165 | for p in swtpm swtpm_svirt ; do | |
166 | echo "Removing SELinux policy $p" | |
167 | semodule -r $p | |
168 | done | |
169 | fi | |
170 | fi | |
171 | ||
e09fc276 SB |
172 | %post cuse |
173 | if [ -n "$(type -p semodule)" ]; then | |
929a1129 | 174 | for pp in /usr/share/swtpm/swtpmcuse.pp ; do |
e09fc276 SB |
175 | echo "Activating SELinux policy $pp" |
176 | semodule -i $pp | |
177 | done | |
178 | fi | |
179 | ||
180 | if [ -n "$(type -p restorecon)" ]; then | |
181 | restorecon /usr/bin/swtpm_cuse | |
182 | fi | |
183 | ||
184 | %postun cuse | |
efb0779c SB |
185 | if [ $1 -eq 0 ]; then |
186 | if [ -n "$(type -p semodule)" ]; then | |
929a1129 | 187 | for p in swtpmcuse ; do |
efb0779c SB |
188 | echo "Removing SELinux policy $p" |
189 | semodule -r $p | |
190 | done | |
191 | fi | |
e09fc276 SB |
192 | fi |
193 | ||
194 | %post libs -p /sbin/ldconfig | |
195 | %postun libs -p /sbin/ldconfig | |
196 | ||
197 | %changelog |