sys-firmware/lenovolegionlinux: add openrc support and improve ebuild

* thanks to @st0nie

Closes: https://github.com/johnfanv2/LenovoLegionLinux/issues/181
Signed-off-by: Gonçalo Negrier Duarte <gonegrier.duarte@gmail.com>
This commit is contained in:
Gonçalo Negrier Duarte
2024-03-17 13:38:49 +00:00
parent fd495ee3f2
commit 92e292680e
4 changed files with 32 additions and 11 deletions

View File

@@ -0,0 +1,6 @@
#!/BIN/bash
case $1/$2 in
post/*)
/usr/bin/legiond-cli fanset 3
;;
esac

View File

@@ -0,0 +1,7 @@
#!/sbin/openrc-run
# Copyright 1999-2024 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
command="/usr/bin/legiond"
command_background=true
pidfile="/run/legiond.pid"

View File

@@ -1,4 +1,4 @@
# Copyright 1999-2023 Gentoo Authors
# Copyright 1999-2024 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=8
@@ -8,7 +8,7 @@ M_PN=LenovoLegionLinux
DISTUTILS_USE_PEP517=setuptools
PYTHON_COMPAT=(python3_{9..12})
inherit linux-mod-r1 distutils-r1 systemd
inherit linux-mod-r1 distutils-r1 systemd optfeature
if [[ ${PV} == "9999" ]]; then
EGIT_REPO_URI="https://github.com/johnfanv2/${M_PN}.git"
@@ -37,18 +37,13 @@ RDEPEND="
sys-power/acpid
)
downgrade-nvidia? ( <=x11-drivers/nvidia-drivers-525 )
radeon-dgpu? ( dev-util/rocm-smi )
ryzenadj? ( sys-power/RyzenAdj )
undervolt-intel? ( dev-python/undervolt )
"
DEPEND="${RDEPEND}"
LICENSE="GPL-2"
SLOT="0"
IUSE="+gui radeon-dgpu downgrade-nvidia ryzenadj undervolt-intel"
REQUIRED_USE="|| ( radeon-dgpu downgrade-nvidia ryzenadj gui undervolt-intel ) radeon-dgpu? ( !downgrade-nvidia gui ) downgrade-nvidia? ( !radeon-dgpu gui ) undervolt-intel? ( !ryzenadj gui ) ryzenadj? ( !undervolt-intel gui )"
IUSE="+gui downgrade-nvidia elogin"
MODULES_KERNEL_MIN=5.10
src_compile() {
@@ -83,6 +78,14 @@ src_install() {
cd "${WORKDIR}/${P}/extra" || die
systemd_dounit service/legiond.service service/legiond-onresume.service
newinitd "${FILESDIR}/legiond.initd" legiond
if use elogind; then
exeinto /lib64/elogind/system-sleep/
doexe "${FILESDIR}/legiond-onresume.sh"
fi
insinto /etc/acpi/events
doins acpi/events/{legion_ppd,legion_ac}
dobin service/legiond/legiond
@@ -105,4 +108,8 @@ pkg_postinst() {
ewarn "Note for 2023-2023 Legion user: It need help for testing the features"
ewarn "Pls test the feature how is decribe in the README of the project!"
ewarn "and also go to this issue in github: https://github.com/johnfanv2/LenovoLegionLinux/issues/46"
optfeature "radeon dgpu power management" dev-util/rocm-smi
optfeature "ryzen CPU tweaks" sys-power/RyzenAdj
optfeature "intel CPU tweaks" dev-python/undervolt
}

View File

@@ -3,14 +3,15 @@
<pkgmetadata>
<use>
<flag name="gui">Build and install legion_gui and legion_cli</flag>
<flag name="radeon-dgpu">Enable AMD GPU TDP control (systemd-service)</flag>
<flag name="downgrade-nvidia">Downgrade nvidia for 525 to enable TDP control (systemd-service)</flag>
<flag name="ryzenadj">[AMD] CPU and APU control using ryzenadj (systemd-service)</flag>
<flag name="undervolt-intel">[INTEL] CPU and APU control using undervolt (systemd-service)</flag>
<flag name="elogind">Enable legiond-onresume openrc support</flag>
</use>
<maintainer type="person">
<email>gonegrier.duarte@gmail.com</email>
<name>Gonçalo Negrier Duarte</name>
<maintainer type="person">
<email>ston.jia@outlook.com</email>
<name>ston</name>
</maintainer>
<upstream>
<remote-id type="github">johnfanv2/LenovoLegionLinux</remote-id>