- Added patch for user groups

- Removed `users`, `sudo`, `adm` and `wheel` groups
- Added `video` group and separated `supergfxctl`

OBS-URL: https://build.opensuse.org/package/show/hardware/supergfxctl?expand=0&rev=14
This commit is contained in:
R N 2024-11-18 13:14:44 +00:00 committed by Git OBS Bridge
parent d32441b427
commit a0c60847ce
4 changed files with 56 additions and 2 deletions

3
supergfxctl-user.conf Normal file
View File

@ -0,0 +1,3 @@
# Type Name ID GECOS [HOME]
u supergfxctl - "supergfx daemon" -
m supergfxctl video - - -

View File

@ -1,3 +1,10 @@
-------------------------------------------------------------------
Mon Nov 18 11:07:05 UTC 2024 - RN <R_Nik_C@proton.me>
- Added patch for user groups
- Removed `users`, `sudo`, `adm` and `wheel` groups
- Added `video` group and separated `supergfxctl`
------------------------------------------------------------------- -------------------------------------------------------------------
Thu Oct 03 16:16:22 UTC 2024 - RN <R_Nik_C@proton.me> Thu Oct 03 16:16:22 UTC 2024 - RN <R_Nik_C@proton.me>

View File

@ -26,13 +26,18 @@ License: MPL-2.0
URL: https://gitlab.com/asus-linux/supergfxctl URL: https://gitlab.com/asus-linux/supergfxctl
Source0: %{name}-%{version}.tar.gz Source0: %{name}-%{version}.tar.gz
Source1: vendor.tar.zst Source1: vendor.tar.zst
Source2: %{name}-user.conf
Group: System/Daemons Group: System/Daemons
## Patch for user-groups
Patch1: user-group.patch
BuildRequires: cargo-packaging BuildRequires: cargo-packaging
BuildRequires: pkgconfig BuildRequires: pkgconfig
BuildRequires: pkgconfig(dbus-1) BuildRequires: pkgconfig(dbus-1)
BuildRequires: pkgconfig(libudev) BuildRequires: pkgconfig(libudev)
BuildRequires: pkgconfig(systemd) BuildRequires: pkgconfig(systemd)
BuildRequires: sysuser-tools
Requires: systemd Requires: systemd
Conflicts: bbswitch Conflicts: bbswitch
@ -44,11 +49,14 @@ Conflicts: system76-power
%description %description
supergfxctl is a super graphics mode controller for laptops with hybrid nvidia. supergfxctl is a super graphics mode controller for laptops with hybrid nvidia.
%sysusers_requires
%prep %prep
%autosetup -a1 %autosetup -a1 -p1
%build %build
%cargo_build %cargo_build
%sysusers_generate_pre %{SOURCE2} %{name} %{name}-user.conf
%install %install
%cargo_install %cargo_install
@ -64,7 +72,9 @@ install -D -m 0644 data/supergfxd.preset %{buildroot}%{_presetdir}/99-supergfxd.
install -D -m 0644 LICENSE %{buildroot}%{_datadir}/licenses/%{name}/LICENSE install -D -m 0644 LICENSE %{buildroot}%{_datadir}/licenses/%{name}/LICENSE
install -D -m 0644 README.md %{buildroot}%{_datadir}/doc/%{name}/README.md install -D -m 0644 README.md %{buildroot}%{_datadir}/doc/%{name}/README.md
%pre install -D -m 0644 %{SOURCE2} %{buildroot}%{_sysusersdir}/%{name}-user.conf
%pre -f %{name}.pre
%service_add_pre supergfxd.service %service_add_pre supergfxd.service
%post %post
@ -94,6 +104,7 @@ fi
%{_unitdir}/supergfxd.service %{_unitdir}/supergfxd.service
%{_presetdir}/99-supergfxd.preset %{_presetdir}/99-supergfxd.preset
%{_udevrulesdir}/90-supergfxd-nvidia-pm.rules %{_udevrulesdir}/90-supergfxd-nvidia-pm.rules
%{_sysusersdir}/%{name}-user.conf
%ghost %attr(0644,root,root) %{_sysconfdir}/modprobe.d/supergfxd.conf %ghost %attr(0644,root,root) %{_sysconfdir}/modprobe.d/supergfxd.conf
%config %{_sysconfdir}/dbus-1/system.d/org.supergfxctl.Daemon.conf %config %{_sysconfdir}/dbus-1/system.d/org.supergfxctl.Daemon.conf
%dir %{_datadir}/doc/%{name} %dir %{_datadir}/doc/%{name}

33
user-group.patch Normal file
View File

@ -0,0 +1,33 @@
diff --git a/data/org.supergfxctl.Daemon.conf b/data/org.supergfxctl.Daemon.conf
index 77fa627..9bc654f 100644
--- a/data/org.supergfxctl.Daemon.conf
+++ b/data/org.supergfxctl.Daemon.conf
@@ -2,24 +2,16 @@
"-//freedesktop//DTD D-BUS Bus Configuration 1.0//EN"
"http://www.freedesktop.org/standards/dbus/1.0/busconfig.dtd">
<busconfig>
- <policy group="adm">
- <allow send_destination="org.supergfxctl.Daemon"/>
- <allow receive_sender="org.supergfxctl.Daemon"/>
- </policy>
- <policy group="sudo">
- <allow send_destination="org.supergfxctl.Daemon"/>
- <allow receive_sender="org.supergfxctl.Daemon"/>
- </policy>
- <policy group="users">
+ <policy user="root">
+ <allow own="org.supergfxctl.Daemon"/>
<allow send_destination="org.supergfxctl.Daemon"/>
<allow receive_sender="org.supergfxctl.Daemon"/>
</policy>
- <policy group="wheel">
+ <policy group="video">
<allow send_destination="org.supergfxctl.Daemon"/>
<allow receive_sender="org.supergfxctl.Daemon"/>
</policy>
- <policy user="root">
- <allow own="org.supergfxctl.Daemon"/>
+ <policy group="supergfxctl">
<allow send_destination="org.supergfxctl.Daemon"/>
<allow receive_sender="org.supergfxctl.Daemon"/>
</policy>