| 1 |
robbat2 |
1.1 |
# Copyright 1999-2008 Gentoo Foundation |
| 2 |
|
|
# Distributed under the terms of the GNU General Public License v2 |
| 3 |
|
|
# $Header: /var/cvsroot/gentoo-x86/sys-process/audit/audit-1.7.3.ebuild,v 1.1 2008/05/22 17:46:21 robbat2 Exp $ |
| 4 |
|
|
|
| 5 |
|
|
inherit autotools multilib toolchain-funcs python |
| 6 |
|
|
|
| 7 |
|
|
DESCRIPTION="Userspace utilities for storing and processing auditing records" |
| 8 |
|
|
HOMEPAGE="http://people.redhat.com/sgrubb/audit/" |
| 9 |
|
|
SRC_URI="http://people.redhat.com/sgrubb/audit/${P}.tar.gz" |
| 10 |
|
|
|
| 11 |
|
|
LICENSE="GPL-2" |
| 12 |
|
|
SLOT="0" |
| 13 |
|
|
KEYWORDS="~amd64 ~hppa ~ia64 ~mips ~ppc ~ppc64 ~sparc ~x86" |
| 14 |
|
|
IUSE="ldap" |
| 15 |
|
|
# Testcases are pretty useless as they are built for RedHat users/groups and |
| 16 |
|
|
# kernels. |
| 17 |
|
|
RESTRICT="test" |
| 18 |
|
|
|
| 19 |
|
|
RDEPEND=">=dev-lang/python-2.4 |
| 20 |
|
|
ldap? ( net-nds/openldap )" |
| 21 |
|
|
DEPEND="${RDEPEND} |
| 22 |
|
|
dev-lang/swig |
| 23 |
|
|
>=sys-kernel/linux-headers-2.6.23" |
| 24 |
|
|
# Do not use os-headers as this is linux specific |
| 25 |
|
|
|
| 26 |
|
|
src_unpack() { |
| 27 |
|
|
unpack ${A} |
| 28 |
|
|
cd "${S}" |
| 29 |
|
|
|
| 30 |
|
|
# Old patch applies fine |
| 31 |
|
|
#EPATCH_OPTS="-p0 -d${S}" epatch "${FILESDIR}"/${PN}-1.5.4-build.patch |
| 32 |
|
|
|
| 33 |
|
|
# Applied by upstream |
| 34 |
|
|
#EPATCH_OPTS="-p1 -d${S}" epatch "${FILESDIR}"/${PN}-1.5.4-swig-gcc-attribute.patch |
| 35 |
|
|
|
| 36 |
|
|
# Do not build GUI tools |
| 37 |
|
|
sed -i \ |
| 38 |
|
|
-e '/AC_CONFIG_SUBDIRS.*system-config-audit/d' \ |
| 39 |
|
|
"${S}"/configure.ac |
| 40 |
|
|
sed -i \ |
| 41 |
|
|
-e 's,system-config-audit,,g' \ |
| 42 |
|
|
-e '/^SUBDIRS/s,\\$,,g' \ |
| 43 |
|
|
"${S}"/Makefile.am |
| 44 |
|
|
rm -rf "${S}"/system-config-audit |
| 45 |
|
|
|
| 46 |
|
|
# Probably goes away in 1.6.9 |
| 47 |
|
|
EPATCH_OPTS="-p1 -d${S}" epatch "${FILESDIR}"/audit-1.6.8-subdirs-fix.patch |
| 48 |
|
|
|
| 49 |
|
|
if ! use ldap; then |
| 50 |
|
|
sed -i \ |
| 51 |
|
|
-e '/^AC_OUTPUT/s,audisp/plugins/zos-remote/Makefile,,g' \ |
| 52 |
|
|
"${S}"/configure.ac |
| 53 |
|
|
sed -i \ |
| 54 |
|
|
-e '/^SUBDIRS/s,zos-remote,,g' \ |
| 55 |
|
|
"${S}"/audisp/plugins/Makefile.am |
| 56 |
|
|
fi |
| 57 |
|
|
|
| 58 |
|
|
# Regenerate autotooling |
| 59 |
|
|
eautoreconf |
| 60 |
|
|
} |
| 61 |
|
|
|
| 62 |
|
|
src_compile() { |
| 63 |
|
|
#append-flags -D'__attribute__(x)=' |
| 64 |
|
|
econf --sbindir=/sbin --without-prelude || die |
| 65 |
|
|
emake || die "emake failed" |
| 66 |
|
|
} |
| 67 |
|
|
|
| 68 |
|
|
src_install() { |
| 69 |
|
|
emake DESTDIR="${D}" install || die "emake install failed" |
| 70 |
|
|
dodoc AUTHORS ChangeLog README* THANKS TODO |
| 71 |
|
|
docinto contrib |
| 72 |
|
|
dodoc contrib/* |
| 73 |
|
|
docinto contrib/plugin |
| 74 |
|
|
dodoc contrib/plugin/* |
| 75 |
|
|
|
| 76 |
|
|
newinitd "${FILESDIR}"/auditd-init.d-1.2.3 auditd |
| 77 |
|
|
newconfd "${FILESDIR}"/auditd-conf.d-1.2.3 auditd |
| 78 |
|
|
|
| 79 |
|
|
# things like shadow use this so we need to be in / |
| 80 |
|
|
dodir /$(get_libdir) |
| 81 |
|
|
mv "${D}"/usr/$(get_libdir)/lib*.so* "${D}"/$(get_libdir)/ || die |
| 82 |
|
|
gen_usr_ldscript libaudit.so libauparse.so |
| 83 |
|
|
|
| 84 |
|
|
# remove RedHat garbage |
| 85 |
|
|
rm -r "${D}"/etc/{rc.d,sysconfig} || die |
| 86 |
|
|
|
| 87 |
|
|
# Gentoo rules |
| 88 |
|
|
insinto /etc/audit/ |
| 89 |
|
|
doins "${FILESDIR}"/audit.rules* |
| 90 |
|
|
|
| 91 |
|
|
# audit logs go here |
| 92 |
|
|
keepdir /var/log/audit/ |
| 93 |
|
|
|
| 94 |
|
|
# Security |
| 95 |
|
|
lockdown_perms "${D}" |
| 96 |
|
|
} |
| 97 |
|
|
|
| 98 |
|
|
pkg_postinst() { |
| 99 |
|
|
lockdown_perms "${ROOT}" |
| 100 |
|
|
python_mod_optimize |
| 101 |
|
|
} |
| 102 |
|
|
|
| 103 |
|
|
pkg_postrm() { |
| 104 |
|
|
python_mod_cleanup |
| 105 |
|
|
} |
| 106 |
|
|
|
| 107 |
|
|
lockdown_perms() { |
| 108 |
|
|
# upstream wants these to have restrictive perms |
| 109 |
|
|
basedir="$1" |
| 110 |
|
|
chmod 0750 "${basedir}"/sbin/au{ditctl,report,dispd,ditd,search,trace} 2>/dev/null |
| 111 |
|
|
chmod 0750 "${basedir}"/var/log/audit/ 2>/dev/null |
| 112 |
|
|
chmod 0640 "${basedir}"/etc/{audit/,}{auditd.conf,audit.rules*} 2>/dev/null |
| 113 |
|
|
} |