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