commit:     40417f0c131cb66e15dc4442a3104a4cfd295a91
Author:     Julien Roy <julien <AT> jroy <DOT> ca>
AuthorDate: Thu Mar 16 22:29:38 2023 +0000
Commit:     Pacho Ramos <pacho <AT> gentoo <DOT> org>
CommitDate: Sun Mar 19 16:56:32 2023 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=40417f0c

sys-power/power-profiles-daemon: add openrc init script

Closes: https://bugs.gentoo.org/900901
Signed-off-by: Julien Roy <julien <AT> jroy.ca>
Closes: https://github.com/gentoo/gentoo/pull/30166
Signed-off-by: Pacho Ramos <pacho <AT> gentoo.org>

 .../files/power-profiles-daemon.initd              | 14 +++++
 .../power-profiles-daemon-0.12-r1.ebuild           | 73 ++++++++++++++++++++++
 2 files changed, 87 insertions(+)

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

Reply via email to