# Copyright 1999-2005 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 # $Header: $ DESCRIPTION="A convenience package to work with Linux laptop mode." HOMEPAGE="http://www.xs4all.nl/~bsamwel/laptop_mode/tools/" SRC_URI="http://www.xs4all.nl/~bsamwel/laptop_mode/tools/downloads/${PN}_${PV}.tar.gz" RESTRICT="nostrip" LICENSE="GPL-2" SLOT="0" KEYWORDS="~x86" IUSE="acpi apm doc" DEPEND= "acpi? ( sys-apps/acpid ) apm? ( sys-apps/apmd ) virtual/linux-sources" pkg_setup() { # warn if laptop_mode is not supported (yet?) by current kernels local unusable unusable="false" if [ ! -e /proc/sys/vm/laptop_mode ] ; then ewarn "Your current running kernel is not compiled with laptop_mode support." unusable="true" fi if [ ! -e ${ROOT}usr/src/linux/Documentation/laptop-mode.txt ] ; then ewarn "Kernel in /usr/src/linux does not support laptop mode." unusable="true" fi if [ ${unusable} = "true" ] ; then einfo "You need kernel 2.4.23 and above or 2.6.6 and above to use laptop_mode." fi } src_compile() { return 0 } src_install() { dosbin usr/sbin/laptop_mode dosbin usr/sbin/lm-syslog-setup # install our own init script newinitd ${FILESDIR}/laptop-mode.init laptop-mode dodir /etc/laptop-mode insinto /etc/laptop-mode doins etc/laptop-mode/laptop-mode.conf doman man/laptop_mode.8 doman man/laptop-mode.conf.8 dodoc README Documentation/laptop-mode.txt if useq doc; then if useq acpi; then docinto examples/etc/acpi/actions dodoc etc/acpi/actions/* docinto examples/etc/acpi/events dodoc etc/acpi/events/* fi if useq apm; then docinto examples/etc/apm/event.d dodoc etc/apm/event.d/* fi fi } pkg_postinst() { einfo "" einfo "You can use the \"laptop-mode\" init script to enter or exit laptop" einfo "mode. A configuration file can be found here:" einfo " /etc/laptop-mode/laptop-mode.conf" if useq doc; then einfo "" einfo "Example scripts have been installed in:" einfo " /usr/share/doc/${PF}/examples/" fi einfo "" einfo "For further instructions please read:" einfo " /usr/share/doc/${PF}/README.gz" einfo " /usr/share/doc/${PF}/laptopmode.txt.gz" einfo "" }