diff --git a/sys-apps/system76-driver/Manifest b/sys-apps/system76-driver/Manifest new file mode 100644 index 0000000..83a1274 --- /dev/null +++ b/sys-apps/system76-driver/Manifest @@ -0,0 +1 @@ +DIST system76-driver-20.04.88.tar.gz 97971 BLAKE2B 1759e6349fed8c2eb41a5d11174e7d4aba0639b2e73623203e355afc56667ed5f0a8e32183da76bb40fd1c5410f195695a04c1762012df82adea3093dc83a2eb SHA512 7c5482ee6f56a017af016508ada717b09540c48b58ceb8b00b1592b2728ed062c8e3dc0d7897ea92e62ff4ade265effaa552e323ce7593ede6be4689599053e3 diff --git a/sys-apps/system76-driver/files/system76-driver-20.04.69-gentoo.patch b/sys-apps/system76-driver/files/system76-driver-20.04.69-gentoo.patch new file mode 100644 index 0000000..c96d35f --- /dev/null +++ b/sys-apps/system76-driver/files/system76-driver-20.04.69-gentoo.patch @@ -0,0 +1,53 @@ +From bc9b94cbabf2fbb119fc7facd684f2d265c84ce9 Mon Sep 17 00:00:00 2001 +From: Bryan Gardiner +Date: Fri, 11 Sep 2020 18:52:15 -0700 +Subject: [PATCH] Patches for Gentoo. + +--- + debian/system76-driver.service | 2 +- + system76-nm-restart | 2 +- + system76-user-daemon.desktop | 2 +- + 3 files changed, 3 insertions(+), 3 deletions(-) + +diff --git a/debian/system76-driver.service b/debian/system76-driver.service +index e0915dd..4890ac0 100644 +--- a/debian/system76-driver.service ++++ b/debian/system76-driver.service +@@ -2,7 +2,7 @@ + Description=System76 airplane-mode hotkey and LED support + + [Service] +-ExecStart=/usr/lib/system76-driver/system76-daemon ++ExecStart=/usr/bin/system76-daemon + Restart=on-failure + + [Install] +diff --git a/system76-nm-restart b/system76-nm-restart +index 444b99d..54df9ce 100755 +--- a/system76-nm-restart ++++ b/system76-nm-restart +@@ -33,7 +33,7 @@ set -e + if [ "$2" = "suspend" ] || [ "$2" = "hybrid-sleep" ]; then + case "$1" in + pre) true ;; +- post) sleep 1 && sudo systemctl restart NetworkManager ;; ++ post) sleep 1 && systemctl restart NetworkManager ;; + esac + fi + +diff --git a/system76-user-daemon.desktop b/system76-user-daemon.desktop +index 5df120d..cad8b3f 100644 +--- a/system76-user-daemon.desktop ++++ b/system76-user-daemon.desktop +@@ -3,7 +3,7 @@ Type=Application + Encoding=UTF-8 + Name=System76 User Daemon + Comment=Make backlight work on GNOME with NVIDIA 9-Series hardware +-Exec=/usr/lib/system76-driver/system76-user-daemon ++Exec=/usr/bin/system76-user-daemon + Terminal=false + Icon=folder + NoDisplay=true +-- +2.37.4 + diff --git a/sys-apps/system76-driver/files/system76-driver-20.04.85-test-tmpdir.patch b/sys-apps/system76-driver/files/system76-driver-20.04.85-test-tmpdir.patch new file mode 100644 index 0000000..e1a1f52 --- /dev/null +++ b/sys-apps/system76-driver/files/system76-driver-20.04.85-test-tmpdir.patch @@ -0,0 +1,21 @@ +From: Bryan Gardiner +Date: 2024-01-25 + +Portage builds packages with a custom TMPDIR. The tests need updating not to +expect /tmp. + +diff --git a/system76driver/tests/test_util.py b/system76driver/tests/test_util.py +index c2be570..7689e25 100644 +--- a/system76driver/tests/test_util.py ++++ b/system76driver/tests/test_util.py +@@ -36,7 +36,9 @@ class TestFunctions(TestCase): + SubProcess.reset(mocking=False) + (tmp, tgz) = util.create_tmp_logs(func=None) + self.assertTrue(path.isdir(tmp)) +- self.assertTrue(tmp.startswith('/tmp/logs.')) ++ self.assertTrue(tmp.startswith( ++ (os.environ.get('TMPDIR') or '/tmp') + '/logs.' ++ )) + self.assertEqual( + sorted(os.listdir(tmp)), + ['system76-logs', 'system76-logs.tgz'], diff --git a/sys-apps/system76-driver/files/system76-driver.openrc b/sys-apps/system76-driver/files/system76-driver.openrc new file mode 100644 index 0000000..3ef8dd1 --- /dev/null +++ b/sys-apps/system76-driver/files/system76-driver.openrc @@ -0,0 +1,12 @@ +#!/sbin/openrc-run + +description="System76 airplane-mode hotkey and LED support" +command=/usr/bin/system76-daemon +command_background=true +pidfile=/run/system76-driver.pid +output_log=/var/log/system76-driver.out +error_log=/var/log/system76-driver.err + +depend() { + need dbus +} diff --git a/sys-apps/system76-driver/system76-driver-20.04.88-r2.ebuild b/sys-apps/system76-driver/system76-driver-20.04.88-r2.ebuild new file mode 100644 index 0000000..99d2385 --- /dev/null +++ b/sys-apps/system76-driver/system76-driver-20.04.88-r2.ebuild @@ -0,0 +1,125 @@ +# Copyright 2020-2024 Bryan Gardiner +# Distributed under the terms of the GNU General Public License v2 + +EAPI=8 + +PYTHON_COMPAT=( python3_{10..12} ) +DISTUTILS_SINGLE_IMPL=1 +DISTUTILS_USE_PEP517=setuptools +inherit distutils-r1 systemd virtualx + +DESCRIPTION="Universal driver for System76 computers" +HOMEPAGE="https://github.com/pop-os/system76-driver" +SRC_URI="https://github.com/pop-os/${PN}/archive/${PV}.tar.gz -> ${P}.tar.gz" + +LICENSE="GPL-2+" +SLOT="0" +KEYWORDS="amd64" +IUSE=" + bluetooth + lm-sensors + +modules + networkmanager + +suspend-workarounds + systemd + video_cards_nvidia +" +REQUIRED_USE=" + ${PYTHON_REQUIRED_USE} + suspend-workarounds? ( systemd ) +" + +# We skip the Debian package's hard dependency on system76-wallpapers. +# It's only used for gsettings overrides, which we don't install anyway. +# x11-themes/system76-wallpapers can be installed separately if desired. +# +# We also skip depending on python-systemd. Upstream declares a +# dependency on python3-systemd in debian/control, but looking at the +# code, actual use of the package appears to have been added with the +# dependency in 18.04.23, and then removed without dropping the +# dependency in 18.10.3. +RDEPEND=" + ${PYTHON_DEPS} + $(python_gen_cond_dep 'dev-python/dbus-python[${PYTHON_USEDEP}]') + $(python_gen_cond_dep 'dev-python/evdev[${PYTHON_USEDEP}]') + $(python_gen_cond_dep 'dev-python/pygobject:3[${PYTHON_USEDEP}]') + $(python_gen_cond_dep 'dev-python/distro[${PYTHON_USEDEP}]') + net-wireless/wireless-tools + lm-sensors? ( sys-apps/lm-sensors ) + sys-process/at + x11-apps/xbacklight + modules? ( + app-laptop/system76-acpi-module + app-laptop/system76-io-module + app-laptop/system76-module + ) + suspend-workarounds? ( + sys-apps/systemd + bluetooth? ( sys-apps/util-linux ) + networkmanager? ( net-misc/networkmanager ) + ) + video_cards_nvidia? ( x11-drivers/nvidia-drivers ) +" +DEPEND="${RDEPEND}" + +PATCHES=( + "${FILESDIR}/system76-driver-20.04.69-gentoo.patch" + "${FILESDIR}/system76-driver-20.04.85-test-tmpdir.patch" +) + +distutils_enable_tests setup.py + +src_test() { + virtx distutils-r1_src_test +} + +src_install() { + distutils-r1_src_install + + # See system76-driver.git/debian/system76-driver.install. + dobin "${S}/system76-driver-pkexec" + python_doscript "${S}/system76-daemon" + python_doscript "${S}/system76-user-daemon" + insinto /usr/share/polkit-1/actions + doins "${S}/com.system76.pkexec.system76-driver.policy" + insinto /etc/xdg/autostart + doins "${S}/system76-user-daemon.desktop" + + if use suspend-workarounds; then + local utildir + utildir=$(systemd_get_utildir) || die "Couldn't read systemd utildir." + exeinto "${utildir}/system-sleep" + + doexe "${S}/system76-atlantic-reload" + doexe "${S}/system76-thunderbolt-reload" + if use bluetooth; then + doexe "${S}/lib/systemd/system-sleep/system76-driver_bluetooth-suspend" + fi + if use networkmanager; then + doexe "${S}/system76-nm-restart" + fi + fi + + systemd_dounit "${S}/debian/system76-driver.service" + + newinitd "${FILESDIR}/${PN}.openrc" "${PN}" +} + +pkg_postinst() { + elog "Run system76-driver or system76-driver-cli as root to apply settings for" + elog "your specific System76 hardware. system76-driver launches a GTK+ UI where" + elog "you can see which actions will be taken. system76-driver-cli runs entirely" + elog "from the command line and prints out actions taken, but does not ask for" + elog "confirmation." + elog "" + elog " # system76-driver-cli" + elog "" + elog "You may want to enable the System76 daemon to enable further hardware" + elog "support and fixes. For systemd users:" + elog "" + elog " # systemctl enable --now system76-driver.service" + elog "" + elog "An experimental OpenRC runscript is also provided:" + elog "" + elog " # rc-update add system76-driver default" +}