[Mapbender-commits] r5491 - trunk/mapbender/resources/db

svn_mapbender at osgeo.org svn_mapbender at osgeo.org
Tue Feb 9 15:27:26 EST 2010


Author: astrid_emde
Date: 2010-02-09 15:27:24 -0500 (Tue, 09 Feb 2010)
New Revision: 5491

Modified:
   trunk/mapbender/resources/db/update.sh
Log:
added encoding to request, when parameter are passed on command line

Modified: trunk/mapbender/resources/db/update.sh
===================================================================
--- trunk/mapbender/resources/db/update.sh	2010-02-09 09:15:17 UTC (rev 5490)
+++ trunk/mapbender/resources/db/update.sh	2010-02-09 20:27:24 UTC (rev 5491)
@@ -6,20 +6,15 @@
 function show_disclaimer() {
     # Disclaimer
     echo ""
-    echo "DISCLAIMER: this Mapbender database setup script is not stable. USE AT YOUR OWN RISK!"
-    echo "The script will create a database for you and will import the Mapbender data to the new database"
-    echo "It will also compile the Mapbender.mo files"
+    echo "DISCLAIMER: Mapbender update script. USE AT YOUR OWN RISK!"
+    echo "The script will run the update SQLs"
     echo ""
-    echo "To run this script you have to set the following options"
-    # echo " * set the right to execute on this install script"
-    # echo " * set the right to execute on mapbender/tools/i18n_update_mo.sh"
-    # echo " * write access to mapbender/log"
-    # echo " * write access to mapbender/http/tmp"
-    # echo " * write access to mapbender/resources/locale/ and subdirectories"
-    echo " * provide a database user that can create a database"
+    echo "-------"
     echo ""
+    echo "./update.sh pqsql localhost 5432 mapbender postgres UTF-8"
     echo ""
-    echo "DBVERSION HOST PORT DBNAME DBUSER"
+    echo "------"
+    echo "DBVERSION ENCODING HOST PORT DBNAME DBUSER"
     echo ""
 }
 
@@ -36,8 +31,10 @@
         echo ""
         echo "database version? (p)ostgresql or (m)ysql?"
         read DBVERSION
+	: ${DBVERSION:="p"}
     done
 
+
     # db name
     until [ -n "$DBNAME" ]
     do
@@ -58,16 +55,31 @@
     echo ""
     echo "database host (e.g. localhost)?"
     read DBHOST
+	: ${DBHOST:="localhost"}
 
     echo ""
     echo "database port (e.g. 5432 for postgres, 3306 for mysql)?"
     read DBPORT
+	: ${DBPORT:="5432"}
 
-
     echo ""
     echo "database user?"
     read DBUSER
 
+    # db encoding
+    echo ""
+    echo "database character encoding? (i)so-8859-1 or (u)tf-8?"
+    read DBENCODING
+	: ${DBENCODING:="u"}
+
+    if ["$DBENCODING" = "i" ]
+    then
+        DBENCODING="ISO-8859-1"
+    else
+        DBENCODING="UTF-8"
+    fi
+
+
 #using a password via commandline oder as shell var could lead to security problems, so we don't do it
 #    echo ""
 #    echo "Password for $DBUSER (will not be shown)?"
@@ -86,7 +98,7 @@
     echo "db port:" $DBPORT
     echo "dbname:" $DBNAME
     echo "user:"     $DBUSER
-    echo ""
+    echo "encoding:" $DBENCODING
 }
 
 #show Database Configuration
@@ -112,9 +124,9 @@
     fi
 
     echo "update to 2.6.1"
-	mysql $DBNAME -p$DBPASSWORD -u $DBUSER -h $DBHOST -P $DBPORT < mysql/$DBENCODING/update/update_2.6_to_2.6.1_mysql_$DBENCODING.sql >> log_update.txt 2>> err_update.txt
+	mysql $DBNAME -p $DBPASSWORD -u $DBUSER -h $DBHOST -P $DBPORT < mysql/$DBENCODING/update/update_2.6_to_2.6.1_mysql_$DBENCODING.sql >> log_update.txt 2>> err_update.txt
 	echo "update to 2.7"
-	mysql $DBNAME -p$DBPASSWORD -u $DBUSER -h $DBHOST -P $DBPORT < mysql/$DBENCODING/update/update_2.6.1_to_2.7_mysql_$DBENCODING.sql >> log_update.txt 2>> err_update.txt
+	mysql $DBNAME -p $DBPASSWORD -u $DBUSER -h $DBHOST -P $DBPORT < mysql/$DBENCODING/update/update_2.6.1_to_2.7_mysql_$DBENCODING.sql >> log_update.txt 2>> err_update.txt
 
 
 }
@@ -154,6 +166,7 @@
 	DBPORT=$3
 	DBNAME=$4
 	DBUSER=$5
+	DBENCODING=$6
 fi;	
 show_db_config;
 



More information about the Mapbender_commits mailing list