summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPacho Ramos <pacho@gentoo.org>2022-12-29 11:40:10 +0100
committerPacho Ramos <pacho@gentoo.org>2022-12-29 11:44:25 +0100
commit05c2d14051f6814adc367615b155dd58c46fcc36 (patch)
treea42283938bfb2c347a0e424de015a14d5492db39 /sys-power
parentsci-libs/rocBLAS: remove unused patches (diff)
downloadgentoo-05c2d14051f6814adc367615b155dd58c46fcc36.tar.gz
gentoo-05c2d14051f6814adc367615b155dd58c46fcc36.tar.bz2
gentoo-05c2d14051f6814adc367615b155dd58c46fcc36.zip
sys-power/switcheroo-control: Support openRC too
It seems switcheroo-control can also run on openRC systems with an init.d service. Install service files for both unconditionally following current policy of not relying on USE flags to control single-files installation. Thanks-to: Jan Henke Thanks-to: GDH-gentoo Thanks-to: fedeliallalinea Closes: https://bugs.gentoo.org/888199 Signed-off-by: Pacho Ramos <pacho@gentoo.org>
Diffstat (limited to 'sys-power')
-rw-r--r--sys-power/switcheroo-control/files/switcheroo-control-init.d12
-rw-r--r--sys-power/switcheroo-control/switcheroo-control-2.6-r1.ebuild63
2 files changed, 75 insertions, 0 deletions
diff --git a/sys-power/switcheroo-control/files/switcheroo-control-init.d b/sys-power/switcheroo-control/files/switcheroo-control-init.d
new file mode 100644
index 000000000000..e6ca92908715
--- /dev/null
+++ b/sys-power/switcheroo-control/files/switcheroo-control-init.d
@@ -0,0 +1,12 @@
+#!/sbin/openrc-run
+
+description="Switcheroo Control Proxy service"
+
+command=/usr/libexec/switcheroo-control
+command_background=yes
+pidfile=/run/switcheroo-control.pid
+
+depend() {
+ need dbus
+ before alsasound display-manager
+}
diff --git a/sys-power/switcheroo-control/switcheroo-control-2.6-r1.ebuild b/sys-power/switcheroo-control/switcheroo-control-2.6-r1.ebuild
new file mode 100644
index 000000000000..c44f0662b570
--- /dev/null
+++ b/sys-power/switcheroo-control/switcheroo-control-2.6-r1.ebuild
@@ -0,0 +1,63 @@
+# Copyright 2021-2022 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+PYTHON_COMPAT=( python3_{8..11} )
+
+inherit meson python-any-r1 systemd
+
+DESCRIPTION="D-Bus service to check the availability of dual-GPU"
+HOMEPAGE="https://gitlab.freedesktop.org/hadess/switcheroo-control/"
+SRC_URI="https://gitlab.freedesktop.org/hadess/switcheroo-control/uploads/86ea54ac7ddb901b6bf6e915209151f8/${P}.tar.xz"
+
+LICENSE="GPL-3"
+SLOT="0"
+IUSE="gtk-doc test"
+
+KEYWORDS="~amd64"
+
+RDEPEND="
+ >=dev-libs/glib-2.56.0:2
+ >=dev-libs/libgudev-232:=
+"
+DEPEND="${RDEPEND}"
+BDEPEND="
+ gtk-doc? ( dev-util/gtk-doc )
+ test? (
+ $(python_gen_any_dep 'dev-python/python-dbusmock[${PYTHON_USEDEP}]')
+ dev-util/umockdev
+ )
+"
+
+RESTRICT="!test? ( test )"
+
+python_check_deps() {
+ use test || return 0
+ python_has_version "dev-python/python-dbusmock[${PYTHON_USEDEP}]"
+}
+
+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/switcherooctl
+ newinitd "${FILESDIR}"/${PN}-init.d ${PN}
+}
+
+pkg_postinst() {
+ if [[ -z "${REPLACING_VERSIONS}" ]]; then
+ elog "You to enable the service:"
+ if systemd_is_booted; then
+ elog "# systemctl enable switcheroo-control"
+ else
+ elog "# rc-update add ${PN} default"
+ fi
+ fi
+}