File selinux-policy.spec of Package selinux-policy

#
# spec file for package selinux-policy (Version 2.20081210)
#
# Copyright (c) 2010 SUSE LINUX Products GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.

# Please submit bugfixes or comments via http://bugs.opensuse.org/
#

# norootforbuild


Name:           selinux-policy
Version:        2.20081210
Release:        4
Url:            http://oss.tresys.com/projects/refpolicy/
License:        GPLv2
Group:          System/Base
Summary:        SELinux policies
Source:         refpolicy-%{version}.tar.bz2
Source1:        config
Patch0:         %{name}-build_conf.patch
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
BuildRequires:  checkpolicy libsepol-devel m4 policycoreutils python python-xml
BuildArch:      noarch
# default is refpolicy-standard (mentioned in config)
Requires:       selinux-policy-refpolicy-standard

%description
SELinux policy

%package refpolicy-standard
License:        GPLv2
Group:          System/Base
Summary:        SELinux policy - Tresys Standard Refpolicy
Requires:       selinux-policy

%description refpolicy-standard
SELinux policy - based on reference policy from Tresys - standard

%package refpolicy-mcs
License:        GPLv2
Group:          System/Base
Summary:        SELinux policy - Tresys MCS Refpolicy
Requires:       selinux-policy

%description refpolicy-mcs
SELinux policy - based on reference policy from Tresys - mcs

%package refpolicy-mls
License:        GPLv2
Group:          System/Base
Summary:        SELinux policy - Tresys MLS Refpolicy
Requires:       selinux-policy

%description refpolicy-mls
SELinux policy - based on reference policy from Tresys - mls

%prep
%setup -q -c -n selinux-policy -T
tar xfj %{SOURCE0} && mv refpolicy refpolicy-standard
tar xfj %{SOURCE0} && mv refpolicy refpolicy-mcs
tar xfj %{SOURCE0} && mv refpolicy refpolicy-mls
%patch0

%build
for i in standard mcs mls; do
  cd refpolicy-$i
  make conf
  make policy
  cd ..
done

%install
for i in standard mcs mls; do
  cd refpolicy-$i
  make DESTDIR=$RPM_BUILD_ROOT install
  sed -i "s:^# edit $RPM_BUILD_ROOT:# edit :" $RPM_BUILD_ROOT%{_sysconfdir}/selinux/refpolicy-$i/contexts/files/file_contexts.homedirs
  cd ..
done
install -m 644 %{SOURCE1} $RPM_BUILD_ROOT%{_sysconfdir}/selinux/

%clean
rm -rf $RPM_BUILD_ROOT

%files
%defattr(-,root,root)
%dir %{_sysconfdir}/selinux
%config %{_sysconfdir}/selinux/config

%files refpolicy-standard
%defattr(-,root,root)
%doc refpolicy-standard/{build.conf,Changelog,config,COPYING,doc,INSTALL,Makefile,man,policy,README,Rules.modular,Rules.monolithic,support,VERSION}
%dir %{_sysconfdir}/selinux/refpolicy-standard
%{_sysconfdir}/selinux/refpolicy-standard/*

%files refpolicy-mcs
%defattr(-,root,root)
%doc refpolicy-mcs/{build.conf,Changelog,config,COPYING,doc,INSTALL,Makefile,man,policy,README,Rules.modular,Rules.monolithic,support,VERSION} 
%dir %{_sysconfdir}/selinux/refpolicy-mcs
%{_sysconfdir}/selinux/refpolicy-mcs/*

%files refpolicy-mls
%defattr(-,root,root)
%doc refpolicy-mls/{build.conf,Changelog,config,COPYING,doc,INSTALL,Makefile,man,policy,README,Rules.modular,Rules.monolithic,support,VERSION}
%dir %{_sysconfdir}/selinux/refpolicy-mls
%{_sysconfdir}/selinux/refpolicy-mls/*

%changelog