Accepting request 1143876 from home:adkorte:branches:network:messaging:mqtt

- Use sysuser-tools to generate mosquitto user

OBS-URL: https://build.opensuse.org/request/show/1143876
OBS-URL: https://build.opensuse.org/package/show/network:messaging:mqtt/mosquitto?expand=0&rev=65
This commit is contained in:
Martin Hauke 2024-02-07 14:38:55 +00:00 committed by Git OBS Bridge
parent aa8a7c3428
commit 20f6c7306d
3 changed files with 16 additions and 9 deletions

2
mosquitto-user.conf Normal file
View File

@ -0,0 +1,2 @@
#Type Name ID GECOS Home directory Shell
u mosquitto - "MQTT Broker" /var/lib/mosquitto -

View File

@ -1,3 +1,8 @@
-------------------------------------------------------------------
Sat Feb 3 19:15:47 UTC 2024 - Arjen de Korte <suse+build@de-korte.org>
- Use sysuser-tools to generate mosquitto user
-------------------------------------------------------------------
Sat Dec 30 21:03:04 UTC 2023 - Dirk Müller <dmueller@suse.com>

View File

@ -1,7 +1,7 @@
#
# spec file for package mosquitto
#
# Copyright (c) 2023 SUSE LLC
# Copyright (c) 2024 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
@ -28,6 +28,7 @@ Group: Productivity/Networking/Other
URL: https://mosquitto.org/
Source: https://mosquitto.org/files/source/mosquitto-%{version}.tar.gz
Source1: mosquitto.service
Source2: %{name}-user.conf
Source4: README-conf-d
Source5: README-ca_certificates
Source6: README-certs
@ -40,12 +41,13 @@ BuildRequires: gcc-c++
BuildRequires: libxslt-tools
BuildRequires: openssl-devel >= 1.0.0
BuildRequires: pkgconfig
BuildRequires: sysuser-tools
BuildRequires: tcpd-devel
BuildRequires: uthash-devel
BuildRequires: pkgconfig(libcares)
BuildRequires: pkgconfig(libcjson)
BuildRequires: pkgconfig(libwebsockets)
Requires(pre): shadow
%sysusers_requires
%{?systemd_ordering}
%description
@ -112,12 +114,11 @@ monitoring and automation with his twittering house and twittering ferry.
Client for Mosquitto.
%prep
%setup -q
%patch0 -p1
%patch1 -p1
%autosetup -p1
find misc -type f -exec chmod a-x "{}" "+"
%build
%sysusers_generate_pre %{SOURCE2} %{name} %{name}-user.conf
%cmake \
-DCMAKE_INSTALL_SYSCONFDIR=%{_sysconfdir} \
-DWITH_WEBSOCKETS=ON \
@ -136,11 +137,9 @@ echo "# Site-specific additions and overrides for 'usr.sbin.mosquitto'" > %{buil
install -D -m 644 %{SOURCE4} %{buildroot}%{_sysconfdir}/mosquitto/conf.d/README
install -D -m 644 %{SOURCE5} %{buildroot}%{_sysconfdir}/mosquitto/ca_certificates/README
install -D -m 644 %{SOURCE6} %{buildroot}%{_sysconfdir}/mosquitto/certs/README
install -D -m 644 %{SOURCE2} %{buildroot}%{_sysusersdir}/%{name}-user.conf
%pre
getent group %{name} || %{_sbindir}/groupadd -r %{name}
getent passwd %{name} || %{_sbindir}/useradd -g %{name} -s /bin/false -r -c "%{name}" -d %{home} %{name}
%pre -f %{name}.pre
%service_add_pre %{name}.service
%preun
@ -176,6 +175,7 @@ getent passwd %{name} || %{_sbindir}/useradd -g %{name} -s /bin/false -r -c "%{n
%{_unitdir}/%{name}.service
%{_sbindir}/rc%{name}
%{_libdir}/mosquitto_dynamic_security.so
%{_sysusersdir}/%{name}-user.conf
%dir %attr(-,%{name},%{name}) %{home}
%dir %{_sysconfdir}/apparmor.d/
%dir %{_sysconfdir}/apparmor.d/local/