summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJulien Roy <julien@jroy.ca>2023-03-16 18:29:38 -0400
committerPacho Ramos <pacho@gentoo.org>2023-03-19 17:56:32 +0100
commit40417f0c131cb66e15dc4442a3104a4cfd295a91 (patch)
treec0cafaf2af15de3a06aa7e51c0b85c23c3eba843 /sys-power/power-profiles-daemon
parentmedia-fonts/noto-emoji: drop 20220912 (diff)
downloadgentoo-40417f0c131cb66e15dc4442a3104a4cfd295a91.tar.gz
gentoo-40417f0c131cb66e15dc4442a3104a4cfd295a91.tar.bz2
gentoo-40417f0c131cb66e15dc4442a3104a4cfd295a91.zip
sys-power/power-profiles-daemon: add openrc init script
Closes: https://bugs.gentoo.org/900901 Signed-off-by: Julien Roy <julien@jroy.ca> Closes: https://github.com/gentoo/gentoo/pull/30166 Signed-off-by: Pacho Ramos <pacho@gentoo.org>
Diffstat (limited to 'sys-power/power-profiles-daemon')
-rw-r--r--sys-power/power-profiles-daemon/files/power-profiles-daemon.initd14
-rw-r--r--sys-power/power-profiles-daemon/power-profiles-daemon-0.12-r1.ebuild73
2 files changed, 87 insertions, 0 deletions
diff --git a/sys-power/power-profiles-daemon/files/power-profiles-daemon.initd b/sys-power/power-profiles-daemon/files/power-profiles-daemon.initd
new file mode 100644
index 000000000000..d16735e930f8
--- /dev/null
+++ b/sys-power/power-profiles-daemon/files/power-profiles-daemon.initd
@@ -0,0 +1,14 @@
+#!/sbin/openrc-run
+# Copyright 1999-2023 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+name="power-profiles-daemon"
+description="Makes power profiles handling available over D-Bus"
+
+pidfile="/run/power-profiles-daemon.pid"
+command="/usr/libexec/power-profiles-daemon"
+command_background=true
+
+start_pre() {
+ checkpath -d /var/lib/power-profiles-daemon
+}
diff --git a/sys-power/power-profiles-daemon/power-profiles-daemon-0.12-r1.ebuild b/sys-power/power-profiles-daemon/power-profiles-daemon-0.12-r1.ebuild
new file mode 100644
index 000000000000..36656c234b6d
--- /dev/null
+++ b/sys-power/power-profiles-daemon/power-profiles-daemon-0.12-r1.ebuild
@@ -0,0 +1,73 @@
+# Copyright 1999-2023 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+PYTHON_COMPAT=( python3_{9..11} )
+
+inherit meson python-single-r1 systemd
+
+DESCRIPTION="Makes power profiles handling available over D-Bus"
+HOMEPAGE="https://gitlab.freedesktop.org/hadess/power-profiles-daemon/"
+SRC_URI="https://gitlab.freedesktop.org/hadess/${PN}/-/archive/${PV}/${P}.tar.bz2"
+
+LICENSE="GPL-3+"
+SLOT="0"
+KEYWORDS="~amd64"
+
+IUSE="gtk-doc test"
+REQUIRED_USE="${PYTHON_REQUIRED_USE}"
+
+RESTRICT="!test? ( test )"
+
+RDEPEND="${PYTHON_DEPS}
+ $(python_gen_cond_dep 'dev-python/pygobject:3[${PYTHON_USEDEP}]')
+ dev-libs/glib:2
+ >=dev-libs/libgudev-234
+ >=sys-auth/polkit-0.114
+ sys-power/upower
+"
+DEPEND="${RDEPEND}"
+BDEPEND="
+ gtk-doc? ( dev-util/gi-docgen )
+ test? (
+ dev-util/umockdev
+ $(python_gen_cond_dep '
+ dev-python/pygobject:3[${PYTHON_USEDEP}]
+ dev-python/python-dbusmock[${PYTHON_USEDEP}]
+ ')
+ )
+"
+
+python_check_deps() {
+ if use test; then
+ python_has_version "dev-python/python-dbusmock[${PYTHON_USEDEP}]" &&
+ python_has_version "dev-python/pygobject:3[${PYTHON_USEDEP}]"
+ else
+ python_has_version "dev-python/pygobject:3[${PYTHON_USEDEP}]"
+ fi
+}
+
+src_configure() {
+ local emesonargs=(
+ -Dsystemdsystemunitdir="$(systemd_get_systemunitdir)"
+ $(meson_use gtk-doc gtk_doc)
+ $(meson_use test tests)
+ )
+ meson_src_configure
+}
+
+src_install() {
+ meson_src_install
+ python_fix_shebang "${D}"/usr/bin/powerprofilesctl
+
+ newinitd "${FILESDIR}/power-profiles-daemon.initd" power-profiles-daemon
+}
+
+pkg_postinst() {
+ if [[ -z "${REPLACING_VERSIONS}" ]]; then
+ if systemd_is_booted; then
+ elog "You need to enable the service:"
+ elog "# systemctl enable ${PN}"
+ fi
+ fi
+}