1 # Copyright 1999-2019 Gentoo Authors
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 "${FILESDIR}/0001-Fix-case-sensitive-name-for-lmt.py.patch"
34 S="${WORKDIR}/${MY_P}"
38 # This should avoid conflict with pm-powersave wrt #327443 and #396703
39 cat <<-EOF > "${T}"/${PN}
40 HOOK_BLACKLIST="00powersave"
49 MAN_D="/usr/share/man" \
50 LIB_D="/usr/$(get_libdir)" \
51 UDEV_D="$(get_udevdir)" \
52 SYSTEMD_UNIT_D="$(systemd_get_systemunitdir)" \
53 TMPFILES_D="/usr/lib/tmpfiles.d" \
54 ACPI="$(use acpi && echo force || echo disabled)" \
55 PMU="$(false && echo force || echo disabled)" \
56 APM="$(use apm && echo force || echo disabled)" \
58 sh ./install.sh || die
60 dodoc Documentation/*.txt README.md
61 newinitd "${FILESDIR}"/laptop_mode.init-1.4 laptop_mode
64 insinto /etc/pm/config.d
69 if use acpi || use apm; then
75 if [ "$(rc-config list default | grep laptop_mode)" = "" ] || [ "$(rc-config list default | grep ${daemon_name} )" = "" ]; then
76 ewarn "To enable automatic power state event handling,"
77 ewarn "e.g. enabling laptop_mode after unplugging the battery,"
78 ewarn "both laptop_mode and the ${daemon_name} daemon must be"
79 ewarn "added to default runlevel:"
80 if [ "$(rc-config list default | grep laptop_mode)" = "" ]; then
81 ewarn "# rc-update add laptop_mode default"
83 if [ "$(rc-config list default | grep ${daemon_name} )" = "" ]; then
84 ewarn "# rc-update add ${daemon_name} default"
88 ewarn "Without USE=\"acpi\" or USE=\"apm\" ${PN} can not"
89 ewarn "automatically disable laptop_mode on low battery."
91 ewarn "This means you can lose up to 10 minutes of work if running"
92 ewarn "out of battery while laptop_mode is enabled."
94 ewarn "Please see laptop-mode.txt in /usr/share/doc/${PF} for further"