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

svn_mapbender at osgeo.org svn_mapbender at osgeo.org
Thu Jun 25 09:11:26 EDT 2009


Author: christoph
Date: 2009-06-25 09:11:25 -0400 (Thu, 25 Jun 2009)
New Revision: 4232

Added:
   trunk/mapbender/resources/db/install_2.6.sh
Log:
copied from branch 2.6

updated by David Arndt

Added: trunk/mapbender/resources/db/install_2.6.sh
===================================================================
--- trunk/mapbender/resources/db/install_2.6.sh	                        (rev 0)
+++ trunk/mapbender/resources/db/install_2.6.sh	2009-06-25 13:11:25 UTC (rev 4232)
@@ -0,0 +1,225 @@
+#!/bin/bash
+#
+
+rm log_*.txt
+
+# 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 ""
+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 "If everything is prepared you can continue."
+echo ""
+echo "Continue? (y)es or (n)o"
+read disclaimer
+
+if test $disclaimer != "y"
+then
+	exit 1
+fi
+
+# ask for db version
+echo ""
+echo "Database version? (p)ostgresql or (m)ysql?"
+read dbversion
+
+if test $dbversion != "p" -a $dbversion != "m"
+then
+	echo ""
+	echo "Incorrect database type. Terminating the script..."
+	exit 1
+fi
+
+# ask for db character encoding-U $dbuser
+echo ""
+echo "Database character encoding? (i)so-8859-1 or (u)tf-8?"
+read dbenc
+
+if test $dbenc != "i" -a $dbenc != "u"
+then
+	echo ""
+	echo "Incorrect database character encoding. Terminating the script..."
+	exit 1
+fi
+
+# ask for database name
+echo ""
+echo "Name of database?"
+read dbname
+
+
+if test $dbversion = "m"
+then
+
+	echo "Not available!!!"
+	exit 1
+
+	echo ""
+	echo "Enter your MySQL password:"
+	stty -echo
+	read password
+	stty echo
+	echo ""
+
+	if test $dbenc = "i"
+	then
+		echo ""
+		echo "Installing Mapbender with MySQL (ISO-8859-1) in database $dbname";
+		echo ""
+
+		mysql -e "create database $dbname CHARACTER SET latin1 COLLATE latin1_german1_ci;" -p$password
+		mysql $dbname -p$password < mysql/mysql_schema_2.5.sql > log_schema.txt
+		mysql $dbname -p$password < mysql/ISO-8859-1/mysql_data_2.5.sql > log_data.txt
+		mysql $dbname -p$password < mysql/ISO-8859-1/update/update_2.5_to_2.5.1rc1_mysql_ISO-8859-1.sql > log_update.txt
+		mysql $dbname -p$password < mysql/ISO-8859-1/update/update_2.5.1rc1_to_2.5.1_mysql_ISO-8859-1.sql > log_update.txt
+		mysql $dbname -p$password < mysql/ISO-8859-1/update/update_2.5.1_to_2.6rc1_mysql_ISO-8859-1.sql > log_update.txt
+	
+	elif test $dbenc = "u"
+	then
+		echo ""
+		echo "Installing Mapbender with MySQL (UTF-8) in database $dbname";
+		echo ""
+
+		mysql -e "create database $dbname CHARACTER SET utf8 COLLATE utf8_general_ci;" -p$password
+		mysql $dbname -p$password < mysql/mysql_schema_2.5.sql > log_schema.txt
+		mysql $dbname -p$password < mysql/UTF-8/mysql_data_2.5.sql > log_data.txt
+		mysql $dbname -p$password < mysql/UTF-8/update/update_2.5_to_2.5.1rc1_mysql_UTF-8.sql > log_update.txt
+		mysql $dbname -p$password < mysql/UTF-8/update/update_2.5.1rc1_to_2.5.1_mysql_UTF-8.sql > log_update.txt
+		mysql $dbname -p$password < mysql/UTF-8/update/update_2.5.1_to_2.6rc1_mysql_UTF-8.sql > log_update.txt
+	fi
+elif test $dbversion = "p" -a $dbenc = "i"
+then
+	#Creating database user with rw access
+	echo "Please specify a user for the database"
+	read mapbenderuser
+	
+	
+	
+    	echo ""
+	    echo "Installing Mapbender with PostgreSQL (ISO-8859-1) in database $dbname";
+	    echo ""
+
+        # ask for database user
+        echo ""
+        echo "Name of database user?"
+        read dbuser
+
+        #ask for database template
+        echo ""
+        echo "Do you want to use a database template? (y)es or (n)o "    
+        read dbtemplateuse
+
+        if test $dbtemplateuse = "y"
+        then
+           #ask for template name
+           echo ""
+           echo "Name of the template?"
+           read dbtemplate
+        fi
+    
+        if test dbtemplate != ""
+        then  
+           createdb -U $dbuser -E ISO-8859-1 $dbname -T $dbtemplate
+        else  
+          createdb -U $dbuser -E ISO-8859-1 $dbname  
+        fi
+
+	psql -U $dbuser -f pgsql/pgsql_schema_2.5.sql $dbname > log_schema.txt
+	psql -U $dbuser -f pgsql/ISO-8859-1/pgsql_data_2.5.sql $dbname > log_data.txt
+	psql -U $dbuser -f pgsql/pgsql_serial_set_sequences_2.5.sql $dbname > log_sequences.txt
+	psql -U $dbuser -f pgsql/ISO-8859-1/update/update_2.5_to_2.5.1rc1_pgsql_ISO-8859-1.sql $dbname > log_update.txt
+	psql -U $dbuser -f pgsql/ISO-8859-1/update/update_2.5.1rc1_to_2.5.1_pgsql_ISO-8859-1.sql $dbname > log_update.txt
+	psql -U $dbuser -f pgsql/ISO-8859-1/update/update_2.5.1_to_2.6rc1_pgsql_ISO-8859-1.sql $dbname > log_update.txt
+
+elif test $dbversion = "p" -a $dbenc = "u"
+then
+	echo ""
+	echo "Installing Mapbender with PostgreSQL (UTF-8) in database $dbname";
+	echo ""
+	
+        # ask for database user
+        echo ""
+        echo "Name of database user?"
+        read dbuser
+
+        #ask for database template
+        echo ""
+        echo "Do you want to use a database template? (y)es or (n)o "    
+        read dbtemplateuse
+
+        if test $dbtemplateuse = "y"
+        then
+           #ask for template name
+           echo ""
+           echo "Name of the template?"
+           read dbtemplate
+        fi
+
+    
+    echo "The script will ask you several times for your database password. Don't be confused about this."
+ 
+    
+        if test $dbtemplate != ""
+        then  
+           createdb -U $dbuser -E UTF-8 $dbname -T $dbtemplate
+        else  
+          createdb -U $dbuser -E UTF-8 $dbname  
+        fi
+
+	psql -U $dbuser -f pgsql/pgsql_schema_2.5.sql $dbname > log_schema.txt
+	psql -U $dbuser -f pgsql/UTF-8/pgsql_data_2.5.sql $dbname > log_data.txt
+	psql -U $dbuser -f pgsql/pgsql_serial_set_sequences_2.5.sql $dbname > log_sequences.txt
+	psql -U $dbuser -f pgsql/UTF-8/update/update_2.5_to_2.5.1rc1_pgsql_UTF-8.sql $dbname > log_update.txt
+	psql -U $dbuser -f pgsql/UTF-8/update/update_2.5.1rc1_to_2.5.1_pgsql_UTF-8.sql $dbname > log_update.txt
+	psql -U $dbuser -f pgsql/UTF-8/update/update_2.5.1_to_2.6rc1_pgsql_UTF-8.sql $dbname > log_update.txt
+	psql -U $dbuser -f pgsql/UTF-8/update/update_2.6rc1_to_2.6rc2_pgsql_UTF-8.sql $dbname > log_update.txt
+fi
+
+echo "The installer can set the permissions to the files"
+echo "and directory for you. If you want the installer to"
+echo "do this please enter (y)es else (n)o"
+echo "Please note, to do this you have to be"
+echo "read write access to the Mapbender directory"
+read automatic
+
+if test $automatic != "n"
+then
+      echo "Do you want that all files are owned by the apache webserver? (y)es or (n)o"
+      read setowner
+      if test $setowner != "n"
+      then
+	    echo "Please specify the webserver user"
+	    read webservuser
+	    chown -R $webservuser:$webservuser ../../
+      fi
+      echo "setting permissions on /resources/locale/ and subdirectories"
+      chmod -R o+rw ../locale
+      echo "setting execute rights on mapbender/tools/i18n_update_mo.sh"
+      chmod -R o+rx ../../tools/i18n_update_mo.sh
+      # creating mapbender.conf
+      cp ../../conf/mapbender.conf-dist ../../conf/mapbender.conf
+      
+fi
+
+echo ""
+echo "Compiling .po files..."
+cd ../../tools/
+./i18n_update_mo.sh
+cd ../resources/db/
+echo "removing permissions on /resources/locale/ and subdirectories"
+chmod -R o-rw ../locale
+echo "removing execute rights on mapbender/tools/i18n_update_mo.sh"
+chmod -R o-rx ../../tools/i18n_update_mo.sh
+echo ""
+echo ""
+echo "Finished...check the log files to see if an error occured.";



More information about the Mapbender_commits mailing list