public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-commits] repo/proj/guru:dev commit in: sys-power/tlp/files/, sys-power/tlp/
@ 2022-05-04 22:03 Duje Mihanović
  0 siblings, 0 replies; only message in thread
From: Duje Mihanović @ 2022-05-04 22:03 UTC (permalink / raw
  To: gentoo-commits

commit:     87d38d871ba96affad6d8c34b05efe46fdc745fb
Author:     Duje Mihanović <duje.mihanovic <AT> skole <DOT> hr>
AuthorDate: Wed May  4 22:03:08 2022 +0000
Commit:     Duje Mihanović <duje.mihanovic <AT> skole <DOT> hr>
CommitDate: Wed May  4 22:03:08 2022 +0000
URL:        https://gitweb.gentoo.org/repo/proj/guru.git/commit/?id=87d38d87

sys-power/tlp: initial import

Signed-off-by: Duje Mihanović <duje.mihanovic <AT> skole.hr>

 sys-power/tlp/Manifest                       |  1 +
 sys-power/tlp/files/tlp-1.5.0-Makefile.patch | 18 +++++++++
 sys-power/tlp/files/tlp.init                 | 28 +++++++++++++
 sys-power/tlp/metadata.xml                   |  8 ++++
 sys-power/tlp/tlp-1.5.0.ebuild               | 59 ++++++++++++++++++++++++++++
 5 files changed, 114 insertions(+)

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"
+}


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2022-05-04 22:03 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-05-04 22:03 [gentoo-commits] repo/proj/guru:dev commit in: sys-power/tlp/files/, sys-power/tlp/ Duje Mihanović

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox