From: Valentin Vidic <Valentin.Vidic@CARNet.hr>
Date: Tue, 31 Jan 2012 14:23:22 +0000 (+0100)
Subject: Disable monit but allow insserv upgrade.
X-Git-Tag: debian/6.0.1~7
X-Git-Url: http://ftp.carnet.hr/carnet-debian/scm?a=commitdiff_plain;h=f917af08133389103ba492323f53aa02056ad84f;p=carnet-upgrade.git

Disable monit but allow insserv upgrade.
---

diff --git a/src/actions/main.queue b/src/actions/main.queue
index 285ba62..b1bb65c 100644
--- a/src/actions/main.queue
+++ b/src/actions/main.queue
@@ -43,7 +43,7 @@ true				install_new		# instaliraj nove
 true				remove_orphaned		# ocisti stare libove nakon sto su cn paketi nadogradjeni
 # i ostatak
 true				add_group_proc		# za oidentd
-true				pkgadd monit-cn
+true				enable_monit
 pkg kernel-2.6-cn		dpkg-reconfigure kernel-2.6-cn
 true				dpkg-reconfigure sysv-rc
 # ovo bi trebalo biti predzadnje na popisu
diff --git a/src/functions.sh b/src/functions.sh
index 59cd2af..acc4dad 100644
--- a/src/functions.sh
+++ b/src/functions.sh
@@ -823,9 +823,19 @@ disable_monit () {
     apt-get remove --yes monit
     # stop the binary
     pkill -9 monit || true
+    # move away init for insserv to work
+    mv /etc/init.d/monit /var/lib/carnet-upgrade/
   fi
 }
 
+# allow monit to run again
+enable_monit () {
+  if [ -f /var/lib/carnet-upgrade/monit ]; then
+    mv /var/lib/carnet-upgrade/monit /etc/init.d/monit
+    pkgadd monit-cn
+  fi 
+}
+
 # check which of the given packages are installed
 grep_installed () {
   local package installed