From fb594eabdf006f4bdf6ad73eda7fd65b1f613a67 Mon Sep 17 00:00:00 2001 From: Chengyi Zhao Date: Thu, 27 Sep 2012 16:39:54 +0800 Subject: [PATCH] Fix TIVI-158 connman failed to restart during upgrade --- packaging/connman.changes | 3 +++ packaging/connman.spec | 24 ++++++++++++++++-------- 2 files changed, 19 insertions(+), 8 deletions(-) diff --git a/packaging/connman.changes b/packaging/connman.changes index d57498a..23a0aaf 100644 --- a/packaging/connman.changes +++ b/packaging/connman.changes @@ -1,3 +1,6 @@ +* Thu Sep 27 16:37:47 CST 2012 Chengyi Zhao - 1.3 +- Fix TIVI-158 connman failed to restart during upgrade + * Wed Sep 26 14:34:22 EEST 2012 Artem Bityutskiy * - 1.3 - Back-port another 2 patches from upstream: o baca467 rtnl: Ignore netlink messages generated by wext diff --git a/packaging/connman.spec b/packaging/connman.spec index b1355d7..6885d2d 100644 --- a/packaging/connman.spec +++ b/packaging/connman.spec @@ -102,16 +102,24 @@ install -d -m 700 %{buildroot}/var/lib/connman install -c -m 600 %{SOURCE1} %{buildroot}/var/lib/connman/settings %post -systemctl daemon-reload -systemctl restart connman.service - -%preun -systemctl stop connman.service - -%postun -systemctl daemon-reload +if [ $1 -eq 1 ] ; then + # Initial installation + /bin/systemctl daemon-reload >/dev/null 2>&1 || : +fi +%preun +if [ $1 -eq 0 ] ; then + # Package removal, not upgrade + /bin/systemctl --no-reload disable %{name}.service > /dev/null 2>&1 || : + /bin/systemctl stop %{name}.service > /dev/null 2>&1 || : +fi +%postun +/bin/systemctl --system daemon-reload >/dev/null 2>&1 || : +if [ $1 -ge 1 ] ; then + # Package upgrade, not uninstall + /bin/systemctl try-restart %{name}.service >/dev/null 2>&1 || : +fi %files %defattr(-,root,root,-) -- 2.7.4