[omd-commits] OMD Git: omd: debian: prevent uninstalling sites when still used ( fixes #187)

git version control git at mathias-kettner.de
Thu Dec 22 20:46:44 CET 2011


Module:   omd
Branch:   master
Commit:   0a9e74a3544a9e2205f153c316e918b47fa513d2
URL:      http://omdistro.org/projects/omd/repository/revisions/0a9e74a3544a9e2205f153c316e918b47fa513d2

Author:   Sven Nierlein <sven at nierlein.de>
Date:     Thu Dec 22 19:17:17 2011 +0100
Commiter: Sven Nierlein <sven at nierlein.de>
Date:     Thu Dec 22 19:54:52 2011 +0100

debian: prevent uninstalling sites when still used (fixes #187)

---

 debian/prerm.in |   18 +++++++++++++++++-
 1 files changed, 17 insertions(+), 1 deletions(-)

diff --git a/debian/prerm.in b/debian/prerm.in
index 774f7fa..b350a18 100644
--- a/debian/prerm.in
+++ b/debian/prerm.in
@@ -19,7 +19,23 @@ set -e
 OMD="omd-###OMD_VERSION###"
 
 case "$1" in
-    upgrade|remove|deconfigure)
+    remove)
+      # Make sure no sites use that version
+      for link in /omd/sites/*/version
+      do
+          target=$(readlink $link 2>/dev/null) || continue
+          version=${target##*/}
+          if [ "$version" = "###OMD_VERSION###" ]
+          then
+              site=${link#/omd/sites/}
+              site=${site%/version}
+              echo "Site $site is still using this version!" >&2
+              exit 1
+          fi
+      done
+    ;;
+
+    upgrade|deconfigure)
     ;;
 
     failed-upgrade)



More information about the omd-commits mailing list