mirror of
https://github.com/gentoo-mirror/guru.git
synced 2026-07-19 20:13:01 -04:00
sys-power/tlp: initial import
Signed-off-by: Duje Mihanović <duje.mihanovic@skole.hr>
This commit is contained in:
1
sys-power/tlp/Manifest
Normal file
1
sys-power/tlp/Manifest
Normal file
@@ -0,0 +1 @@
|
||||
DIST tlp-1.5.0.tar.gz 126447 BLAKE2B cdd2a5d094d1146a534de07cc646fd428a97f8d40c3d4ed5ec0522848ebe3a4182e36617854feeab7fa8923f7e7ef6797623a09609fdfa2a2b5dda321b188b31 SHA512 93be83f276b902467049160c20a546cdf2f0ec221274bbb4761bf89a8da09f10a494ce2f36379ef9be48ca2e7325de8e582f5dbb823e2ddd339366bae1228122
|
||||
18
sys-power/tlp/files/tlp-1.5.0-Makefile.patch
Normal file
18
sys-power/tlp/files/tlp-1.5.0-Makefile.patch
Normal file
@@ -0,0 +1,18 @@
|
||||
diff --git a/Makefile b/Makefile
|
||||
index b81451c..d154b6b 100644
|
||||
--- a/Makefile
|
||||
+++ b/Makefile
|
||||
@@ -14,10 +14,10 @@ TLP_CONFDIR ?= /etc/tlp.d
|
||||
TLP_CONFDEF ?= /usr/share/tlp/defaults.conf
|
||||
TLP_CONFREN ?= /usr/share/tlp/rename.conf
|
||||
TLP_CONF ?= /etc/default/tlp
|
||||
-TLP_SYSD ?= /lib/systemd/system
|
||||
-TLP_SDSL ?= /lib/systemd/system-sleep
|
||||
+TLP_SYSD ?= /@LIBDIR@/systemd/system
|
||||
+TLP_SDSL ?= /@LIBDIR@/systemd/system-sleep
|
||||
TLP_SYSV ?= /etc/init.d
|
||||
-TLP_ELOD ?= /lib/elogind/system-sleep
|
||||
+TLP_ELOD ?= /@LIBDIR@/elogind/system-sleep
|
||||
TLP_SHCPL ?= /usr/share/bash-completion/completions
|
||||
TLP_MAN ?= /usr/share/man
|
||||
TLP_META ?= /usr/share/metainfo
|
||||
28
sys-power/tlp/files/tlp.init
Normal file
28
sys-power/tlp/files/tlp.init
Normal file
@@ -0,0 +1,28 @@
|
||||
#!/sbin/openrc-run
|
||||
command=/usr/sbin/tlp
|
||||
name="TLP"
|
||||
extra_started_commands="reload stat"
|
||||
|
||||
depend() {
|
||||
need udev
|
||||
}
|
||||
|
||||
start() {
|
||||
ebegin "Starting tlp..."
|
||||
$command init start
|
||||
eend $?
|
||||
}
|
||||
|
||||
reload() {
|
||||
ebegin "Reloading tlp's configuration..."
|
||||
$command start
|
||||
eend $?
|
||||
}
|
||||
|
||||
stop() {
|
||||
elog "Reboot to stop tlp."
|
||||
}
|
||||
|
||||
stat() {
|
||||
/usr/bin/tlp-stat
|
||||
}
|
||||
8
sys-power/tlp/metadata.xml
Normal file
8
sys-power/tlp/metadata.xml
Normal file
@@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE pkgmetadata SYSTEM 'https://www.gentoo.org/dtd/metadata.dtd'>
|
||||
<pkgmetadata>
|
||||
<maintainer type="person">
|
||||
<email>duje.mihanovic@skole.hr</email>
|
||||
<name>Duje Mihanović</name>
|
||||
</maintainer>
|
||||
</pkgmetadata>
|
||||
59
sys-power/tlp/tlp-1.5.0.ebuild
Normal file
59
sys-power/tlp/tlp-1.5.0.ebuild
Normal file
@@ -0,0 +1,59 @@
|
||||
# Copyright 1999-2022 Gentoo Authors
|
||||
# Distributed under the terms of the GNU General Public License v2
|
||||
|
||||
EAPI=8
|
||||
|
||||
inherit udev
|
||||
|
||||
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"
|
||||
IUSE="bash-completion elogind systemd"
|
||||
RESTRICT="mirror"
|
||||
RDEPEND="virtual/udev
|
||||
bash-completion? ( app-shells/bash app-shells/bash-completion )
|
||||
elogind? ( sys-auth/elogind )
|
||||
systemd? ( sys-apps/systemd )"
|
||||
DEPEND="${RDEPEND}"
|
||||
REQUIRED_USE="?? ( elogind systemd )"
|
||||
PATCHES="${FILESDIR}/${PN}-1.5.0-Makefile.patch"
|
||||
CONFIG_PROTECT="/etc/tlp.conf /etc/tlp.d"
|
||||
|
||||
src_prepare() {
|
||||
default
|
||||
sed -i "s/@LIBDIR@/$(get_libdir)/g" "${S}/Makefile"
|
||||
}
|
||||
|
||||
src_compile() {
|
||||
emake
|
||||
}
|
||||
|
||||
src_install() {
|
||||
if use bash-completion; then export bashcomp=0; else export bashcomp=1; fi
|
||||
if use elogind; then export elogind=1; else export elogind=0; fi
|
||||
if use systemd; then export systemd=1; else export systemd=0; fi
|
||||
|
||||
emake \
|
||||
DESTDIR="${D}" \
|
||||
TLP_NO_INIT=1 \
|
||||
TLP_NO_BASHCOMP=$bashcomp \
|
||||
TLP_WITH_ELOGIND=$elogind \
|
||||
TLP_WITH_SYSTEMD=$systemd \
|
||||
install install-man
|
||||
|
||||
chmod 444 "${D}/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
|
||||
|
||||
elog "Consider installing these optional dependencies:"
|
||||
elog "- sys-apps/ethtool to allow disabling WoL"
|
||||
elog "- sys-apps/smartmontools for disk drive health info in tlp-stat"
|
||||
}
|
||||
Reference in New Issue
Block a user