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