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,23 +187,27 @@ 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 ]
tmpfile=$(mktemp /tmp/tmp-XXXX) then
sed -e "s@^\(server\)\|\(SERVER\) \+logdir=.*@SERVER logdir=\"/var/log/%{conmandir}\"@" \ rm %_tmppath/conman_userudate
-e "s@^\(server\)\|\(SERVER\) \+logfile=.*@SERVER logfile=\"/var/log/%{conmandir}conman.log\"@" \ if [ $1 -eq 2 ]; then
-e "s@^\(server\)\|\(SERVER\) \+pidfile=.*@SERVER pidfile=\"/var/run/%{conmandir}conman.pid\"@" \ tmpfile=$(mktemp /tmp/tmp-XXXX)
< /etc/conman.conf > $tmpfile sed -e "s@^\(server\)\|\(SERVER\) \+logdir=.*@SERVER logdir=\"/var/log/%{conmandir}\"@" \
if ! cmp /etc/conman.conf $tmpfile; then -e "s@^\(server\)\|\(SERVER\) \+logfile=.*@SERVER logfile=\"/var/log/%{conmandir}conman.log\"@" \
mv $tmpfile /etc/conman.conf -e "s@^\(server\)\|\(SERVER\) \+pidfile=.*@SERVER pidfile=\"/var/run/%{conmandir}conman.pid\"@" \
chown %conman_u:%conman_g /etc/conman.conf < /etc/conman.conf > $tmpfile
cat > %_localstatedir/adm/update-messages/%{name}-%{version}-%{release}-%{name}.txt <<EOF if ! cmp /etc/conman.conf $tmpfile; then
mv $tmpfile /etc/conman.conf
chown %conman_u:%conman_g /etc/conman.conf
cat > %_localstatedir/adm/update-messages/%{name}-%{version}-%{release}-%{name}.txt <<EOF
The conman configuration in %_sysconfdir/conman.conf has been updated to the new pid and log The conman configuration in %_sysconfdir/conman.conf has been updated to the new pid and log
directory. Please check this file to make sure it is correct. directory. Please check this file to make sure it is correct.
EOF EOF
else else
rm $tmpfile rm $tmpfile
fi fi
fi
fi fi
%endif %endif