# Copyright 1999-2007 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: $

DESCRIPTION="Brightd is a daemon for automated LCD brightess control"
HOMEPAGE="http://www.pberndt.com/Programme/Linux/brightd/index.html"
SRC_URI="http://www.pberndt.com/raw/Programme/Linux/brightd/_download/${P}.tar.bz2"

LICENSE="gpl-2"
KEYWORDS="~amd64 ~x86"

DEPEND="x11-libs/libXScrnSaver"
RDEPEND="${DEPEND}"

src_install() {
	cd "${WORKDIR}/${P}" || die
	make install PREFIX=${D} || die
	newinitd ${FILESDIR}/brightd.rc brightd
	mkdir -p ${D}/etc/conf.d
	echo -e "# See man brightd for configuration options\
		\nBRIGHTD_OPTS='-r /var/tmp/.brightd'" >> ${D}/etc/conf.d/brightd
}

pkg_postinst() {
	if ! ls /sys/class/backlight/* &>/dev/null; then
		ewarn
		ewarn "This package relies on the kernel backlight interface"
		ewarn "in /sys/class/backlight/, which could not be found (yet)."
		ewarn "Make sure you compiled your kernel with the proper"
		ewarn "interface to your LCD screen"
		ewarn
	fi
}