[med-svn] r5340 - in trunk/packages/openmrs/trunk/debian: . po

Misha Koshelev misha680-guest at alioth.debian.org
Wed Oct 6 21:40:25 UTC 2010


Author: misha680-guest
Date: 2010-10-06 21:40:24 +0000 (Wed, 06 Oct 2010)
New Revision: 5340

Added:
   trunk/packages/openmrs/trunk/debian/config
Modified:
   trunk/packages/openmrs/trunk/debian/changelog
   trunk/packages/openmrs/trunk/debian/po/templates.pot
   trunk/packages/openmrs/trunk/debian/postinst
   trunk/packages/openmrs/trunk/debian/postrm
   trunk/packages/openmrs/trunk/debian/templates
Log:
1.6.1-2 ready to go; fixed and tested per advice in http://old.nabble.com/OpenMRS-package-is-ready%2C-I-believe-tp29833953p29893759.html

Modified: trunk/packages/openmrs/trunk/debian/changelog
===================================================================
--- trunk/packages/openmrs/trunk/debian/changelog	2010-10-06 20:21:21 UTC (rev 5339)
+++ trunk/packages/openmrs/trunk/debian/changelog	2010-10-06 21:40:24 UTC (rev 5340)
@@ -1,7 +1,7 @@
-openmrs (1.6.1-2) unstable; urgency=low
+openmrs (1.6.1-2) UNRELEASED; urgency=low
 
   * Change OpenMRS description to not use first person
-  * Purge OpenMRS database in postrm script if possible
+  * Purge OpenMRS database in postrm script if desired
   * Update patch that allows specification of the runtime properties directory
     to match version in OpenMRS trunk
 

Added: trunk/packages/openmrs/trunk/debian/config
===================================================================
--- trunk/packages/openmrs/trunk/debian/config	                        (rev 0)
+++ trunk/packages/openmrs/trunk/debian/config	2010-10-06 21:40:24 UTC (rev 5340)
@@ -0,0 +1,23 @@
+#!/bin/sh
+# config script for openmrs
+
+set -e
+
+. /usr/share/debconf/confmodule
+
+# try to load from configuration file
+REMOVE_DATA_ON_PURGE=""
+if [ -f /etc/openmrs/behavior_on_purge ]; then
+   REMOVE_DATA_ON_PURGE=$(grep "RemoveDataOnPurge" /etc/openmrs/behavior_on_purge | sed s/RemoveDataOnPurge=// || true)
+fi
+
+if [ "$REMOVE_DATA_ON_PURGE" = "yes" ]; then
+   db_set openmrs/remove-data-on-purge true
+elif ! [ "$REMOVE_DATA_ON_PURGE" = "" ]; then
+   db_set openmrs/remove-data-on-purge false
+else
+   # not present? ask user (low priority - only seen in expert mode)
+   # default behavior is _not_ to purge
+   db_input low openmrs/remove-data-on-purge || true
+   db_go || true
+fi

Modified: trunk/packages/openmrs/trunk/debian/po/templates.pot
===================================================================
--- trunk/packages/openmrs/trunk/debian/po/templates.pot	2010-10-06 20:21:21 UTC (rev 5339)
+++ trunk/packages/openmrs/trunk/debian/po/templates.pot	2010-10-06 21:40:24 UTC (rev 5340)
@@ -8,7 +8,7 @@
 msgstr ""
 "Project-Id-Version: PACKAGE VERSION\n"
 "Report-Msgid-Bugs-To: openmrs at packages.debian.org\n"
-"POT-Creation-Date: 2010-10-05 22:09-0500\n"
+"POT-Creation-Date: 2010-10-06 15:40-0500\n"
 "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
 "Last-Translator: FULL NAME <EMAIL at ADDRESS>\n"
 "Language-Team: LANGUAGE <LL at li.org>\n"
@@ -20,13 +20,14 @@
 #. Type: boolean
 #. Description
 #: ../templates:1001
-msgid "Would you like to delete the local OpenMRS database?"
+msgid ""
+"Would you like to remove the local OpenMRS database on openmrs package purge?"
 msgstr ""
 
 #. Type: boolean
 #. Description
 #: ../templates:1001
 msgid ""
-"This will erase _all_ data inside OpenMRS, including patients, concepts, "
-"users, etc. Please consider carefully."
+"Attention, if you answer \"yes\" all your data will be gone in case of "
+"purging the openmrs package."
 msgstr ""

Modified: trunk/packages/openmrs/trunk/debian/postinst
===================================================================
--- trunk/packages/openmrs/trunk/debian/postinst	2010-10-06 20:21:21 UTC (rev 5339)
+++ trunk/packages/openmrs/trunk/debian/postinst	2010-10-06 21:40:24 UTC (rev 5340)
@@ -8,8 +8,18 @@
 case "$1" in
     configure)
 
+	# Save remove data on purge config
+	echo '## attention, if you set the following variable to "yes" all your data' > /etc/openmrs/behavior_on_purge
+	echo '## will be gone in case of purging the openmrs package' >> /etc/openmrs/behavior_on_purge
+	echo -n 'RemoveDataOnPurge=' >> /etc/openmrs/behavior_on_purge
+	db_get openmrs/remove-data-on-purge
+	if [ "$RET" = true ]; then
+	    echo "yes" >> /etc/openmrs/behavior_on_purge
+	else
+	    echo "no" >> /etc/openmrs/behavior_on_purge
+	fi
+
 	# Retrieve tomcat6 group
-	db_version 2.0
 	db_get tomcat6/groupname && TOMCAT6_GROUP="$RET" || TOMCAT6_GROUP="tomcat6"
 
 	# /etc/openmrs must be writeable by tomcat6 user for OpenMRS configuration files

Modified: trunk/packages/openmrs/trunk/debian/postrm
===================================================================
--- trunk/packages/openmrs/trunk/debian/postrm	2010-10-06 20:21:21 UTC (rev 5339)
+++ trunk/packages/openmrs/trunk/debian/postrm	2010-10-06 21:40:24 UTC (rev 5340)
@@ -7,31 +7,33 @@
 
 case "$1" in
     purge)
+	# should we remove data on purge?
+	REMOVE_DATA_ON_PURGE=""
+	if [ -f /etc/openmrs/behavior_on_purge ]; then
+	    REMOVE_DATA_ON_PURGE=$(grep "RemoveDataOnPurge" /etc/openmrs/behavior_on_purge | sed s/RemoveDataOnPurge=// || true)
+	fi
 
-	# are we using the default openmrs-runtime.properties location?
-	if [ -f	/etc/openmrs/openmrs-runtime.properties	]; then
+	if [ "$REMOVE_DATA_ON_PURGE" = "yes" ]; then
+
+   	    # are we using the default openmrs-runtime.properties location?
+	    if [ -f /etc/openmrs/openmrs-runtime.properties ]; then
 	    
-	    # extract data from properties file
-            CONNECTION_URL=$(cat /etc/openmrs/openmrs-runtime.properties | grep connection.url || true)
-            CONNECTION_URL_DATABASE_NAME=$(echo $CONNECTION_URL | sed 's at .*localhost:3306/\([^?]*\).*@\1@' || true)
-	    CONNECTION_URL_MYSQL=$(echo $CONNECTION_URL | grep mysql || true)
-	    CONNECTION_URL_LOCALHOST3306=$(echo $CONNECTION_URL | grep localhost:3306 || true)
-	    CONNECTION_USERNAME=$(cat /etc/openmrs/openmrs-runtime.properties | grep connection.username | sed 's/connection.username=//' || true)
-	    CONNECTION_PASSWORD=$(cat /etc/openmrs/openmrs-runtime.properties | grep connection.password | sed 's/connection.password=//' || true)
+		# extract data from properties file
+		CONNECTION_URL=$(cat /etc/openmrs/openmrs-runtime.properties | grep connection.url || true)
+		CONNECTION_URL_DATABASE_NAME=$(echo $CONNECTION_URL | sed 's at .*localhost:3306/\([^?]*\).*@\1@' || true)
+		CONNECTION_URL_MYSQL=$(echo $CONNECTION_URL | grep mysql || true)
+		CONNECTION_URL_LOCALHOST3306=$(echo $CONNECTION_URL | grep localhost:3306 || true)
+		CONNECTION_USERNAME=$(cat /etc/openmrs/openmrs-runtime.properties | grep connection.username | sed 's/connection.username=//' || true)
+		CONNECTION_PASSWORD=$(cat /etc/openmrs/openmrs-runtime.properties | grep connection.password | sed 's/connection.password=//' || true)
 
-            if ! [ "$CONNECTION_URL_MYSQL" = "" ] && ! [  "$CONNECTION_URL_LOCALHOST3306" = "" ] &&
-  	       ! [ "$CONNECTION_USERNAME" = "" ] && ! [ "$CONNECTION_PASSWORD" = "" ]; then
+		# sanity check
+		if ! [ "$CONNECTION_URL_MYSQL" = "" ] && ! [  "$CONNECTION_URL_LOCALHOST3306" = "" ] && 
+		   ! [ "$CONNECTION_URL_DATABASE_NAME" = "" ] && ! [ "$CONNECTION_USERNAME" = "" ] && 
+		   ! [ "$CONNECTION_PASSWORD" = "" ]; then
 
-                # confirm delete with user
-		db_input high openmrs/confirm-delete-database || true
-		db_go
-		db_get openmrs/confirm-delete-database
-
-		if [ "$RET" = true ]; then
-
 		    # we only drop the database, we cannot drop the user as the openmrs default user
 		    # does not have permissions to drop users
-		    echo "drop database $DATABASE_NAME" | mysql --user=$CONNECTION_USERNAME --password=$CONNECTION_PASSWORD > /dev/null 2>&1 || true
+		    echo "drop database $CONNECTION_URL_DATABASE_NAME" | mysql --user=$CONNECTION_USERNAME --password=$CONNECTION_PASSWORD > /dev/null 2>&1 || true
 
 		fi
 
@@ -40,8 +42,6 @@
         fi
 
         rm -rf /etc/openmrs
-
-	db_purge
     ;;
 
     remove|upgrade|failed-upgrade|abort-install|abort-upgrade|disappear)

Modified: trunk/packages/openmrs/trunk/debian/templates
===================================================================
--- trunk/packages/openmrs/trunk/debian/templates	2010-10-06 20:21:21 UTC (rev 5339)
+++ trunk/packages/openmrs/trunk/debian/templates	2010-10-06 21:40:24 UTC (rev 5340)
@@ -1,6 +1,5 @@
-Template: openmrs/confirm-delete-database
+Template: openmrs/remove-data-on-purge
 Type: boolean
 Default: false
-_Description: Would you like to delete the local OpenMRS database?
- This will erase _all_ data inside OpenMRS, including patients, concepts,
- users, etc. Please consider carefully.
\ No newline at end of file
+_Description: Would you like to remove the local OpenMRS database on openmrs package purge?
+ Attention, if you answer "yes" all your data will be gone in case of purging the openmrs package.




More information about the debian-med-commit mailing list