Hello community, here is the log from the commit of package conman for openSUSE:Factory checked in at 2018-02-18 11:45:19 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/conman (Old) and /work/SRC/openSUSE:Factory/.conman.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "conman" Sun Feb 18 11:45:19 2018 rev:7 rq:577587 version:0.2.8 Changes: -------- --- /work/SRC/openSUSE:Factory/conman/conman.changes 2017-12-06 08:58:26.077324422 +0100 +++ /work/SRC/openSUSE:Factory/.conman.new/conman.changes 2018-02-18 11:45:21.387156071 +0100 @@ -1,0 +2,17 @@ +Fri Feb 16 13:15:00 UTC 2018 - [email protected] + +- Add the conman user to the group of the ttyS* devices + (boo#1081217). +- Only update config file for new user once, save backup + copy. + +------------------------------------------------------------------- +Wed Jan 10 19:27:27 UTC 2018 - [email protected] + +- Fix conman for non-root user: + * create rundir + * create logdir + * set user/group only when set to non-root + * fix rundir and logdir in config file on update (boo#1081217). + +------------------------------------------------------------------- @@ -31,0 +49 @@ + (FATE#324170). ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ conman.spec ++++++ --- /var/tmp/diff_new_pack.txF1JF/_old 2018-02-18 11:45:22.307123045 +0100 +++ /var/tmp/diff_new_pack.txF1JF/_new 2018-02-18 11:45:22.307123045 +0100 @@ -1,7 +1,7 @@ # # spec file for package conman # -# Copyright (c) 2017 SUSE LINUX GmbH, Nuernberg, Germany. +# Copyright (c) 2018 SUSE LINUX GmbH, Nuernberg, Germany. # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -31,6 +31,7 @@ %if 0%{?have_systemd} %if 0%{?sle_version} >= 150000 || 0%{?is_opensuse} + %define conmandir conman/ %define conman_g %name %define conman_u %name %else @@ -130,14 +131,21 @@ fi fi done + +%if 0%{?conmandir:1} +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/%{conmandir} +%endif if ! grep "^SERVER" %{buildroot}/etc/conman.conf > /dev/null; then cat <<EOF >> %{buildroot}/etc/conman.conf SERVER keepalive=ON -SERVER logdir="/var/log/conman" -SERVER logfile="/var/log/conman.log" +SERVER logdir="/var/log/%{conmandir}" +SERVER logfile="/var/log/%{conmandir}conman.log" SERVER loopback=ON -SERVER pidfile="/var/run/conman.pid" -SERVER resetcmd="powerman -0 %N; sleep 3; powerman -1 %N" +SERVER pidfile="/var/run/%{conmandir}conman.pid" SERVER tcpwrappers=ON SERVER timestamp=1h GLOBAL seropts="115200,8n1" @@ -149,10 +157,21 @@ %if 0%{?have_systemd} %pre %service_add_pre conman.service -%define conman_home "%_localstatedir%_rundir/conman" +%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 -d %conman_home \ + -s /bin/false -c %conman_descr %conman_u +[ -n "$TTYS_GRP" ] && usermod -a -G $TTYS_GRP %conman_u +%endif exit 0 %endif @@ -164,13 +183,38 @@ %endif %post +%define migrated conman_user_migrated %fillup_only conman %if 0%{?have_systemd} +%{?tmpfiles_create:%{tmpfiles_create %{_tmpfilesdir}/%{name}.conf}} %service_add_post conman.service +[ -d %_localstatedir/lib/conman ] || mkdir %_localstatedir/lib/conman || : +if [ $1 -eq 2 -a ! -e %_localstatedir/lib/conman/%migrated ]; 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 /etc/conman.conf /etc/conman.conf.rpmsave + 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. The original version is available +in /etc/conman.conf.rpmsave. +EOF + else + rm $tmpfile + fi +fi +touch %_localstatedir/lib/conman/%migrated || : %endif %postun %if 0%{?have_systemd} +[ $1 -eq 0 ] && rm -rf %_localstatedir/lib/conman %service_del_postun conman.service %else %{restart_on_update conman} @@ -189,6 +233,10 @@ %doc THANKS %config(noreplace) %attr(-,%conman_u,%conman_g) %{_sysconfdir}/conman.conf %config(noreplace) %{_sysconfdir}/logrotate.d/conman +%if 0%{?conmandir:1} +%dir %attr(-,%conman_u,%conman_g) %{_localstatedir}/log/conman +%{_tmpfilesdir}/%{name}.conf +%endif %{_fillupdir}/sysconfig.conman %{_bindir}/* %{_sbindir}/*
