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
22 acpi? ( sys-power/acpid )
23 apm? ( sys-apps/apmd )
24 bluetooth? ( net-wireless/bluez:= )"
27 S="${WORKDIR}/${MY_P}"
31 # This should avoid conflict with pm-powersave wrt #327443 and #396703
32 cat <<-EOF > "${T}"/${PN}
33 HOOK_BLACKLIST="00powersave"
42 MAN_D="/usr/share/man" \
43 LIB_D="/usr/$(get_libdir)" \
44 UDEV_D="$(get_udevdir)" \
45 SYSTEMD_UNIT_D="$(systemd_get_systemunitdir)" \
46 TMPFILES_D="/usr/lib/tmpfiles.d" \
47 ACPI="$(use acpi && echo force || echo disabled)" \
48 PMU="$(false && echo force || echo disabled)" \
49 APM="$(use apm && echo force || echo disabled)" \
51 sh ./install.sh || die
53 dodoc Documentation/*.txt README.md
54 newinitd "${FILESDIR}"/laptop_mode.init-1.4 laptop_mode
57 insinto /etc/pm/config.d
62 if use acpi || use apm; then
68 if [ "$(rc-config list default | grep laptop_mode)" = "" ] || [ "$(rc-config list default | grep ${daemon_name} )" = "" ]; then
69 ewarn "To enable automatic power state event handling,"
70 ewarn "e.g. enabling laptop_mode after unplugging the battery,"
71 ewarn "both laptop_mode and the ${daemon_name} daemon must be"
72 ewarn "added to default runlevel:"
73 if [ "$(rc-config list default | grep laptop_mode)" = "" ]; then
74 ewarn "# rc-update add laptop_mode default"
76 if [ "$(rc-config list default | grep ${daemon_name} )" = "" ]; then
77 ewarn "# rc-update add ${daemon_name} default"
81 ewarn "Without USE=\"acpi\" or USE=\"apm\" ${PN} can not"
82 ewarn "automatically disable laptop_mode on low battery."
84 ewarn "This means you can lose up to 10 minutes of work if running"
85 ewarn "out of battery while laptop_mode is enabled."
87 ewarn "Please see laptop-mode.txt in /usr/share/doc/${PF} for further"