Accepting request 577502 from home:eeich:branches:network:cluster

- Add the conman user to the group of the ttyS* devices
  (boo#1081217).

OBS-URL: https://build.opensuse.org/request/show/577502
OBS-URL: https://build.opensuse.org/package/show/network:cluster/conman?expand=0&rev=22
This commit is contained in:
Egbert Eich 2018-02-16 23:47:46 +00:00 committed by Git OBS Bridge
parent 37588568f4
commit 03841e12c5
2 changed files with 35 additions and 16 deletions

View File

@ -1,3 +1,9 @@
-------------------------------------------------------------------
Fri Feb 16 13:15:00 UTC 2018 - eich@suse.com
- Add the conman user to the group of the ttyS* devices
(boo#1081217).
------------------------------------------------------------------- -------------------------------------------------------------------
Wed Jan 10 19:27:27 UTC 2018 - eich@suse.com Wed Jan 10 19:27:27 UTC 2018 - eich@suse.com

View File

@ -137,7 +137,7 @@ mkdir -p %{buildroot}%{_tmpfilesdir}
cat >> %{buildroot}%{_tmpfilesdir}/%{name}.conf <<EOF cat >> %{buildroot}%{_tmpfilesdir}/%{name}.conf <<EOF
d %_localstatedir%_rundir/%{name} 0755 %{conman_u} %{conman_g} - d %_localstatedir%_rundir/%{name} 0755 %{conman_u} %{conman_g} -
EOF EOF
mkdir -p %{buildroot}%{_localstatedir}/log/conman mkdir -p %{buildroot}%{_localstatedir}/log/%{conmandir}
%endif %endif
if ! grep "^SERVER" %{buildroot}/etc/conman.conf > /dev/null; then if ! grep "^SERVER" %{buildroot}/etc/conman.conf > /dev/null; then
cat <<EOF >> %{buildroot}/etc/conman.conf cat <<EOF >> %{buildroot}/etc/conman.conf
@ -160,8 +160,17 @@ fi
%if 0%{?conmandir:1} %if 0%{?conmandir:1}
%define conman_home "%_localstatedir%_rundir/%conmandir" %define conman_home "%_localstatedir%_rundir/%conmandir"
%define conman_descr "Connection Manager service" %define conman_descr "Connection Manager service"
getent group %conman_g >/dev/null || groupadd -r %conman_g shopt -s nullglob
getent passwd %conman_u >/dev/null || useradd -r -g %conman_g -d %conman_home -s /bin/false -c %conman_descr %conman_u for i in /dev/ttyS[0-9] /dev/ttyS[1-9][0-9]
do TTYS_GRP=$(stat --format="%G" $i); break
done
addgrp=0; addusr=0
getent group %conman_g >/dev/null || addgrp=1
[ $addgrp -eq 1 ] && groupadd -r %conman_g
getent passwd %conman_u >/dev/null || addusr=1
[ $addusr -eq 1 ] && useradd -r -g %conman_g ${TTYS_GRP:+-G $TTYS_GRP} \
-d %conman_home -s /bin/false -c %conman_descr %conman_u
[ $addgrp -eq 1 -a $addusr -eq 1 ] && touch %_tmppath/conman_userudate
%endif %endif
exit 0 exit 0
%endif %endif
@ -178,7 +187,10 @@ exit 0
%if 0%{?have_systemd} %if 0%{?have_systemd}
%{?tmpfiles_create:%{tmpfiles_create %{_tmpfilesdir}/%{name}.conf}} %{?tmpfiles_create:%{tmpfiles_create %{_tmpfilesdir}/%{name}.conf}}
%service_add_post conman.service %service_add_post conman.service
if [ $1 -eq 2 ]; then if [ -e %_tmppath/conman_userudate ]
then
rm %_tmppath/conman_userudate
if [ $1 -eq 2 ]; then
tmpfile=$(mktemp /tmp/tmp-XXXX) tmpfile=$(mktemp /tmp/tmp-XXXX)
sed -e "s@^\(server\)\|\(SERVER\) \+logdir=.*@SERVER logdir=\"/var/log/%{conmandir}\"@" \ sed -e "s@^\(server\)\|\(SERVER\) \+logdir=.*@SERVER logdir=\"/var/log/%{conmandir}\"@" \
-e "s@^\(server\)\|\(SERVER\) \+logfile=.*@SERVER logfile=\"/var/log/%{conmandir}conman.log\"@" \ -e "s@^\(server\)\|\(SERVER\) \+logfile=.*@SERVER logfile=\"/var/log/%{conmandir}conman.log\"@" \
@ -195,6 +207,7 @@ EOF
else else
rm $tmpfile rm $tmpfile
fi fi
fi
fi fi
%endif %endif