| 1 |
# Copyright 1999-2005 Gentoo Foundation
|
| 2 |
# Distributed under the terms of the GNU General Public License v2
|
| 3 |
# $Header: /var/cvsroot/gentoo-x86/sys-apps/policycoreutils/policycoreutils-1.24-r2.ebuild,v 1.2 2005/12/15 21:52:54 pebenito Exp $
|
| 4 |
|
| 5 |
IUSE="build nls pam"
|
| 6 |
|
| 7 |
inherit eutils
|
| 8 |
|
| 9 |
EXTRAS_VER="1.13"
|
| 10 |
SEPOL_VER="1.6"
|
| 11 |
|
| 12 |
DESCRIPTION="SELinux core utilities"
|
| 13 |
HOMEPAGE="http://www.nsa.gov/selinux"
|
| 14 |
SRC_URI="http://www.nsa.gov/selinux/archives/${P}.tgz
|
| 15 |
mirror://gentoo/policycoreutils-extra-${EXTRAS_VER}.tar.bz2"
|
| 16 |
LICENSE="GPL-2"
|
| 17 |
SLOT="0"
|
| 18 |
KEYWORDS="x86 ppc sparc amd64"
|
| 19 |
#KEYWORDS="~x86 ~ppc ~sparc ~amd64"
|
| 20 |
|
| 21 |
RDEPEND=">=sys-libs/libselinux-${PV}
|
| 22 |
!build? ( pam? ( sys-libs/pam ) =sys-libs/libsepol-${SEPOL_VER}* )
|
| 23 |
build? ( sys-apps/baselayout )"
|
| 24 |
|
| 25 |
DEPEND="${RDEPEND}
|
| 26 |
!build? ( nls? ( sys-devel/gettext ) )"
|
| 27 |
|
| 28 |
S2=${WORKDIR}/policycoreutils-extra
|
| 29 |
|
| 30 |
throw_pam_warning() {
|
| 31 |
# this is an extremely important message that needs to be seen
|
| 32 |
# thus it being shown at the beginning and end of the ebuild
|
| 33 |
|
| 34 |
if ! useq pam; then
|
| 35 |
eerror "PAM is disabled. This is not a supported config for"
|
| 36 |
eerror "general use. Disabling PAM decreases security with"
|
| 37 |
eerror "respect to SELinux protection of authentication."
|
| 38 |
eerror "It also requires policy changes."
|
| 39 |
ebeep 4
|
| 40 |
epause 4
|
| 41 |
fi
|
| 42 |
}
|
| 43 |
|
| 44 |
pkg_setup() {
|
| 45 |
throw_pam_warning
|
| 46 |
}
|
| 47 |
|
| 48 |
src_unpack() {
|
| 49 |
unpack ${A}
|
| 50 |
cd ${S}
|
| 51 |
|
| 52 |
epatch ${FILESDIR}/policycoreutils-1.24-genhomedircon-quiet.diff
|
| 53 |
|
| 54 |
# This warning makes no sense, in this context
|
| 55 |
sed -i -e '/FILE/ s/;/=NULL;/' ${S}/audit2why/audit2why.c \
|
| 56 |
|| die "audit2why sed failed"
|
| 57 |
|
| 58 |
# fixfiles is extremely dangerous
|
| 59 |
sed -i -e '/^all/s/fixfiles//' ${S}/scripts/Makefile \
|
| 60 |
|| die "fixfiles sed 1 failed"
|
| 61 |
sed -i -e '/fixfiles/d' ${S}/scripts/Makefile \
|
| 62 |
|| die "fixfiles sed 2 failed"
|
| 63 |
|
| 64 |
if ! useq pam; then
|
| 65 |
# disable pam
|
| 66 |
sed -i -e s/-lpam/-lcrypt/ -e s/-lpam_misc// -e s/-DUSE_PAM// \
|
| 67 |
${S}/run_init/Makefile || die "PAM sed 1 failed"
|
| 68 |
sed -i -e s/-lpam/-lcrypt/ -e s/-lpam_misc// -e s/-DUSE_PAM// \
|
| 69 |
${S}/newrole/Makefile || die "PAM sed 2 failed"
|
| 70 |
sed -i -e s/-lpam/-lcrypt/ -e s/-lpam_misc// -e s/-DUSE_PAM// \
|
| 71 |
${S2}/src/Makefile || die "PAM sed 3 failed"
|
| 72 |
fi
|
| 73 |
|
| 74 |
if ! useq nls; then
|
| 75 |
# disable locale stuff
|
| 76 |
sed -i -e s/-DUSE_NLS// ${S}/run_init/Makefile \
|
| 77 |
|| die "NLS sed 1 failed"
|
| 78 |
sed -i -e s/-DUSE_NLS// ${S}/newrole/Makefile \
|
| 79 |
|| die "NLS sed 2 failed"
|
| 80 |
sed -i -e s/-DUSE_NLS// ${S}/load_policy/Makefile \
|
| 81 |
|| die "NLS sed 3 failed"
|
| 82 |
sed -i -e 's/ po //' ${S}/Makefile \
|
| 83 |
|| die "NLS sed 4 failed"
|
| 84 |
fi
|
| 85 |
|
| 86 |
# fix up to accept Gentoo CFLAGS
|
| 87 |
local SUBDIRS="`cd ${S} && find -type d | cut -d/ -f2`"
|
| 88 |
for i in ${SUBDIRS}; do
|
| 89 |
sed -i -e "s:-Wall:-Wall ${CFLAGS}:g" ${S}/${i}/Makefile \
|
| 90 |
|| die "${i} Makefile CFLAGS fix failed."
|
| 91 |
done
|
| 92 |
}
|
| 93 |
|
| 94 |
src_compile() {
|
| 95 |
if useq build; then
|
| 96 |
einfo "Compiling setfiles"
|
| 97 |
emake -C ${S}/setfiles || die
|
| 98 |
else
|
| 99 |
einfo "Compiling policycoreutils"
|
| 100 |
emake -C ${S} || die
|
| 101 |
einfo "Compiling policycoreutils-extra"
|
| 102 |
emake -C ${S2} || die
|
| 103 |
fi
|
| 104 |
}
|
| 105 |
|
| 106 |
src_install() {
|
| 107 |
if useq build; then
|
| 108 |
dosbin ${S}/setfiles/setfiles
|
| 109 |
else
|
| 110 |
einfo "Installing policycoreutils"
|
| 111 |
make DESTDIR="${D}" -C ${S} install || die
|
| 112 |
einfo "Installing policycoreutils-extra"
|
| 113 |
make DESTDIR="${D}" -C ${S2} install || die
|
| 114 |
dosym /usr/sbin/genhomedircon /usr/sbin/genhomedircon.old
|
| 115 |
fi
|
| 116 |
|
| 117 |
useq pam || rm -fR ${D}/etc/pam.d
|
| 118 |
}
|
| 119 |
|
| 120 |
pkg_postinst() {
|
| 121 |
if useq build; then
|
| 122 |
# need to ensure these
|
| 123 |
mkdir -p ${ROOT}/selinux
|
| 124 |
touch ${ROOT}/selinux/.keep
|
| 125 |
mkdir -p ${ROOT}/sys
|
| 126 |
touch ${ROOT}/sys/.keep
|
| 127 |
mkdir -p ${ROOT}/dev/pts
|
| 128 |
touch ${ROOT}/dev/pts/.keep
|
| 129 |
chmod 0666 ${ROOT}/dev/{ptmx,tty}
|
| 130 |
fi
|
| 131 |
|
| 132 |
throw_pam_warning
|
| 133 |
}
|