# Copyright 1999-2004 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 # $Header: $ inherit eutils linux-info ATOP_INIT_VERSION="1.9" ATOP_INIT_SCRIPT=${PN}-${ATOP_INIT_VERSION}-initscript DESCRIPTION="Resource-specific view of processes" SRC_URI="ftp://ftp.atcomputing.nl/pub/tools/linux/${P}.tar.gz mirror://gentoo/${PN}-${ATOP_INIT_VERSION}-initscript kernel_patch? (http://www.atconsultancy.nl/atop/packages/${PN}patch-${PV}.tar.gz)" HOMEPAGE="http://www.atconsultancy.nl/atop/" LICENSE="GPL-2" SLOT="0" DEPEND="sys-apps/acct" KEYWORDS="~x86 ~amd64" IUSE="kernel_patch" # pkg_preinst aviods sandboxing issues for kernel patches pkg_preinst() { use kernel_patch && { if kernel_is 2 6 8 then cp ${WORKDIR}/${PN}patch-${PV}/01patch-2.6.8_atopcnt /usr/src/ cp ${WORKDIR}/${PN}patch-${PV}/02patch-2.6.8_atopacct /usr/src/ cd /usr/src patch -p0 < 01patch-2.6.8_atopcnt || die "kernel patching failed." patch -p0 < 02patch-2.6.8_atopacct || die "kernel patching failed" rm -f /usr/src/02patch-2.6.8_atopacct /usr/src/01patch-2.6.8_atopcnt else die "Your kernel must be 2.6.8 for USE=\"kernel_patch\" to work" fi } } src_unpack() { unpack ${A} || die "unpack failed" cd ${S} mv ${S}/atop.init ${S}/atop.init.old cp ${DISTDIR}/${ATOP_INIT_SCRIPT} ${S}/atop.init } src_compile() { cd ${S} emake || die "emake failed" } src_install() { make DESTDIR=${D} INIPATH=/etc/init.d install || die "make install failed" dodoc README } pkg_postinst() { echo "" use kernel_patch || { einfo "Version >= 1.14 of this package include" einfo "optional patches to the kernel to increase" einfo "functionality of the program. To enable" einfo "them, please recompile this package with" einfo "USE=\"kernel_patch\", and ensure that" einfo "/usr/src/linux points to your kernel. It" einfo "will then be necessary to recompile your kernel." } use kernel_patch && { einfo "You have chosen to install this package and its" einfo "kernel patches. /usr/src/linux has been patched." echo "" ewarn "You will, of course, need to recompile your" ewarn "kernel for the patches to become useful." } echo "" ewarn "Please be aware that these patches are made for" ewarn "linux-2.6.8 (non-vanilla SEEMS to work as well," ewarn "so don't worry if you have gentoo-dev-sources-2.6.8" ewarn "or something along those lines). They are not known" ewarn "to work on versions other than 2.6.8. Hopefully" ewarn "developers upstream will fix this soon!" echo "" }