Accepting request 875976 from home:hgraeber:branches:network

- Use sysuser-tools for creation of the wsdd user and group
- Do not hijack the /run/sysconfig folder anymore
- Add missing '/'

OBS-URL: https://build.opensuse.org/request/show/875976
OBS-URL: https://build.opensuse.org/package/show/network/wsdd?expand=0&rev=12
This commit is contained in:
Herbert Graeber 2021-03-01 12:44:16 +00:00 committed by Git OBS Bridge
parent f2c7c22ed7
commit 7379460409
6 changed files with 31 additions and 14 deletions

View File

@ -1,5 +1,5 @@
## Path: Network/WSD ## Path: Network/WSDD
## Description: WSD Configuration ## Description: WSDD Configuration
## Type: string ## Type: string
## Default: "" ## Default: ""
## ServiceRestart:·wsdd ## ServiceRestart:·wsdd
@ -30,4 +30,5 @@ WSDD_INTERFACES=""
## Type: string ## Type: string
## Default: "" ## Default: ""
## ServiceRestart:·wsdd ## ServiceRestart:·wsdd
# Additional wsdd options
WSDD_ARGS="" WSDD_ARGS=""

View File

@ -1,5 +1,7 @@
#!/bin/sh #!/bin/sh
umask 0644
WSDD_CONFIG=/etc/sysconfig/wsdd WSDD_CONFIG=/etc/sysconfig/wsdd
if test -r "${WSDD_CONFIG}"; then if test -r "${WSDD_CONFIG}"; then
. "${WSDD_CONFIG}" . "${WSDD_CONFIG}"
@ -23,7 +25,5 @@ if [ "${WSDD_INTERFACES}" != "" ]; then
done done
fi fi
install -o wsdd -g wsdd -p 0700 -d /run/sysconfig
echo "WSDD_ARGS=${WSDD_HOSTNAME} ${WSDD_DOMAIN} ${WSDD_INTERFACE_ARGS} \ echo "WSDD_ARGS=${WSDD_HOSTNAME} ${WSDD_DOMAIN} ${WSDD_INTERFACE_ARGS} \
${WSDD_ARGS}" >/run/sysconfig/wsdd ${WSDD_ARGS}" >/run/wsdd/env-vars

2
wsdd-user.conf Normal file
View File

@ -0,0 +1,2 @@
# Type Name ID GECOS [HOME]
u wsdd - "User for wsdd" /run/wsdd

View File

@ -1,3 +1,14 @@
-------------------------------------------------------------------
Mon Mar 1 11:04:37 UTC 2021 - Herbert Graeber <herbert@graeber-clan.de>
- Use sysuser-tools for creation of the wsdd user and group
- Do not hijack the /run/sysconfig folder anymore
-------------------------------------------------------------------
Sun Feb 28 17:26:00 UTC 2021 - Herbert Graeber <herbert@graeber-clan.de>
- Add missing '/'
------------------------------------------------------------------- -------------------------------------------------------------------
Sun Feb 28 16:11:58 UTC 2021 - Herbert Graeber <herbert@graeber-clan.de> Sun Feb 28 16:11:58 UTC 2021 - Herbert Graeber <herbert@graeber-clan.de>

View File

@ -9,9 +9,9 @@ AmbientCapabilities=CAP_SYS_CHROOT
PermissionsStartOnly=true PermissionsStartOnly=true
Environment= WSDD_ARGS=-p Environment= WSDD_ARGS=-p
ExecStartPre=@LIBEXECDIR@/wsdd-init.sh ExecStartPre=@LIBEXECDIR@/wsdd-init.sh
EnvironmentFile=-/run/sysconfig/wsdd EnvironmentFile=-/run/wsdd/env-vars
ExecStart=/usr/sbin/wsdd --shortlog -c /run/wsdd $WSDD_ARGS ExecStart=/usr/sbin/wsdd --shortlog -c /run/wsdd $WSDD_ARGS
ExecStartPost=/usr/bin/rm /run/sysconfig/wsdd ExecStartPost=/usr/bin/rm /run/wsdd/env-vars
User=wsdd User=wsdd
Group=wsdd Group=wsdd

View File

@ -28,7 +28,9 @@ Source2: %{name}.service.in
Source3: %{name}.xml Source3: %{name}.xml
Source4: sysconfig.%{name} Source4: sysconfig.%{name}
Source5: %{name}.conf Source5: %{name}.conf
Source6: %{name}-user.conf
Patch1: %{name}-shebang.patch Patch1: %{name}-shebang.patch
BuildRequires: sysuser-tools
BuildRequires: firewall-macros BuildRequires: firewall-macros
BuildRequires: python3 BuildRequires: python3
Requires(post): %fillup_prereq Requires(post): %fillup_prereq
@ -49,6 +51,7 @@ for devices running Samba, like NAS or file sharing servers on your local networ
%patch1 -p1 %patch1 -p1
%build %build
%sysusers_generate_pre %{SOURCE6} %{name}
%install %install
install -m 755 -D src/wsdd.py %{buildroot}%{_sbindir}/%{name} install -m 755 -D src/wsdd.py %{buildroot}%{_sbindir}/%{name}
@ -64,16 +67,16 @@ mkdir -p %{buildroot}%{_prefix}/lib/tmpfiles.d/
install -m 644 %{SOURCE5} %{buildroot}%{_tmpfilesdir} install -m 644 %{SOURCE5} %{buildroot}%{_tmpfilesdir}
mkdir -p %{buildroot}/run/wsdd mkdir -p %{buildroot}/run/wsdd
mkdir -p %{buildroot}%{_localstatedir}/lib/wsdd mkdir -p %{buildroot}%{_localstatedir}/lib/wsdd
mkdir -p %{buildroot}%{_sysusersdir}
install -m 0644 %{SOURCE6} %{buildroot}%{_sysusersdir}/
%pre %pre -f %{name}.pre
getent group wsdd >/dev/null || %{_sbindir}/groupadd -r wsdd
getent passwd wsdd >/dev/null || %{_sbindir}/useradd -r -g wsdd -c "User for wsdd" -s /sbin/nologin -d /run/wsdd wsdd
%service_add_pre wsdd.service %service_add_pre wsdd.service
%post %post
%fillup_only %fillup_only
%service_add_post wsdd.service %service_add_post wsdd.service
%tmpfiles_create %{_tmpfilesdir}wsdd.conf %tmpfiles_create %{_tmpfilesdir}/wsdd.conf
%firewalld_reload %firewalld_reload
%preun %preun
@ -97,8 +100,8 @@ getent passwd wsdd >/dev/null || %{_sbindir}/useradd -r -g wsdd -c "User for wsd
%dir %{_prefix}/lib/firewalld/services %dir %{_prefix}/lib/firewalld/services
%{_prefix}/lib/firewalld/services/wsdd.xml %{_prefix}/lib/firewalld/services/wsdd.xml
%{_fillupdir}/sysconfig.%{name} %{_fillupdir}/sysconfig.%{name}
%dir %attr(0755,wsdd,wsdd) %ghost /run/sysconfig %{_sysusersdir}/%{name}-user.conf
%attr(0644,wsdd,wsdd) %ghost /run/sysconfig/wsdd %dir %attr(0755,wsdd,wsdd) %ghost /run/%{name}
%dir %attr(0755,wsdd,wsdd) %ghost /run/wsdd %attr(0644,wsdd,wsdd) %ghost /run/%{name}/env-vars
%changelog %changelog