| 1 |
# Copyright 1999-2004 Gentoo Foundation
|
| 2 |
# Distributed under the terms of the GNU General Public License v2
|
| 3 |
# $Header: /var/cvsroot/gentoo-x86/sec-policy/selinux-base-policy/selinux-base-policy-20041023.ebuild,v 1.2 2004/11/23 16:56:42 pebenito Exp $
|
| 4 |
|
| 5 |
IUSE="build"
|
| 6 |
|
| 7 |
inherit eutils
|
| 8 |
|
| 9 |
DESCRIPTION="Gentoo base policy for SELinux"
|
| 10 |
HOMEPAGE="http://www.gentoo.org/proj/en/hardened/selinux/"
|
| 11 |
SRC_URI="mirror://gentoo/${P}.tar.bz2"
|
| 12 |
LICENSE="GPL-2"
|
| 13 |
SLOT="0"
|
| 14 |
#KEYWORDS="~x86 ~ppc ~sparc ~amd64"
|
| 15 |
KEYWORDS="x86 ppc sparc amd64"
|
| 16 |
DEPEND="build? ( sys-devel/make
|
| 17 |
sys-devel/m4 )"
|
| 18 |
RDEPEND="sys-devel/m4
|
| 19 |
sys-devel/make"
|
| 20 |
|
| 21 |
S=${WORKDIR}/base-policy
|
| 22 |
|
| 23 |
[ -z ${POLICYDIR} ] && POLICYDIR="/etc/security/selinux/src/policy"
|
| 24 |
|
| 25 |
# deprecated policies:
|
| 26 |
DEPRECATED="domains/program/devfsd.te domains/program/opt.te
|
| 27 |
file_contexts/program/devfsd.fc file_contexts/program/opt.fc
|
| 28 |
file_contexts/users.fc domains/program/inetd.te
|
| 29 |
domains/program/tcpd.te file_contexts/program/inetd.fc
|
| 30 |
file_contexts/program/tcpd.fc"
|
| 31 |
|
| 32 |
src_compile() {
|
| 33 |
return
|
| 34 |
}
|
| 35 |
|
| 36 |
src_install() {
|
| 37 |
if use build; then
|
| 38 |
# generate a file_contexts
|
| 39 |
dodir ${POLICYDIR}/file_contexts
|
| 40 |
einfo "Ignore the checkpolicy error on the next line."
|
| 41 |
make -C ${S} \
|
| 42 |
FC=${D}/${POLICYDIR}/file_contexts/file_contexts \
|
| 43 |
${D}/${POLICYDIR}/file_contexts/file_contexts
|
| 44 |
|
| 45 |
[ ! -f ${D}/${POLICYDIR}/file_contexts/file_contexts ] && \
|
| 46 |
die "file_contexts was not generated."
|
| 47 |
else
|
| 48 |
# install full policy
|
| 49 |
dodir /etc/security/selinux/src
|
| 50 |
|
| 51 |
insinto /etc/security
|
| 52 |
doins ${S}/appconfig/*
|
| 53 |
|
| 54 |
cp -a ${S} ${D}/${POLICYDIR}
|
| 55 |
rm -fR ${D}/${POLICYDIR}/appconfig
|
| 56 |
fi
|
| 57 |
}
|
| 58 |
|
| 59 |
pkg_postinst() {
|
| 60 |
local isdeprecated
|
| 61 |
echo
|
| 62 |
einfo "This is the base policy for SELinux on Gentoo. This policy"
|
| 63 |
einfo "package only covers the applications in the system profile."
|
| 64 |
einfo "More policy may need to be added according to your requirements."
|
| 65 |
echo
|
| 66 |
eerror "It is STRONGLY suggested that you evaluate and merge the"
|
| 67 |
eerror "policy changes. If any of the file contexts (*.fc) have"
|
| 68 |
eerror "changed, you should also relabel."
|
| 69 |
echo
|
| 70 |
ewarn "Please check the Changelog, there may be important information."
|
| 71 |
echo
|
| 72 |
echo
|
| 73 |
|
| 74 |
einfo "Checking for deprecated policy..."
|
| 75 |
for i in $DEPRECATED; do
|
| 76 |
if [ -f "${POLICYDIR}/${i}" ]; then
|
| 77 |
eerror "${POLICYDIR}/${i}"
|
| 78 |
isdeprecated="y"
|
| 79 |
fi
|
| 80 |
done
|
| 81 |
[ "${isdeprecated}" ] && \
|
| 82 |
eerror "The above policy file(s) should be removed if possible." || \
|
| 83 |
einfo "None found."
|
| 84 |
|
| 85 |
ebeep 4
|
| 86 |
epause 4
|
| 87 |
}
|