From 3b4a9d7d25319841992dcf37c4be3f4d184b8b8e4ce028b76d66abf50f020336 Mon Sep 17 00:00:00 2001 From: Yuan Ren Date: Mon, 11 Nov 2019 07:28:06 +0000 Subject: [PATCH] Accepting request 746530 from home:yuanren10 fix corosync upgrade problem OBS-URL: https://build.opensuse.org/request/show/746530 OBS-URL: https://build.opensuse.org/package/show/network:ha-clustering:Factory/corosync?expand=0&rev=162 --- corosync.spec | 47 +++++++++++++++++++++++++++++++++++------------ 1 file changed, 35 insertions(+), 12 deletions(-) diff --git a/corosync.spec b/corosync.spec index 39cbacf..c3d339c 100644 --- a/corosync.spec +++ b/corosync.spec @@ -256,10 +256,12 @@ APIs and libraries, default configuration files, and an init script. %post /usr/lib/corosync/upgrade.sh -%tmpfiles_create /usr/lib/tmpfiles.d/corosync-notifyd %{fillup_only -n corosync} -# restore configured /etc/sysconfig/corosync(bsc#1155792) -mv /etc/sysconfig/corosync /etc/sysconfig/corosynctmp +# Upgrade +if [ $1 -eq 2 ] ; then + # restore configured /etc/sysconfig/corosync(bsc#1155792) + install -m 0644 %{_sysconfdir}/sysconfig/corosync /tmp/.sysconfig.corosync +fi %service_add_post corosync.service corosync-notifyd.service @@ -270,9 +272,14 @@ ln -s /usr/share/doc/packages/corosync/corosync.conf.example.udpu %{_sysconfdir} %preun %service_del_preun corosync.service corosync-notifyd.service -%posttrans -n corosync -if [ ! -f /etc/sysconfig/corosync ] ; then - mv /etc/sysconfig/corosynctmp /etc/sysconfig/corosync +%postun +if [ -f %{_sysconfdir}/sysconfig/corosync ]; then + rm %{_sysconfdir}/sysconfig/corosync +fi + +%posttrans +if [ ! -f %{_sysconfdir}/sysconfig/corosync ] ; then + install -m 0644 /tmp/.sysconfig.corosync %{_sysconfdir}/sysconfig/corosync fi %files @@ -575,7 +582,10 @@ NSS certificates and an init script. %post -n corosync-qdevice %{fillup_only -n corosync-qdevice} -mv /etc/sysconfig/corosync-qdevice /etc/sysconfig/corosync-qdevicetmp +# Upgrade +if [ $1 -eq 2 ] ; then + install -m 0644 %{_sysconfdir}/sysconfig/corosync-qdevice /tmp/.sysconfig.corosync-qdevice +fi %if %{sles_version} > 0 ln -s /run/corosync-qdevice /var/run/ @@ -591,9 +601,14 @@ unlink /var/run/corosync-qdevice %service_del_postun corosync-qdevice.service +%postun -n corosync-qdevice +if [ -f %{_sysconfdir}/sysconfig/corosync-qdevice ]; then + rm %{_sysconfdir}/sysconfig/corosync-qdevice +fi + %posttrans -n corosync-qdevice -if [ ! -f /etc/sysconfig/corosync-qdevice ] ; then - mv /etc/sysconfig/corosync-qdevicetmp /etc/sysconfig/corosync-qdevice +if [ ! -f %{_sysconfdir}/sysconfig/corosync-qdevice ] ; then + install -m 0644 /tmp/.sysconfig.corosync-qdevice %{_sysconfdir}/sysconfig/corosync-qdevice fi %files -n corosync-qdevice @@ -648,7 +663,10 @@ exit 0 ln -s /run/corosync-qnetd /var/run/ %endif %{fillup_only -n corosync-qnetd} -mv /etc/sysconfig/corosync-qnetd /etc/sysconfig/corosync-qnetdtmp +# Upgrade +if [ $1 -eq 2 ] ; then + install -m 0644 %{_sysconfdir}/sysconfig/corosync-qnetd /tmp/.sysconfig.corosync-qnetd +fi %service_add_post corosync-qnetd.service @@ -661,9 +679,14 @@ unlink /var/run/corosync-qnetd %service_del_postun corosync-qnetd.service +%postun -n corosync-qnetd +if [ -f %{_sysconfdir}/sysconfig/corosync-qnetd ]; then + rm %{_sysconfdir}/sysconfig/corosync-qnetd +fi + %posttrans -n corosync-qnetd -if [ ! -f /etc/sysconfig/corosync-qnetd ] ; then - mv /etc/sysconfig/corosync-qnetdtmp /etc/sysconfig/corosync-qnetd +if [ ! -f %{_sysconfdir}/sysconfig/corosync-qnetd ] ; then + install -m 0644 /tmp/.sysconfig.corosync-qnetd %{_sysconfdir}/sysconfig/corosync-qnetd fi %files -n corosync-qnetd