summaryrefslogtreecommitdiffstats
path: root/pki/dogtag/selinux/pki-selinux.spec
blob: 293b9f725e15d0e52c155c7b166936726ae116d0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
Name:           pki-selinux
Version:        2.0.0
Release:        1%{?dist}
Summary:        Dogtag Certificate System - PKI Selinux Policies
URL:            https://pki.fedoraproject.org/
License:        GPLv2
Group:          System Environment/Base

BuildArch:      noarch

BuildRoot:      %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)

BuildRequires: ant
BuildRequires: m4
BuildRequires: make
BuildRequires: policycoreutils
BuildRequires: selinux-policy-devel

Requires: policycoreutils
Requires: selinux-policy-targeted

Source0:        http://pki.fedoraproject.org/pki/sources/%{name}/%{name}-%{version}.tar.gz

%description
Selinux policies for the Pubic Key Infrastructure (PKI) components.

%prep

%setup -q -n %{name}-%{version}

%build
cd src
make

%install
rm -rf %{buildroot}
mkdir -p %{buildroot}%{_datadir}/selinux/modules
cp -p src/pki.pp %{buildroot}%{_datadir}/selinux/modules

%clean
rm -rf %{buildroot}

%define saveFileContext() \
if [ -s /etc/selinux/config ]; then \
     . %{_sysconfdir}/selinux/config; \
     FILE_CONTEXT=%{_sysconfdir}/selinux/%1/contexts/files/file_contexts; \
     if [ "${SELINUXTYPE}" == %1 -a -f ${FILE_CONTEXT} ]; then \
          cp -f ${FILE_CONTEXT} ${FILE_CONTEXT}.%{name}; \
     fi \
fi;

%define relabel() \
. %{_sysconfdir}/selinux/config; \
FILE_CONTEXT=%{_sysconfdir}/selinux/%1/contexts/files/file_contexts; \
selinuxenabled; \
if [ $? == 0  -a "${SELINUXTYPE}" == %1 -a -f ${FILE_CONTEXT}.%{name} ]; then \
     fixfiles -C ${FILE_CONTEXT}.%{name} restore; \
     rm -f ${FILE_CONTEXT}.%name; \
fi;

%pre
%saveFileContext targeted

%post
semodule -s targeted -i %{_datadir}/selinux/modules/pki.pp
%relabel targeted

%preun
if [ $1 = 0 ]; then
     %saveFileContext targeted
fi

%postun
if [ $1 = 0 ]; then
     semodule -s targeted -r pki
     %relabel targeted
fi

%files
%defattr(-,root,root,-)
%doc LICENSE
%{_datadir}/selinux/modules/pki.pp

%changelog
* Tue Aug 10 2010 Matthew Harmsen <mharmsen@redhat.com> 2.0.0-1
- Updated Dogtag 1.3.x --> Dogtag 2.0.0.