From 3d3e5267a080e61922b840e3fd35b72124c3f2e1 Mon Sep 17 00:00:00 2001
From: Piotr Gawron <piotr.gawron@uni.lu>
Date: Mon, 12 Aug 2019 16:51:38 +0200
Subject: [PATCH] force upgrade of tomcat to at least tomcat8

---
 CHANGELOG                | 18 ++++++++++++------
 debian/template/control  |  3 ++-
 debian/template/postinst | 13 +++++++++++++
 3 files changed, 27 insertions(+), 7 deletions(-)

diff --git a/CHANGELOG b/CHANGELOG
index 0e5feccbb0..e072471c5c 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1,11 +1,18 @@
+minerva (14.0.0~alpha.1) unstable; urgency=low
+  * Small improvement: debian package can be installed on debian:buster (#879)
+  * Feature removal: support for tomcat7 removed (#828)
+
+ -- Piotr Gawron <piotr.gawron@uni.lu>  Mon, 12 Aug 2019 10:00:00 +0200
+
 minerva (14.0.0~alpha.0) unstable; urgency=low
-  * Feature: security layer redesigned - privilge types and scope changed 
+  * Feature: security layer redesigned - privilege types and scope changed 
     (#636, #624)
   * Feature: log4j is replaced with log4j2 logging mechanism (#291)
   * Feature: database installed via debian package is done via dbconfig-commons
     (#469)
   * Feature: Replaced connection pool manager C3P0 with better maintained
-    Hikari (#564)
+    Hikari - restart of postgresql database doesn't require restart of tomcat 
+    (#564)
   * Feature removal: BioCompendium annotator removed (#32)
   * Small improvement: anonymous login is no longer required - each API query 
     outside session is authorized with anonymous user privileges (#629)
@@ -24,9 +31,8 @@ minerva (14.0.0~alpha.0) unstable; urgency=low
     overlay is now deprecated (#850)
   * Small improvement: information about deprecated columns in data overlay is 
     visible in overlay list (#838)
-  * Small improvement: publication list is resizable (#740)
+  * Small improvement: publication list is resizeable (#740)
   * Small improvement: user list on project edit dialog is sortable (#808)
-  * Small improvement: debian package can be installed on debian:buster (#879)
   * Bug fix: export to CellDesigner of reaction with two modifiers connected
     with boolean operator resulted was skipping some layout information
   * Bug fix: reaction in SBGNML file containing two products was improperly
@@ -40,14 +46,14 @@ minerva (14.0.0~alpha.0) unstable; urgency=low
   * Bug fix: Search drug by target element did not return values when this
     element was annotated automatically (#216)
 
- -- Piotr Gawron <piotr.gawron@uni.lu> Fri, 09 Aug 2019 10:00:00 +0200
+ -- Piotr Gawron <piotr.gawron@uni.lu>  Fri, 09 Aug 2019 10:00:00 +0200
 
 minerva (13.1.2) stable; urgency=medium
   * Bug fix: Information about problematic zip file is more specific (#865)
   * Bug fix: Url didn't contain list of opened plugins and they weren't reload
     automatically on refresh (#866)
 
- -- Piotr Gawron <piotr.gawron@uni.lu> Mon, 22 Jul 2019 17:00:00 +0200
+ -- Piotr Gawron <piotr.gawron@uni.lu>  Mon, 22 Jul 2019 17:00:00 +0200
 
 minerva (13.1.1) stable; urgency=medium
   * Bug fix: adding gene mapping before the genome caused an error (#835)
diff --git a/debian/template/control b/debian/template/control
index 6796880b4a..e4d12c6446 100644
--- a/debian/template/control
+++ b/debian/template/control
@@ -15,4 +15,5 @@ Description: Standalone web application for visualization, exploration and
 Section: science
 Homepage: http://r3lab.uni.lu/web/minerva-website/
 Recommends: postgresql (>=9.3)
-Depends: ${misc:Depends}, openjdk-8-jre-headless | openjdk-11-jre-headless, dbconfig-pgsql | dbconfig-no-thanks, tomcat7 | tomcat8 |tomcat9
+Breaks: tomcat7
+Depends: ${misc:Depends}, openjdk-8-jre-headless | openjdk-11-jre-headless, web | dbconfig-no-thanks, tomcat8 |tomcat9
diff --git a/debian/template/postinst b/debian/template/postinst
index 016862312e..cc0055554f 100644
--- a/debian/template/postinst
+++ b/debian/template/postinst
@@ -82,6 +82,19 @@ case "$1" in
     rm -rf /var/lib/$TOMCAT_PACKAGE/webapps/minerva
     ln -sf /usr/share/minerva/minerva.war /var/lib/$TOMCAT_PACKAGE/webapps/minerva.war
     invoke-rc.d $TOMCAT_PACKAGE start
+
+    
+    #minerva prior to 14.0 could be installed on tomcat7, we need to migrate files from such version to current one
+    if [ -d "/var/lib/tomcat7/webapps/map_images/" ]; then
+      log "moving '/var/lib/tomcat7/webapps/map_images/' -> '/var/lib/$TOMCAT_PACKAGE/webapps/map_images/'";
+      mv /var/lib/tomcat7/webapps/map_images/ /var/lib/$TOMCAT_PACKAGE/webapps/map_images/
+      chown -R $TOMCAT_PACKAGE:$TOMCAT_PACKAGE /var/lib/$TOMCAT_PACKAGE/webapps/map_images/
+    fi
+    if [ -d "/var/lib/tomcat7/webapps/minerva-big/" ]; then
+      log "moving '/var/lib/tomcat7/webapps/minerva-big/' -> '/var/lib/$TOMCAT_PACKAGE/webapps/minerva-big/'";
+      mv /var/lib/tomcat7/webapps/minerva-big/ /var/lib/$TOMCAT_PACKAGE/webapps/minerva-big/
+      chown -R $TOMCAT_PACKAGE:$TOMCAT_PACKAGE /var/lib/$TOMCAT_PACKAGE/webapps/minerva-big/
+    fi
     ;;
     *)
         echo "postinst called with unknown argument \`$1'" >&2
-- 
GitLab