summaryrefslogtreecommitdiffstats
path: root/selinux/ipa-server-selinux.spec.in
blob: b3c7d89cf010d2374d4c371a979745500e74b084 (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
%define POLICYCOREUTILSVER 1.33.12-1

Name:           ipa-server-selinux
Version:        __VERSION__
Release:        __RELEASE__%{?dist}
Summary:        IPA server SELinux policies

Group:          System Environment/Base
License:        GPLv2
URL:            http://www.freeipa.org
Source0:        ipa-server-%{version}.tgz
BuildRoot:      %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
BuildArch:      noarch

BuildRequires: selinux-policy-devel m4 make policycoreutils >= %{POLICYCOREUTILSVER}
Requires(pre): policycoreutils >= %{POLICYCOREUTILSVER} libsemanage

%description
SELinux policy for ipa-server

%prep
%setup -n ipa-server-%{version} -q

%build
cd selinux
make

%clean
%{__rm} -fR %{buildroot}

%install
%{__rm} -fR %{buildroot}
cd selinux
install -d %{buildroot}/%{_usr}/share/selinux/targeted/
make DESTDIR=%{buildroot} install

%files
%{_usr}/share/selinux/targeted/ipa_webgui.pp


%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 /usr/share/selinux/targeted/ipa_webgui.pp
%relabel targeted

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

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

%changelog
* Thu Apr  3 2008 Rob Crittenden <rcritten@redhat.com> - 1.0.0-1
- Version bump for release

* Thu Feb 21 2008 Rob Crittenden <rcritten@redhat.com> - 0.99.0-1
- Version bump for release

* Thu Jan 17 2008 Karl MacMillan <kmacmill@redhat.com> - 0.6.0-1
- Initial version