aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Roman <davidroman96@gmail.com>2024-01-31 23:18:19 +0100
committerDavid Roman <davidroman96@gmail.com>2024-01-31 23:18:19 +0100
commit8c9c2f0f60380a6dcbf84caf3cf5d457cd991f2f (patch)
tree9fbc9bae462555aa31357612f58a1c869b3d0757 /sys-power
parentapp-admin/himitsu: add 0.6, drop 0.5 (diff)
downloadguru-8c9c2f0f60380a6dcbf84caf3cf5d457cd991f2f.tar.gz
guru-8c9c2f0f60380a6dcbf84caf3cf5d457cd991f2f.tar.bz2
guru-8c9c2f0f60380a6dcbf84caf3cf5d457cd991f2f.zip
sys-power/auto-cpufreq: fix systemd service and gui
Signed-off-by: David Roman <davidroman96@gmail.com>
Diffstat (limited to 'sys-power')
-rw-r--r--sys-power/auto-cpufreq/auto-cpufreq-2.1.0-r1.ebuild83
-rw-r--r--sys-power/auto-cpufreq/files/auto-cpufreq.service12
2 files changed, 95 insertions, 0 deletions
diff --git a/sys-power/auto-cpufreq/auto-cpufreq-2.1.0-r1.ebuild b/sys-power/auto-cpufreq/auto-cpufreq-2.1.0-r1.ebuild
new file mode 100644
index 000000000..ea80f8e18
--- /dev/null
+++ b/sys-power/auto-cpufreq/auto-cpufreq-2.1.0-r1.ebuild
@@ -0,0 +1,83 @@
+# Copyright 1999-2022 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+PYTHON_COMPAT=( python3_{10..12} )
+
+DISTUTILS_USE_PEP517=poetry
+
+inherit distutils-r1 systemd
+
+DESCRIPTION="Automatic CPU speed & power optimizer for Linux"
+HOMEPAGE="https://github.com/AdnanHodzic/auto-cpufreq"
+SRC_URI="https://github.com/AdnanHodzic/${PN}/archive/v${PV}.tar.gz -> ${P}.tar.gz"
+
+LICENSE="GPL-3"
+KEYWORDS="~amd64"
+SLOT="0"
+
+RDEPEND="
+ dev-python/click[${PYTHON_USEDEP}]
+ dev-python/distro[${PYTHON_USEDEP}]
+ dev-python/psutil[${PYTHON_USEDEP}]
+ dev-python/pygobject[${PYTHON_USEDEP}]
+ dev-python/requests[${PYTHON_USEDEP}]
+"
+
+DEPEND="${RDEPEND}"
+
+DOCS=( README.md )
+PATCHES=( "${FILESDIR}/${PN}-remove-poetry_versioning.patch" )
+
+src_prepare() {
+ sed -i 's|usr/local|usr|g' "scripts/${PN}.service" "scripts/${PN}-openrc" auto_cpufreq/core.py || die
+ sed -i 's|usr/local|usr|g' "scripts/${PN}.service" "scripts/${PN}-openrc" auto_cpufreq/gui/app.py || die
+ distutils-r1_src_prepare
+}
+
+python_install() {
+ distutils-r1_python_install
+
+ exeinto "/usr/share/${PN}/scripts"
+ doexe scripts/cpufreqctl.sh
+
+ insinto "/usr/share/${PN}/scripts"
+ doins scripts/style.css
+
+ insinto "/usr/share/${PN}/images"
+ doins images/*
+
+ systemd_douserunit "${FILESDIR}/${PN}.service"
+ newinitd "scripts/${PN}-openrc" "${PN}"
+}
+
+pkg_postinst() {
+ touch /var/log/auto-cpufreq.log
+
+ elog ""
+ elog "Enable auto-cpufreq daemon service at boot:"
+ elog "systemd: systemctl enable --now auto-cpufreq"
+ elog "openrc: rc-update add auto-cpufreq default"
+ elog ""
+ elog "To view live log, run:"
+ elog "auto-cpufreq --stats"
+}
+
+pkg_postrm() {
+ # Remove auto-cpufreq log file
+ if [ -f "/var/log/auto-cpufreq.log" ]; then
+ rm /var/log/auto-cpufreq.log || die
+ fi
+
+ # Remove auto-cpufreq's cpufreqctl binary
+ # it overwrites cpufreqctl.sh
+ if [ -f "/usr/bin/cpufreqctl" ]; then
+ rm /usr/bin/cpufreqctl || die
+ fi
+
+ # Restore original cpufreqctl binary if backup was made
+ if [ -f "/usr/bin/cpufreqctl.auto-cpufreq.bak" ]; then
+ mv /usr/bin/cpufreqctl.auto-cpufreq.bak /usr/bin/cpufreqctl || die
+ fi
+}
diff --git a/sys-power/auto-cpufreq/files/auto-cpufreq.service b/sys-power/auto-cpufreq/files/auto-cpufreq.service
new file mode 100644
index 000000000..494942d83
--- /dev/null
+++ b/sys-power/auto-cpufreq/files/auto-cpufreq.service
@@ -0,0 +1,12 @@
+[Unit]
+Description=auto-cpufreq - Automatic CPU speed & power optimizer for Linux
+After=network.target network-online.target
+
+[Service]
+Type=simple
+User=root
+ExecStart=auto-cpufreq --daemon
+Restart=on-failure
+
+[Install]
+WantedBy=multi-user.target