1 # Copyright 1999-2018 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
6 inherit 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"
19 RDEPEND="sys-apps/iproute2
26 acpi? ( sys-power/acpid )
27 apm? ( sys-apps/apmd )
28 bluetooth? ( net-wireless/bluez:= )"
31 S="${WORKDIR}/${MY_P}"
35 # This should avoid conflict with pm-powersave wrt #327443 and #396703
36 cat <<-EOF > "${T}"/${PN}
37 HOOK_BLACKLIST="00powersave"
46 MAN_D="/usr/share/man" \
47 LIB_D="/usr/$(get_libdir)" \
48 UDEV_D="$(get_udevdir)" \
49 SYSTEMD_UNIT_D="$(systemd_get_systemunitdir)" \
50 TMPFILES_D="/usr/lib/tmpfiles.d" \
51 ACPI="$(use acpi && echo force || echo disabled)" \
52 PMU="$(false && echo force || echo disabled)" \
53 APM="$(use apm && echo force || echo disabled)" \
55 sh ./install.sh || die
57 dodoc Documentation/*.txt README.md
58 newinitd "${FILESDIR}"/laptop_mode.init-1.4 laptop_mode
61 insinto /etc/pm/config.d
66 if use acpi || use apm; then
72 if [ "$(rc-config list default | grep laptop_mode)" = "" ] || [ "$(rc-config list default | grep ${daemon_name} )" = "" ]; then
73 ewarn "To enable automatic power state event handling,"
74 ewarn "e.g. enabling laptop_mode after unplugging the battery,"
75 ewarn "both laptop_mode and the ${daemon_name} daemon must be"
76 ewarn "added to default runlevel:"
77 if [ "$(rc-config list default | grep laptop_mode)" = "" ]; then
78 ewarn "# rc-update add laptop_mode default"
80 if [ "$(rc-config list default | grep ${daemon_name} )" = "" ]; then
81 ewarn "# rc-update add ${daemon_name} default"
85 ewarn "Without USE=\"acpi\" or USE=\"apm\" ${PN} can not"
86 ewarn "automatically disable laptop_mode on low battery."
88 ewarn "This means you can lose up to 10 minutes of work if running"
89 ewarn "out of battery while laptop_mode is enabled."
91 ewarn "Please see laptop-mode.txt in /usr/share/doc/${PF} for further"