aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDuje Mihanović <duje.mihanovic@skole.hr>2022-05-05 00:03:08 +0200
committerDuje Mihanović <duje.mihanovic@skole.hr>2022-05-05 00:03:08 +0200
commit87d38d871ba96affad6d8c34b05efe46fdc745fb (patch)
tree1c4172eabec4eebeffc446ed500fb01c8bea9cae /sys-power
parentnet-proxy/toxiproxy: 2.4.0-r1 (diff)
downloadguru-87d38d871ba96affad6d8c34b05efe46fdc745fb.tar.gz
guru-87d38d871ba96affad6d8c34b05efe46fdc745fb.tar.bz2
guru-87d38d871ba96affad6d8c34b05efe46fdc745fb.zip
sys-power/tlp: initial import
Signed-off-by: Duje Mihanović <duje.mihanovic@skole.hr>
Diffstat (limited to 'sys-power')
-rw-r--r--sys-power/tlp/Manifest1
-rw-r--r--sys-power/tlp/files/tlp-1.5.0-Makefile.patch18
-rw-r--r--sys-power/tlp/files/tlp.init28
-rw-r--r--sys-power/tlp/metadata.xml8
-rw-r--r--sys-power/tlp/tlp-1.5.0.ebuild59
5 files changed, 114 insertions, 0 deletions
diff --git a/sys-power/tlp/Manifest b/sys-power/tlp/Manifest
new file mode 100644
index 000000000..5cddbd3ad
--- /dev/null
+++ b/sys-power/tlp/Manifest
@@ -0,0 +1 @@
+DIST tlp-1.5.0.tar.gz 126447 BLAKE2B cdd2a5d094d1146a534de07cc646fd428a97f8d40c3d4ed5ec0522848ebe3a4182e36617854feeab7fa8923f7e7ef6797623a09609fdfa2a2b5dda321b188b31 SHA512 93be83f276b902467049160c20a546cdf2f0ec221274bbb4761bf89a8da09f10a494ce2f36379ef9be48ca2e7325de8e582f5dbb823e2ddd339366bae1228122
diff --git a/sys-power/tlp/files/tlp-1.5.0-Makefile.patch b/sys-power/tlp/files/tlp-1.5.0-Makefile.patch
new file mode 100644
index 000000000..58667ee21
--- /dev/null
+++ b/sys-power/tlp/files/tlp-1.5.0-Makefile.patch
@@ -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
diff --git a/sys-power/tlp/files/tlp.init b/sys-power/tlp/files/tlp.init
new file mode 100644
index 000000000..f50de9029
--- /dev/null
+++ b/sys-power/tlp/files/tlp.init
@@ -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
+}
diff --git a/sys-power/tlp/metadata.xml b/sys-power/tlp/metadata.xml
new file mode 100644
index 000000000..62988a0d4
--- /dev/null
+++ b/sys-power/tlp/metadata.xml
@@ -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>
diff --git a/sys-power/tlp/tlp-1.5.0.ebuild b/sys-power/tlp/tlp-1.5.0.ebuild
new file mode 100644
index 000000000..624b437c5
--- /dev/null
+++ b/sys-power/tlp/tlp-1.5.0.ebuild
@@ -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"
+}