[med-svn] r5331 - trunk/packages/openmrs/trunk/debian
Misha Koshelev
misha680-guest at alioth.debian.org
Wed Oct 6 02:58:45 UTC 2010
Author: misha680-guest
Date: 2010-10-06 02:58:44 +0000 (Wed, 06 Oct 2010)
New Revision: 5331
Added:
trunk/packages/openmrs/trunk/debian/templates
Modified:
trunk/packages/openmrs/trunk/debian/postrm
Log:
attempting to add debconf'ed postrm question
Modified: trunk/packages/openmrs/trunk/debian/postrm
===================================================================
--- trunk/packages/openmrs/trunk/debian/postrm 2010-10-06 02:24:37 UTC (rev 5330)
+++ trunk/packages/openmrs/trunk/debian/postrm 2010-10-06 02:58:44 UTC (rev 5331)
@@ -3,25 +3,35 @@
set -e
+. /usr/share/debconf/confmodule
+
case "$1" in
purge)
# are we using the default openmrs-runtime.properties location?
if [ -f /etc/openmrs/openmrs-runtime.properties ]; then
- # attempt to remove database if mysql and local
CONNECTION_URL=$(cat /etc/openmrs/openmrs-runtime.properties | grep connection.url)
CONNECTION_URL_MYSQL=$(echo $CONNECTION_URL | grep mysql)
CONNECTION_URL_LOCALHOST3306=$(echo $CONNECTION_URL | grep localhost:3306)
+ # is the database mysql and local?
if ! [ "$CONNECTION_URL_MYSQL" = "" ] && ! [ "$CONNECTION_URL_LOCALHOST3306" = "" ]; then
- DATABASE_NAME=$(echo $CONNECTION_URL | sed 's at .*localhost:3306/\([^?]*\).*@\1@')
- CONNECTION_USERNAME=$(cat /etc/openmrs/openmrs-runtime.properties | grep connection.username | sed 's/connection.username=//')
- CONNECTION_PASSWORD=$(cat /etc/openmrs/openmrs-runtime.properties | grep connection.password | sed 's/connection.password=//')
- # 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 $DATABASE_NAME > /dev/null 2>&1 || true
+ db_input high openmrs/confirm-delete-database || true
+ db_go || true
+ db_get openmrs/confirm-delete-database
+ # does user wish to delete the database?
+ if [ "$RET" = true ]; then
+ DATABASE_NAME=$(echo $CONNECTION_URL | sed 's at .*localhost:3306/\([^?]*\).*@\1@')
+ CONNECTION_USERNAME=$(cat /etc/openmrs/openmrs-runtime.properties | grep connection.username | sed 's/connection.username=//')
+ CONNECTION_PASSWORD=$(cat /etc/openmrs/openmrs-runtime.properties | grep connection.password | sed 's/connection.password=//')
+ # 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 $DATABASE_NAME > /dev/null 2>&1 || true
+ fi
fi
fi
rm -rf /etc/openmrs
+
+ db_purge
;;
remove|upgrade|failed-upgrade|abort-install|abort-upgrade|disappear)
Added: trunk/packages/openmrs/trunk/debian/templates
===================================================================
--- trunk/packages/openmrs/trunk/debian/templates (rev 0)
+++ trunk/packages/openmrs/trunk/debian/templates 2010-10-06 02:58:44 UTC (rev 5331)
@@ -0,0 +1,6 @@
+Template: openmrs/confirm-delete-database
+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
More information about the debian-med-commit
mailing list