Fix TIVI-158 connman failed to restart during upgrade 72/1872/1 1.0_branch accepted/trunk/20120927.164737 submit/trunk/20120927.090224
authorChengyi Zhao <chengyix.zhao@intel.com>
Thu, 27 Sep 2012 08:39:54 +0000 (16:39 +0800)
committerChengyi Zhao <chengyix.zhao@intel.com>
Thu, 27 Sep 2012 08:39:54 +0000 (16:39 +0800)
packaging/connman.changes
packaging/connman.spec

index d57498a..23a0aaf 100644 (file)
@@ -1,3 +1,6 @@
+* Thu Sep 27 16:37:47 CST 2012 Chengyi Zhao <chengyix.zhao@intel.com> - 1.3
+- Fix TIVI-158 connman failed to restart during upgrade
+
 * Wed Sep 26 14:34:22 EEST 2012 Artem Bityutskiy * <artem.bityutskiy@linux.intel.com> - 1.3
 - Back-port another 2 patches from upstream:
    o baca467 rtnl: Ignore netlink messages generated by wext
index b1355d7..6885d2d 100644 (file)
@@ -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,-)