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

@ -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

@ -137,7 +137,7 @@ mkdir -p %{buildroot}%{_tmpfilesdir}
cat >> %{buildroot}%{_tmpfilesdir}/%{name}.conf <<EOF
d %_localstatedir%_rundir/%{name} 0755 %{conman_u} %{conman_g} -
EOF
mkdir -p %{buildroot}%{_localstatedir}/log/conman
mkdir -p %{buildroot}%{_localstatedir}/log/%{conmandir}
%endif
if ! grep "^SERVER" %{buildroot}/etc/conman.conf > /dev/null; then
cat <<EOF >> %{buildroot}/etc/conman.conf
@ -160,8 +160,17 @@ fi
%if 0%{?conmandir:1}
%define conman_home "%_localstatedir%_rundir/%conmandir"
%define conman_descr "Connection Manager service"
getent group %conman_g >/dev/null || groupadd -r %conman_g
getent passwd %conman_u >/dev/null || useradd -r -g %conman_g -d %conman_home -s /bin/false -c %conman_descr %conman_u
shopt -s nullglob
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
exit 0
%endif
@ -178,23 +187,27 @@ exit 0
%if 0%{?have_systemd}
%{?tmpfiles_create:%{tmpfiles_create %{_tmpfilesdir}/%{name}.conf}}
%service_add_post conman.service
if [ $1 -eq 2 ]; then
tmpfile=$(mktemp /tmp/tmp-XXXX)
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\) \+pidfile=.*@SERVER pidfile=\"/var/run/%{conmandir}conman.pid\"@" \
< /etc/conman.conf > $tmpfile
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
if [ -e %_tmppath/conman_userudate ]
then
rm %_tmppath/conman_userudate
if [ $1 -eq 2 ]; then
tmpfile=$(mktemp /tmp/tmp-XXXX)
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\) \+pidfile=.*@SERVER pidfile=\"/var/run/%{conmandir}conman.pid\"@" \
< /etc/conman.conf > $tmpfile
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
directory. Please check this file to make sure it is correct.
EOF
else
rm $tmpfile
fi
else
rm $tmpfile
fi
fi
fi
%endif