sys-power/tlp: Fix systemd support

Prior to this change, systemd units were not properly installed.

Additional style and simplification fixes as needed.

Signed-off-by: Jay Faulkner <jay@jvf.cc>
This commit is contained in:
Jay Faulkner
2022-08-27 21:53:40 -07:00
parent 005e124245
commit 01c3100ab2
2 changed files with 3 additions and 36 deletions

View File

@@ -1,18 +0,0 @@
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

View File

@@ -20,29 +20,14 @@ RDEPEND="virtual/udev
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 \
TLP_NO_BASHCOMP=$(usex bash-completion 0 1) \
TLP_WITH_ELOGIND=$(usex elogind 1 0) \
TLP_WITH_SYSTEMD=$(usex systemd 1 0) \
install install-man
chmod 444 "${D}/usr/share/tlp/defaults.conf" # manpage says this file should not be edited