Author: e2jk-guest
Date: 2013-04-24 19:40:07 +0000 (Wed, 24 Apr 2013)
New Revision: 13403

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


Modified: trunk/packages/gnuhealth/trunk/debian/postinst
===================================================================
--- trunk/packages/gnuhealth/trunk/debian/postinst      2013-04-24 18:58:18 UTC 
(rev 13402)
+++ trunk/packages/gnuhealth/trunk/debian/postinst      2013-04-24 19:40:07 UTC 
(rev 13403)
@@ -21,9 +21,12 @@
 case "$1" in
     configure)
         # Check if the gnuhealth database role already exists
-        #if database role doesn't exist
+        role=`psql -U postgres -c "\du" 2>/dev/null | grep gnuhealth | wc -l`
+        if [ $role -eq 0 ]; then
+            echo "not here"
             # Create the PostgreSQL database role
-        #else
+        else
+            echo "here"
             #if database gnuhealth exists
                 # Update the gnuhealth database
                 #trytond --database=gnuhealth --update=all
@@ -31,7 +34,7 @@
                 # 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
             invoke-rc.d tryton-server start


_______________________________________________
debian-med-commit mailing list
debian-med-commit@lists.alioth.debian.org
http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/debian-med-commit

Reply via email to