aboutsummaryrefslogtreecommitdiff
blob: bf18bbbb7d2507e0918aea4573332f01c2b4b8e9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
# Copyright 1999-2022 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2

EAPI=8

inherit udev optfeature

DESCRIPTION="Optimize laptop battery life"
HOMEPAGE="https://linrunner.de/tlp/"
SRC_URI="https://github.com/linrunner/TLP/archive/refs/tags/${PV}.tar.gz -> ${P}.tar.gz"
S="${WORKDIR}/TLP-${PV}"
LICENSE="GPL-2"
SLOT="0"
KEYWORDS="~amd64"
RESTRICT="mirror"
# It's uncertain if elogind/systemd is actually required, however, without the sleep
# hooks working, which require one of them, it doesn't seem like this app is very useful.
RDEPEND="virtual/udev
		|| ( sys-auth/elogind sys-apps/systemd )"
DEPEND="${RDEPEND}"

src_install() {
	emake \
		DESTDIR="${D}" \
		TLP_NO_INIT=1 \
		TLP_WITH_ELOGIND=1 \
		TLP_WITH_SYSTEMD=1 \
		install install-man

	fperms 444 "/usr/share/tlp/defaults.conf" # manpage says this file should not be edited
	newinitd "${FILESDIR}/tlp.init" tlp
	keepdir "/var/lib/tlp" # created by Makefile, probably important
}

pkg_postinst() {
	udev_reload

	optfeature "disable Wake-on-LAN" sys-apps/ethtool
	optfeature "see disk drive health info in tlp-stat" sys-apps/smartmontools
}

pkg_postrm() {
	udev_reload
}