forked from pool/conman
Accepting request 577587 from network:cluster
- Only update config file for new user once, save backup copy. (forwarded request 577586 from eeich) OBS-URL: https://build.opensuse.org/request/show/577587 OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/conman?expand=0&rev=7
This commit is contained in:
commit
f0cd4ef2b1
@ -1,3 +1,20 @@
|
||||
-------------------------------------------------------------------
|
||||
Fri Feb 16 13:15:00 UTC 2018 - eich@suse.com
|
||||
|
||||
- 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 - eich@suse.com
|
||||
|
||||
- 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).
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Thu Nov 23 13:54:08 UTC 2017 - rbrown@suse.com
|
||||
|
||||
@ -29,6 +46,7 @@ Fri Oct 6 13:59:27 UTC 2017 - eich@suse.com
|
||||
* Fixed UDS console resource leak of pathname during config processing.
|
||||
* Fixed all gcc, clang, and Coverity Scan warnings.
|
||||
* Improved scalability of daemon.
|
||||
(FATE#324170).
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Mon Aug 14 13:42:48 UTC 2017 - eich@suse.com
|
||||
|
64
conman.spec
64
conman.spec
@ -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 @@ for i in $(find %{buildroot}/usr/lib/conman) ; do
|
||||
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 @@ fi
|
||||
%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 @@ exit 0
|
||||
%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 @@ exit 0
|
||||
%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}/*
|
||||
|
Loading…
x
Reference in New Issue
Block a user