[med-svn] r13404 - trunk/packages/gnuhealth/trunk/debian

Emilien Klein e2jk-guest at alioth.debian.org
Wed Apr 24 19:47:47 UTC 2013


Author: e2jk-guest
Date: 2013-04-24 19:47:47 +0000 (Wed, 24 Apr 2013)
New Revision: 13404

Modified:
   trunk/packages/gnuhealth/trunk/debian/postinst
Log:
Check if the gnuhealth database exists


Modified: trunk/packages/gnuhealth/trunk/debian/postinst
===================================================================
--- trunk/packages/gnuhealth/trunk/debian/postinst	2013-04-24 19:40:07 UTC (rev 13403)
+++ trunk/packages/gnuhealth/trunk/debian/postinst	2013-04-24 19:47:47 UTC (rev 13404)
@@ -26,14 +26,17 @@
             echo "not here"
             # Create the PostgreSQL database role
         else
-            echo "here"
-            #if database gnuhealth exists
+            # Check if the gnuhealth database exists
+            db=`psql -U postgres -l 2>/dev/null | grep gnuhealth | wc -l`
+            if [ $db -eq 1 ]; then
+                echo "exists"
                 # Update the gnuhealth database
                 #trytond --database=gnuhealth --update=all
-            #else
+            else
+                echo "doesn't exist"
                 # The user has probably set up it's own database, prompt her
                 # to manually upgrade its database
-            #fi
+            fi
         fi
         # Start the Tryton server
         if which invoke-rc.d >/dev/null 2>&1; then




More information about the debian-med-commit mailing list