Remove SELinux policies fixes Bugzilla 557073

This commit is contained in:
Paul Lindner 2010-01-20 11:17:29 +00:00
parent 1862bb7cb6
commit fe67e9f88b

View File

@ -1,13 +1,9 @@
%define selinux_variants mls strict targeted
%define selinux_policyver %(sed -e 's,.*selinux-policy-\\([^/]*\\)/.*,\\1,' /usr/share/selinux/devel/policyhelp)
%define modulename memcached
%define username memcached %define username memcached
%define groupname memcached %define groupname memcached
Name: memcached Name: memcached
Version: 1.4.4 Version: 1.4.4
Release: 1%{?dist} Release: 2%{?dist}
Epoch: 0 Epoch: 0
Summary: High Performance, Distributed Memory Object Cache Summary: High Performance, Distributed Memory Object Cache
@ -19,11 +15,6 @@ Source0: http://memcached.googlecode.com/files/%{name}-%{version}.tar.gz
# custom init script # custom init script
Source1: memcached.sysv Source1: memcached.sysv
# SELinux files
Source10: %{modulename}.te
Source11: %{modulename}.fc
Source12: %{modulename}.if
# Fixes # Fixes
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
@ -43,22 +34,6 @@ memcached is a high-performance, distributed memory object caching
system, generic in nature, but intended for use in speeding up dynamic system, generic in nature, but intended for use in speeding up dynamic
web applications by alleviating database load. web applications by alleviating database load.
%package selinux
Summary: SELinux policy module supporting memcached
Group: System Environment/Base
BuildRequires: checkpolicy, selinux-policy-devel, hardlink
%if "%{selinux_policyver}" != ""
Requires: selinux-policy >= %{selinux_policyver}
%endif
Requires: %{name} = %{epoch}:%{version}-%{release}
Requires(post): policycoreutils
Requires(postun): policycoreutils
%description selinux
SELinux policy module supporting memcached.
%package devel %package devel
Summary: Files needed for development using memcached protocol Summary: Files needed for development using memcached protocol
Group: Development/Libraries Group: Development/Libraries
@ -70,24 +45,12 @@ memcached binary include files.
%prep %prep
%setup -q %setup -q
mkdir SELinux
cp -p %{SOURCE10} %{SOURCE11} %{SOURCE12} SELinux/
%build %build
%configure %configure
make %{?_smp_mflags} make %{?_smp_mflags}
pushd SELinux
for selinuxvariant in %{selinux_variants}; do
make NAME=${selinuxvariant} -f /usr/share/selinux/devel/Makefile
mv %{modulename}.pp %{modulename}.pp.${selinuxvariant}
make NAME=${selinuxvariant} -f /usr/share/selinux/devel/Makefile clean
done
popd
%check %check
# remove failing test that doesn't work in # remove failing test that doesn't work in
# build systems # build systems
@ -119,19 +82,6 @@ EOF
# pid directory # pid directory
mkdir -p %{buildroot}/%{_localstatedir}/run/memcached mkdir -p %{buildroot}/%{_localstatedir}/run/memcached
# Install SELinux policy modules
pushd SELinux
for selinuxvariant in %{selinux_variants}; do
install -d %{buildroot}%{_datadir}/selinux/${selinuxvariant}
install -p -m 644 %{modulename}.pp.${selinuxvariant} \
%{buildroot}%{_datadir}/selinux/${selinuxvariant}/%{modulename}.pp
done
popd
# Hardlink identical policy module packages together
/usr/sbin/hardlink -cv %{buildroot}%{_datadir}/selinux
%clean %clean
rm -rf %{buildroot} rm -rf %{buildroot}
@ -163,30 +113,6 @@ fi
exit 0 exit 0
%post selinux
# Install SELinux policy modules
for selinuxvariant in %{selinux_variants}
do
/usr/sbin/semodule -s ${selinuxvariant} -i \
%{_datadir}/selinux/${selinuxvariant}/%{modulename}.pp &> /dev/null || :
done
/usr/sbin/semanage port -a -t memcached_port_t -p tcp 11211 &> /dev/null || :
/sbin/fixfiles -R %{name} restore || :
%postun selinux
# Clean up after package removal
if [ $1 -eq 0 ]; then
/usr/sbin/semanage port -d -t memcached_port_t -p tcp 11211 &> /dev/null || :
# Remove SELinux policy modules
for selinuxvariant in %{selinux_variants}
do
/usr/sbin/semodule -s ${selinuxvariant} -r %{modulename} &> /dev/null || :
done
/sbin/fixfiles -R %{name} restore || :
fi
%files %files
%defattr(-,root,root,-) %defattr(-,root,root,-)
%doc AUTHORS ChangeLog COPYING NEWS README doc/CONTRIBUTORS doc/*.txt %doc AUTHORS ChangeLog COPYING NEWS README doc/CONTRIBUTORS doc/*.txt
@ -199,16 +125,14 @@ fi
%{_initrddir}/memcached %{_initrddir}/memcached
%files selinux
%defattr(-,root,root,0755)
%doc SELinux/*.te SELinux/*.fc SELinux/*.if
%{_datadir}/selinux/*/%{modulename}.pp
%files devel %files devel
%defattr(-,root,root,0755) %defattr(-,root,root,0755)
%{_includedir}/memcached/* %{_includedir}/memcached/*
%changelog %changelog
* Wed Jan 20 2010 Paul Lindner <lindner@inuus.com> - 0:1.4.4-2
- Remove SELinux policies fixes Bugzilla 557073
* Sat Nov 28 2009 Paul Lindner <lindner@inuus.com> - 0:1.4.4-1 * Sat Nov 28 2009 Paul Lindner <lindner@inuus.com> - 0:1.4.4-1
- Upgraded to upstream memcached-1.4.4 (http://code.google.com/p/memcached/wiki/ReleaseNotes144) - Upgraded to upstream memcached-1.4.4 (http://code.google.com/p/memcached/wiki/ReleaseNotes144)
- Add explicit Epoch to fix issue with broken devel dependencies (resolves 542001) - Add explicit Epoch to fix issue with broken devel dependencies (resolves 542001)