[Mapbender-commits] r6618 - branches/2.6/resources/db

svn_mapbender at osgeo.org svn_mapbender at osgeo.org
Fri Jul 23 05:25:29 EDT 2010


Author: christoph
Date: 2010-07-23 09:25:29 +0000 (Fri, 23 Jul 2010)
New Revision: 6618

Modified:
   branches/2.6/resources/db/install_2.6.sh
Log:
latest updates for 2.6.2
* changelog, version number
* (hopefully) improved install.sh

Modified: branches/2.6/resources/db/install_2.6.sh
===================================================================
--- branches/2.6/resources/db/install_2.6.sh	2010-07-23 09:24:46 UTC (rev 6617)
+++ branches/2.6/resources/db/install_2.6.sh	2010-07-23 09:25:29 UTC (rev 6618)
@@ -6,7 +6,6 @@
 function show_disclaimer() {
     # Disclaimer
     echo ""
-    echo "DISCLAIMER: Mapbender database setup script. 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 ""
@@ -16,7 +15,7 @@
     # 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 " * provide a database user that is a superuser"
     echo ""
     echo ""
     echo "If everything is prepared you can continue."
@@ -123,30 +122,40 @@
         echo ""
         exit 1;
     fi
-    echo "Your password will be asked several times, this is normal (unless .pgpass is used)"
+    echo "Your password will be asked twice, this is normal (unless .pgpass is used)"
     echo "creating database"
-    createdb -U $DBUSER  -h $DBHOST -p $DBPORT -E $DBENCODING $DBNAME -T $DBTEMPLATE
-    echo "creating schema"
-	psql -U $DBUSER  -h $DBHOST -p $DBPORT -f pgsql/pgsql_schema_2.5.sql $DBNAME > log_schema.txt 2> err_schema.txt
-    echo "loading data"
-    psql -U $DBUSER  -h $DBHOST -p $DBPORT -f pgsql/$DBENCODING/pgsql_data_2.5.sql $DBNAME > log_data.txt 2> err_data.txt
-	echo "setting sequences"
-    psql -U $DBUSER  -h $DBHOST -p $DBPORT -f pgsql/pgsql_serial_set_sequences_2.5.sql $DBNAME > log_sequences.txt 2> err_squences.txt
-	echo "update to 2.5.1rc1"
-    psql -U $DBUSER  -h $DBHOST -p $DBPORT -f pgsql/$DBENCODING/update/update_2.5_to_2.5.1rc1_pgsql_$DBENCODING.sql $DBNAME > log_update.txt 2> err_update.txt
-	echo "update to 2.5.1"
-	psql -U $DBUSER  -h $DBHOST -p $DBPORT -f pgsql/$DBENCODING/update/update_2.5.1rc1_to_2.5.1_pgsql_$DBENCODING.sql $DBNAME >> log_update.txt 2>> err_update.txt
-	echo "update to 2.6rc1"
-	psql -U $DBUSER  -h $DBHOST -p $DBPORT -f pgsql/$DBENCODING/update/update_2.5.1_to_2.6rc1_pgsql_$DBENCODING.sql $DBNAME >> log_update.txt 2>> err_update.txt
-	echo "update to 2.6"
-	psql -U $DBUSER  -h $DBHOST -p $DBPORT -f pgsql/$DBENCODING/update/update_2.6rc1_to_2.6_pgsql_$DBENCODING.sql $DBNAME >> log_update.txt 2>> err_update.txt
-	echo "update to 2.6.1"
-	psql -U $DBUSER  -h $DBHOST -p $DBPORT -f pgsql/$DBENCODING/update/update_2.6_to_2.6.1_pgsql_$DBENCODING.sql $DBNAME >> log_update.txt 2>> err_update.txt
-	echo "update to 2.6.2"
-	psql -U $DBUSER  -h $DBHOST -p $DBPORT -f pgsql/$DBENCODING/update/update_2.6.1_to_2.6.2_pgsql_$DBENCODING.sql $DBNAME >> log_update.txt 2>> err_update.txt
+    
+#	createdb -U $DBUSER -h $DBHOST -p $DBPORT -E $DBENCODING $DBNAME -T $DBTEMPLATE
 
+	cat pgsql/pgsql_schema_2.5.sql pgsql/$DBENCODING/pgsql_data_2.5.sql pgsql/pgsql_serial_set_sequences_2.5.sql pgsql/$DBENCODING/update/update_2.5_to_2.5.1rc1_pgsql_$DBENCODING.sql pgsql/$DBENCODING/update/update_2.5.1rc1_to_2.5.1_pgsql_$DBENCODING.sql pgsql/$DBENCODING/update/update_2.5.1_to_2.6rc1_pgsql_$DBENCODING.sql pgsql/$DBENCODING/update/update_2.6rc1_to_2.6_pgsql_$DBENCODING.sql pgsql/$DBENCODING/update/update_2.6_to_2.6.1_pgsql_$DBENCODING.sql pgsql/$DBENCODING/update/update_2.6.1_to_2.6.2_pgsql_$DBENCODING.sql > 2.6.sql
+	
+	echo "inserting data (this might take a few minutes)"
+#	psql -U $DBUSER -h $DBHOST -p $DBPORT -f 2.6.sql $DBNAME > log_schema.txt 2> error.log
+	rm 2.6.sql
+
+	echo ""
 }
 
+function update_mapbender_conf(){
+	# creating mapbender.conf
+	if [ -f ../../conf/mapbender.conf ]
+	then
+	echo "mapbender.conf already exists, not changed"
+	else
+
+	echo "Creating mapbender.conf..."
+	echo -n "Please enter the password for user $DBUSER: "
+	
+	stty -echo
+	read password
+	stty echo
+	
+	echo ""  
+	sed -e "s/%%DBSERVER%%/$DBHOST/g" -e "s/%%DBPORT%%/$DBPORT/g" -e "s/%%DBNAME%%/$DBNAME/g" -e "s/%%DBOWNER%%/$DBUSER/g"  -e "s/%%DBPASSWORD%%/$password/g" ../../conf/mapbender.conf-dist >../../conf/mapbender.conf
+	fi
+	echo ""
+}
+
 function set_permissions(){
     echo "The installer can set the permissions to the files"
     echo "and directory for you. If you want the installer to"
@@ -173,15 +182,6 @@
           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
-          if [ -f ../../conf/mapbender.conf ]
-          then
-            echo "mapbender.conf already exists, not changed"
-          else
-            cp ../../conf/mapbender.conf-dist ../../conf/mapbender.conf
-          fi
-          echo ""
-          echo "please check and edit the entries in your mapbender.conf manually!"
 
     fi
 }
@@ -230,11 +230,10 @@
 
 echo "Creating Mapbender administration database"
 create_pgsql_db;
-
+update_mapbender_conf;
 set_permissions;
 compile_po;
 
-echo ""
 echo "Finished...check the log and error files to see if an error occured.";
 
 



More information about the Mapbender_commits mailing list