# Copyright 1999-2004 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 # $Header:$ DESCRIPTION="Tools for using laptop_mode from kernel" HOMEPAGE="http://www.xs4all.nl/~bsamwel/laptop_mode/" SRC_URI="http://www.xs4all.nl/~bsamwel/laptop_mode/tools/downloads/${PN}_${PV}.tar.gz" LICENSE="GPL-2" SLOT="0" KEYWORDS="~x86" IUSE="acpi apm" DEPEND="acpi? ( sys-apps/acpid ) apm? ( sys-apps/apmd ) virtual/linux-sources" src_unpack() { unpack ${A} # Relying on KV isn't sufficient, older ones could be patched. if [ ! -f /proc/sys/vm/laptop_mode ] ; then eerror "Your kernel is compiled without laptop_mode support." eerror "You need at least kernel 2.6.6 or later." fi } src_compile() { true; } src_install() { # fix install script - needs PREFIX support # and mustn't start laptop-mode in the end sed -i -e "s/\/etc/\${PREFIX}\/etc/g" \ -e "s/\/usr/\${PREFIX}\/usr/g" \ -e "s/\/usr\/local\/man/\/usr\/share\/man/g" \ -e "s/RCPROG=$/RCPROG=\/bin\/true/" install.sh # install.sh doesn't create every directory useq apm && dodir /etc/apm useq acpi && dodir /etc/acpi dodir /usr/sbin dodir /etc/init.d PREFIX="${D}" ./install.sh 2>/dev/null || die "Died running install.sh - exit code $?" # install our own init script exeinto /etc/init.d newexe ${FILESDIR}/laptop-mode.init laptop-mode } pkg_postinst() { echo einfo "laptop-mode is installed on your system. Configuration is done" einfo "in /etc/laptop-mode/laptop-mode.conf." if useq acpi then einfo "laptop-mode will automatically be started in battery mode." einfo "Remove the lm_* files in /etc/acpi/events and /etc/acpi/actions" einfo "to avoid this." elif useq apm then einfo "laptop-mode will automatically be started in battery mode." einfo "Remove laptop-mode from etc/apm/event.d/ to avoid this." else einfo "If you want it to be started automatically in battery mode," einfo "please emerge laptop-mode-tools with either" einfo "apm or acpi USE flag set." fi echo }