1 # Copyright 1999-2016 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
6 inherit eutils multilib systemd udev
10 DESCRIPTION="Linux kernel laptop_mode user-space utilities"
11 HOMEPAGE="https://github.com/rickysarraf/laptop-mode-tools/wiki"
12 SRC_URI="https://github.com/rickysarraf/${PN}/releases/download/${PV}/${MY_P}.tar.gz"
16 KEYWORDS="~amd64 ~ppc ~x86"
17 IUSE="+acpi apm bluetooth scsi"
19 RDEPEND="net-wireless/wireless-tools
24 acpi? ( sys-power/acpid )
25 apm? ( sys-apps/apmd )
26 bluetooth? ( net-wireless/bluez:= )
27 scsi? ( sys-apps/sdparm )"
33 # This should avoid conflict with pm-powersave wrt #327443 and #396703
34 cat <<-EOF > "${T}"/${PN}
35 HOOK_BLACKLIST="00powersave"
44 MAN_D="/usr/share/man" \
45 LIB_D="/usr/$(get_libdir)" \
46 UDEV_D="$(get_udevdir)" \
47 SYSTEMD_UNIT_D="$(systemd_get_unitdir)" \
48 TMPFILES_D="/usr/lib/tmpfiles.d" \
49 ACPI="$(use acpi && echo force || echo disabled)" \
50 PMU="$(false && echo force || echo disabled)" \
51 APM="$(use apm && echo force || echo disabled)" \
53 sh ./install.sh || die
55 dodoc Documentation/*.txt README.md
56 newinitd "${FILESDIR}"/laptop_mode.init-1.4 laptop_mode
59 insinto /etc/pm/config.d
64 if use acpi || use apm; then
70 if [ "$(rc-config list default | grep laptop_mode)" = "" ] || [ "$(rc-config list default | grep ${daemon_name} )" = "" ]; then
71 ewarn "To enable automatic power state event handling,"
72 ewarn "e.g. enabling laptop_mode after unplugging the battery,"
73 ewarn "both laptop_mode and the ${daemon_name} daemon must be"
74 ewarn "added to default runlevel:"
75 if [ "$(rc-config list default | grep laptop_mode)" = "" ]; then
76 ewarn "# rc-update add laptop_mode default"
78 if [ "$(rc-config list default | grep ${daemon_name} )" = "" ]; then
79 ewarn "# rc-update add ${daemon_name} default"
83 ewarn "Without USE=\"acpi\" or USE=\"apm\" ${PN} can not"
84 ewarn "automatically disable laptop_mode on low battery."
86 ewarn "This means you can lose up to 10 minutes of work if running"
87 ewarn "out of battery while laptop_mode is enabled."
89 ewarn "Please see laptop-mode.txt in /usr/share/doc/${PF} for further"