| 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/gradm/gradm-2.0.1-r1.ebuild,v 1.4 2005/01/08 21:26:59 solar Exp $ |
| 4 |
|
| 5 |
inherit flag-o-matic gcc eutils |
| 6 |
|
| 7 |
MAINTAINER="solar@gentoo.org" |
| 8 |
DESCRIPTION="Administrative interface for grsecuritys2 access control lists" |
| 9 |
HOMEPAGE="http://www.grsecurity.net/" |
| 10 |
#SRC_URI="http://www.grsecurity.net/gradm-${PV}.tar.gz" |
| 11 |
SRC_URI="mirror://gentoo/gradm-${PV}.tar.gz" |
| 12 |
|
| 13 |
LICENSE="GPL-2" |
| 14 |
SLOT="0" |
| 15 |
KEYWORDS="~x86 ~ppc ~sparc ~arm ~amd64" ; # ~alpha" |
| 16 |
IUSE="" |
| 17 |
|
| 18 |
DEPEND="virtual/libc |
| 19 |
sys-devel/bison |
| 20 |
sys-devel/flex |
| 21 |
sys-apps/chpax" |
| 22 |
|
| 23 |
S="${WORKDIR}/${PN}2" |
| 24 |
|
| 25 |
src_unpack() { |
| 26 |
unpack ${A} |
| 27 |
cd ${S} |
| 28 |
|
| 29 |
# (Jan 03 2004) - <solar@gentoo> |
| 30 |
# static linking required for proper operation of gradm |
| 31 |
# however ssp is known to break static linking when it's enabled |
| 32 |
# in >=gcc-3.3.1 && <=gcc-3.3.2-r5 . So we strip ssp if needed. |
| 33 |
gmicro=$(gcc-micro-version) |
| 34 |
if [ "$(gcc-version)" == "3.3" -a -n "${gmicro}" -a ${gmicro} -le 2 ]; then |
| 35 |
# extract out gentoo revision |
| 36 |
gentoo_gcc_r=$($(gcc-getCC) -v 2>&1 | tail -n 1 | awk '{print $7}') |
| 37 |
gentoo_gcc_r=${gentoo_gcc_r/,/} |
| 38 |
gentoo_gcc_r=${gentoo_gcc_r/-/ } |
| 39 |
gentoo_gcc_r=${gentoo_gcc_r:7} |
| 40 |
[ -n "${gentoo_gcc_r}" -a ${gentoo_gcc_r} -le 5 ] && \ |
| 41 |
filter-flags -fstack-protector -fstack-protector-all |
| 42 |
fi |
| 43 |
|
| 44 |
ebegin "Patching Makefile to use gentoo CFLAGS" |
| 45 |
sed -i -e "s|-O2|${CFLAGS}|" Makefile |
| 46 |
eend $? |
| 47 |
[ "$PV" == "2.0.1" ] && epatch ${FILESDIR}/${PN}-${PV}-install.patch |
| 48 |
} |
| 49 |
|
| 50 |
src_compile() { |
| 51 |
cd ${S} |
| 52 |
emake CC="$(gcc-getCC)" || die "compile problem" |
| 53 |
return 0 |
| 54 |
} |
| 55 |
|
| 56 |
src_install() { |
| 57 |
cd ${S} |
| 58 |
einstall DESTDIR=${D} |
| 59 |
|
| 60 |
# Normal users can authenticate to special roles now and thus |
| 61 |
# need execution permission on gradm2. We remove group,other readable bits |
| 62 |
# to help ensure that our gradm2 binary is as protected from misbehaving users. |
| 63 |
fperms 711 /sbin/gradm |
| 64 |
|
| 65 |
return 0 |
| 66 |
} |
| 67 |
|
| 68 |
pkg_postinst() { |
| 69 |
if [ ! -e /dev/grsec ] ; then |
| 70 |
einfo "Making character device for grsec2 learning mode" |
| 71 |
mkdir -p -m 755 /dev/ |
| 72 |
mknod -m 0622 /dev/grsec c 1 12 || die "Cant mknod for grsec learning device" |
| 73 |
fi |
| 74 |
ewarn "Be sure to set a password with 'gradm -P' before enabling learning mode" |
| 75 |
} |