[packages/brltty] - added package user/groups support, release 2

qboosh qboosh at pld-linux.org
Sun Dec 8 13:16:39 CET 2024


commit 2bcd643206ac58f5c4517254e8403c4309c38b36
Author: Jakub Bogusz <qboosh at pld-linux.org>
Date:   Sun Dec 8 12:23:15 2024 +0100

    - added package user/groups support, release 2

 brltty-sysusers.patch | 27 +++++++++++++++++++++++++++
 brltty.spec           | 41 +++++++++++++++++++++++++++++++++--------
 2 files changed, 60 insertions(+), 8 deletions(-)
---
diff --git a/brltty.spec b/brltty.spec
index b550a06..f25b87d 100644
--- a/brltty.spec
+++ b/brltty.spec
@@ -1,4 +1,3 @@
-# TODO: user/group (see Autostart/Systemd/sysusers)
 #
 # Conditional build:
 %bcond_without	apidocs			# documentation generated with doxygen
@@ -31,11 +30,12 @@ Summary:	Braille display driver for Linux/Unix
 Summary(pl.UTF-8):	Sterownik do wyświetlaczy Braille'a
 Name:		brltty
 Version:	6.7
-Release:	1
+Release:	2
 License:	GPL v2+ (brltty and drivers), LGPL v2.1+ (APIs)
 Group:		Daemons
 Source0:	https://brltty.app/archive/%{name}-%{version}.tar.xz
 # Source0-md5:	42298348d3703c7140b88020a36c8c65
+Patch0:		%{name}-sysusers.patch
 Patch1:		%{name}-speech-dispatcher.patch
 Patch4:		%{name}-glibc25.patch
 URL:		https://brltty.app/
@@ -93,6 +93,15 @@ BuildRequires:	xorg-lib-libXtst-devel
 #%{?with_theta:BuildRequires:	Theta-devel (-ltheta <theta.h>)}
 #%{?with_viavoice:BuildRequires:	ViaVoice-devel (-libmeci50 <eci.h>)}
 BuildRequires:	xz
+Requires(pre):	/bin/id
+Requires(pre):	/usr/bin/getgid
+Requires(pre):	/usr/sbin/groupadd
+Requires(pre):	/usr/sbin/useradd
+Requires(postun):	/usr/sbin/groupdel
+Requires(postun):	/usr/sbin/userdel
+Provides:	group(brlapi)
+Provides:	group(brltty)
+Provides:	user(brltty)
 BuildRoot:	%{tmpdir}/%{name}-%{version}-root-%(id -u -n)
 
 %description
@@ -293,6 +302,7 @@ Biblioteka BrlAPI dla Tcl.
 
 %prep
 %setup -q
+%patch0 -p1
 %patch1 -p1
 %patch4 -p1
 
@@ -382,7 +392,17 @@ cp -p Documents/brltty.conf $RPM_BUILD_ROOT%{_sysconfdir}
 rm -rf $RPM_BUILD_ROOT
 
 %pre
-# The pre-install scriptlet.
+%groupadd -g 348 brlapi
+%groupadd -g 351 brltty
+# supplementary groups:
+# - tty for reading screen content (/dev/vcs*) and virutal console monitoring and control (/dev/tty*)
+# - dialout for serial devices I/O (/dev/ttyS*)
+# - usb for USB devices I/O
+# - audio for playing sound via ALSA framework
+# - pulse-access for playing sound via Pulse Audio daemon (TODO: requires pulseaudio installed earlier)
+# - input for monitoring keyboard input (/dev/input/*)
+# - ? (TODO) for creating virtual devices (/dev/uinput)
+%useradd -u 351 -d /var/lib/brltty -s /bin/false -c "Braille Device Daemon" -g brltty -G audio,brlapi,dialout,input,tty,usb brltty
 
 # If a configuration file already exists then rpm installs the new one as
 # <path>.rpmnew. If this is done then the .rpmnew file is overwritten if it
@@ -406,6 +426,13 @@ new="${file}.rpmnew"
 # Update the configuration file template via the Bootdisks/bp2cf script.
 %{_bindir}/brltty-bp2cf -u -f "${file}" >/dev/null 2>&1 || :
 
+%postun
+if [ "$1" = "0" ]; then
+	%userremove brltty
+	%groupremove brlapi
+	%groupremove brltty
+fi
+
 %post	-n brlapi -p /sbin/ldconfig
 %postun	-n brlapi -p /sbin/ldconfig
 
@@ -522,11 +549,9 @@ new="${file}.rpmnew"
 %{systemdunitdir}/brltty at .service
 %{systemdunitdir}/brltty-device at .service
 %{systemdtmpfilesdir}/brltty.conf
-#%{_prefix}/lib/sysusers.d/brltty.conf
-#%attr(3777,brltty,brltty)
-%dir /var/lib/BrlAPI
-#%attr(2770,brltty,brltty)
-%dir /var/lib/brltty
+/usr/lib/sysusers.d/brltty.conf
+%attr(3777,brltty,brltty) %dir /var/lib/BrlAPI
+%attr(2770,brltty,brltty) %dir /var/lib/brltty
 %{_mandir}/man1/brltty.1*
 %{_mandir}/man1/eutp.1*
 %{_mandir}/man1/vstp.1*
diff --git a/brltty-sysusers.patch b/brltty-sysusers.patch
new file mode 100644
index 0000000..82bb5a7
--- /dev/null
+++ b/brltty-sysusers.patch
@@ -0,0 +1,27 @@
+--- brltty-6.7/Autostart/Systemd/sysusers.orig	2024-09-29 00:44:24.000000000 +0200
++++ brltty-6.7/Autostart/Systemd/sysusers	2024-12-08 11:58:06.522821001 +0100
+@@ -27,12 +27,10 @@ u brltty - "Braille Device Daemon" /var/
+ m brltty tty
+ 
+ # for serial I/O (/dev/ttyS<n>)
+-# probably only one of these should be uncommented
+ m brltty dialout
+-#m brltty uucp
+ 
+ # for USB I/o (/dev/bus/usb/*/*)
+-m brltty root
++m brltty usb
+ 
+ # for playing sound via the ALSA framework
+ m brltty audio
+@@ -43,8 +41,8 @@ m brltty pulse-access
+ # for monitoring keyboard input (/dev/input/*)
+ m brltty input
+ 
+-# for creating virtual devices (/dev/uinput)
+-m brltty root
++# for creating virtual devices (/dev/uinput) - FIXME
++#m brltty root
+ 
+ # for reading the BrlAPI authorization key file
+ g brlapi
================================================================

---- gitweb:

http://git.pld-linux.org/gitweb.cgi/packages/brltty.git/commitdiff/2bcd643206ac58f5c4517254e8403c4309c38b36



More information about the pld-cvs-commit mailing list