Trying to start PLC only when it is running, in order to avoid false-positive error...
authorThomas Dreibholz <dreibh@simula.no>
Tue, 22 Jul 2014 06:10:39 +0000 (08:10 +0200)
committerThomas Dreibholz <dreibh@simula.no>
Tue, 22 Jul 2014 06:10:39 +0000 (08:10 +0200)
noderepo.spec
slicerepo.spec

index db9ff49..855caef 100644 (file)
@@ -75,7 +75,15 @@ rm -rf $RPM_BUILD_ROOT
 # as noderepo might get installed before myplc gets even started 
 # this however exhibit a deadlock, as rpm --almatches -e gpg-pubkey waits for transaction lock
 # that is help by the calling yum/rpm
-service plc start packages
+if [ ! -e /bin/systemctl ] ; then
+   echo "Systemd is not there. Just starting PLC to handle packages (may fail of PLC is not configured) ..."
+   service plc start packages
+elif /bin/systemctl status plc >/dev/null ; then
+   echo "Restarting PLC to handle packages ..."
+   service plc restart packages
+else
+   echo "The PLC is not running. Skipping a restart ..."
+fi
 
 %files
 %defattr(-,root,root,-)
index 86e3cdd..5f24b5a 100644 (file)
@@ -67,7 +67,15 @@ install -D -m 644 %{_topdir}/RPMS/yumgroups.xml $RPM_BUILD_ROOT/var/www/html/ins
 rm -rf $RPM_BUILD_ROOT
 
 %post
-service plc start packages
+if [ ! -e /bin/systemctl ] ; then
+   echo "Systemd is not there. Just starting PLC to handle packages (may fail of PLC is not configured) ..."
+   service plc start packages
+elif /bin/systemctl status plc >/dev/null ; then
+   echo "Restarting PLC to handle packages ..."
+   service plc restart packages
+else
+   echo "The PLC is not running. Skipping a restart ..."
+fi
 
 %files
 %defattr(-,root,root,-)