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

svn_mapbender at osgeo.org svn_mapbender at osgeo.org
Tue Mar 16 13:50:22 EDT 2010


Author: astrid_emde
Date: 2010-03-16 13:50:22 -0400 (Tue, 16 Mar 2010)
New Revision: 5793

Modified:
   branches/2.6/resources/db/install_2.6.bat
Log:
took new install.sh from trunk - no iso, no mysql

Modified: branches/2.6/resources/db/install_2.6.bat
===================================================================
--- branches/2.6/resources/db/install_2.6.bat	2010-03-16 17:46:42 UTC (rev 5792)
+++ branches/2.6/resources/db/install_2.6.bat	2010-03-16 17:50:22 UTC (rev 5793)
@@ -1,31 +1,40 @@
 @echo off
-REM Script to install Mapbender 2.6 database
+REM Script to install Mapbender  database
 REM
 setlocal
 REM Delete old Logfiles
 del log_*.txt
 del err_*.txt
-:PREP
+:PREP
 echo.
 echo ==============================================================================
 REM Disclaimer
 echo.
-echo DISCLAIMER: this Mapbender database setup script is not stable. USE AT YOUR OWN RISK!
+echo DISCLAIMER: Mapbender database setup script. USE AT YOUR OWN RISK!
 echo This script will create a database for you and will import the Mapbender data to the new database
 echo It will possibly also compile the Mapbender.mo files
 echo.
 echo You need:
-echo - a running postgresql or mysql database 
+echo - a running postgresql 8.x database 
 echo - database user with write access 
 echo.
 echo If everything is prepared you can continue.
+echo You can give nearly all arguments on commandline:
+echo "%0 <HOST> <PORT> <DBNAME> <DBTEMPLATE> <DBUSER>"
 echo.
+echo e.g.
+echo %0 localhost 5432 mapbender template0 postgres
+
+echo.
 echo ==============================================================================
 echo.
+REM 5 Params expected
+if not %5x==x goto ARGSSUPPLIED
+
 echo Continue?
 set /p PREPARED="(y)es or (n)o:"
-
 if %PREPARED%x==x goto :PREP
+
 if %PREPARED%==y goto :PREP_OK
 if %PREPARED%==n goto :End
 goto :PREP
@@ -33,45 +42,22 @@
 
 rem Database
 :DB_TYPE
+
 echo.
-echo Which Database?
-set /p DBTYPE="(p)ostgresql or (m)ysql:"
+set /p DBHOST="Database host (just hit return for default 'localhost'):"
+echo.
 
-if %DBTYPE%==p goto :DB_PG
-if %DBTYPE%==m goto :DB_MYSQL
-goto :DB_TYPE
-
-:DB_PG
-set USEDBTYPE=PostgreSQL
-:DB_MYSQL
-IF %USEDBTYPE%x==x set USEDBTYPE=Mysql
-
-
-REM Encoding
-:DB_ENC
 echo.
-echo Which Encoding?
-set /p DBENC="(u)tf-8 or (i)so-8859-1/latin1:"
+set /p DBPORT="Database port (just hit return for default '5432'):"
+echo.
 
-if %DBENC%==u goto :DB_UTF
-if %DBENC%==i goto :DB_ISO
-goto :DB_ENC
-
-:DB_UTF
-set USEDBENC=UTF-8
-:DB_ISO
-IF %USEDBENC%x==x set USEDBENC=ISO-8859-1
-
 echo.
-set /p DBHOST="Database host (localhost if running on local maschine):"
+set /p DBNAME="Database name:"
 echo.
-
 
 echo.
-set /p DBPORT="Database port (e.g. 5432 for postgres, 3306 for mysql):"
+set /p DBTEMPLATE="database template to use (just hit return for default 'template0'):"
 echo.
-
-
 
 echo.
 set /p DBUSER="Database user:"
@@ -79,24 +65,39 @@
 
 rem Password
 rem echo.
-echo Database Password will be asked many times during install...
+echo Database Password will be asked many times during install, unless pgpass.conf is used...
 
+IF %DBTEMPLATE%x==x set DBTEMPLATE=template0
+IF %DBHOST%x==x set DBHOST=localhost
+IF %DBPORT%x==x set DBPORT=5432
+goto CHOICES
+
+:ARGSSUPPLIED
+set DBHOST=%1
+set DBPORT=%2
+set DBNAME=%3
+set DBTEMPLATE=%4
+set DBUSER=%5
 echo.
-set /p DBNAME="Database name:"
 
 :CHOICES
+REM dbtype and encoding are fixed
+set USEDBTYPE=PostgreSQL
+set USEDBENC=UTF-8
 echo.
 echo Your Choices:
-echo Databasetype: %DBTYPE% - %USEDBTYPE%
-echo Encoding: %DBENC% - %USEDBENC%
-echo Database Host: %DBHOST%
+echo Databasetype: %USEDBTYPE%
+echo Encoding: %USEDBENC%
+echo Database Host: %DBHOST%
 echo Database Port: %DBPORT%
 echo Database Name: %DBNAME%
+echo Database Template: %DBTEMPLATE%
 echo Database User: %DBUSER%
-echo Database Password: %DBPASSWORD% (not shown)
 echo.
 echo Looks ok, start install?
 echo.
+rem delete ARG#5
+shift
 set /p START_INSTALL="(y)es or (n)o? "
 if %START_INSTALL%x==x goto CHOICES
 if %START_INSTALL%==y goto START_INSTALL
@@ -104,19 +105,12 @@
 :START_INSTALL
 rem echo on
 
-if %USEDBTYPE% == PostgreSQL goto INSTPOSTGRESQL
-if %USEDBTYPE% == Mysql goto INSTMYSQL
 
 :INSTPOSTGRESQL
 REM do these exist?
 psql --version 2> nul 1> nul
 if NOT %ERRORLEVEL% == 0 goto PGNOTFOUND
-set /p DBTEMPLATE="database template to use (just hit return for default):"
 
-IF %DBTEMPLATE%x==x set DBTEMPLATE=template0
-IF %DBHOST%x==x set DBHOST=localhost
-IF %DBPORT%x==x set DBPORT=5432
-
 echo creating db
 createdb -U %DBUSER% -E %USEDBENC% -h %DBHOST% -p %DBPORT% -T %DBTEMPLATE% %DBNAME% "Mapbender Database Version 2.6"
 echo creating schema
@@ -127,50 +121,21 @@
 psql -U %DBUSER% -h %DBHOST% -p %DBPORT% -f pgsql/pgsql_serial_set_sequences_2.5.sql %DBNAME% 1>log_sequences.txt 2> err_sequences.txt
 
 echo performing updates
-echo to 2.5.1rc1
+echo   update to 2.5.1rc1
 psql -U %DBUSER% -h %DBHOST% -p %DBPORT% -f pgsql/%USEDBENC%/update/update_2.5_to_2.5.1rc1_pgsql_%USEDBENC%.sql %DBNAME% 1>log_update.txt 2> err_update.txt
-echo to 2.5.1
+echo   update to 2.5.1
 psql -U %DBUSER% -h %DBHOST% -p %DBPORT% -f pgsql/%USEDBENC%/update/update_2.5.1rc1_to_2.5.1_pgsql_%USEDBENC%.sql %DBNAME% 1>>log_update.txt 2>> err_update.txt
-echo to 2.6rc1
+echo   update to 2.6rc1
 psql -U %DBUSER% -h %DBHOST% -p %DBPORT% -f pgsql/%USEDBENC%/update/update_2.5.1_to_2.6rc1_pgsql_%USEDBENC%.sql %DBNAME% 1>>log_update.txt 2>> err_update.txt
-echo to 2.6
+echo   update to 2.6
 psql -U %DBUSER% -h %DBHOST% -p %DBPORT% -f pgsql/%USEDBENC%/update/update_2.6rc1_to_2.6_pgsql_%USEDBENC%.sql %DBNAME% 1>>log_update.txt 2>> err_update.txt
+echo   update to 2.6.1
+psql -U %DBUSER% -h %DBHOST% -p %DBPORT% -f pgsql/%USEDBENC%/update/update_2.6_to_2.6.1_pgsql_%USEDBENC%.sql %DBNAME% 1>> log_update.txt 2>> err_update.txt
 
-
-goto POFILES
-
-:INSTMYSQL
-IF %DBHOST%x==x set DBHOST=localhost
-IF %DBPORT%x==x set DBPORT=3306
-
-mysql --version 2> nul 1> nul
-
-if not %ERRORLEVEL% == 0 goto MYSQLNOTFOUND
-echo creating database
-if %USEDBENC% == ISO-8859-1 mysql -h %DBHOST% -P %DBPORT% -u %DBUSER% -e "create database %DBNAME% character set latin1 COLLATE latin1_german1_ci;" -p
-if %USEDBENC% == UTF-8 mysql -h %DBHOST% -P %DBPORT% -e "create database %DBNAME% character set utf8 COLLATE utf8_general__ci;" -p
-echo creating schema
-mysql %DBNAME% -p -h %DBHOST% -P %DBPORT% -u %DBUSER% < mysql/mysql_schema_2.5.sql > log_schema.txt 2> err_schema.txt
-echo loading data
-mysql %DBNAME% -p -h %DBHOST% -P %DBPORT% -u %DBUSER% < mysql/%USEDBENC%/mysql_data_2.5.sql > log_data.txt 2> err_data.txt
-echo update to 2.5.1rc1
-mysql %DBNAME% -p -h %DBHOST% -P %DBPORT% -u %DBUSER% < mysql/%USEDBENC%/update/update_2.5_to_2.5.1rc1_mysql_%USEDBENC%.sql > log_update.txt 2> err_update.txt
-echo update to 2.5.1
-mysql %DBNAME% -p -h %DBHOST% -P %DBPORT% -u %DBUSER% < mysql/%USEDBENC%/update/update_2.5.1rc1_to_2.5.1_mysql_%USEDBENC%.sql >> log_update.txt 2>> err_update.txt
-echo update to 2.6rc1
-mysql %DBNAME% -p -h %DBHOST% -P %DBPORT% -u %DBUSER% < mysql/%USEDBENC%/update/update_2.5.1_to_2.6rc1_mysql_%USEDBENC%.sql >> log_update.txt 2>> err_update.txt
-echo update to 2.6
-mysql %DBNAME% -p -h %DBHOST% -P %DBPORT% -u %DBUSER% < mysql/%USEDBENC%/update/update_2.6rc1_to_2.6_mysql_%USEDBENC%.sql >> log_update.txt 2>> err_update.txt
-
-
-GOTO POFILES
-
-
-:POFILES
-rem install mapbender.conf
-if not exist ..\..\conf\mapbender.conf copy ..\..\conf\mapbender.conf-dist ..\..\conf\mapbender.conf
+:POFILES
+rem install mapbender.conf
+if not exist ..\..\conf\mapbender.conf copy ..\..\conf\mapbender.conf-dist ..\..\conf\mapbender.conf
 echo please check and edit your mapbender.conf.
-
 
 rem update .po files
 echo ""
@@ -181,25 +146,21 @@
 findstr /v "^# ^chmod" i18n_update_mo.sh > i18n_update_mo.bat
 call i18n_update_mo.bat
 del i18n_update_mo.bat
-popd
-
-
+popd
 goto END:
 
 :MSGFMTNOTFOUND
 echo Sorry, msgfmt not found, must be in PATH-Variable, won't compile translations...
 echo Have a look at http://www.mapbender.org/Gettext#Utility_programms for msgfmt.
 goto END:
-goto END:
+
 :PGNOTFOUND
 echo Sorry, psql not found, must be in PATH-Variable, exiting...
 goto END
-:MYSQLNOTFOUND
-echo Sorry, mysql not found, must be in PATH-Variable, exiting...
-goto END
 
 REM End, keep Terminal session open
 :END
 endlocal
 echo Finished...check the log files to see if an error occured.
-pause 
+echo.
+pause 



More information about the Mapbender_commits mailing list