@echo off
REM ##############################################
REM ## L2JDP Database Installer - (by DrLecter) ##
REM ##############################################
REM ## Interactive script setup - (by TanelTM) ##
REM ##############################################
REM Copyright © 2012 L2J DataPack
REM This program is free software; you can redistribute it and/or modify
REM it under the terms of the GNU General Public License as published by
REM the Free Software Foundation; either version 3 of the License, or (at
REM your option) any later version.
REM
REM This program is distributed in the hope that it will be useful, but
REM WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
REM or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
REM for more details.
REM
REM You should have received a copy of the GNU General Public License along
REM with this program; if not, write to the Free Software Foundation, Inc.,
REM 675 Mass Ave, Cambridge, MA 02139, USA. Or contact the Official L2J
REM DataPack Project at
http://www.l2jdp.com,
http://www.l2jdp.com/forum or
REM #l2j @
irc://irc.freenode.net
set config_file=vars.txt
set config_version=0
set workdir="%cd%"
set full=0
set stage=0
set logging=0
set upgrade_mode=0
set backup=.
set logdir=.
set safe_mode=1
set cmode=c
set fresh_setup=0
:loadconfig
cls
title L2JTW Datapack ¦wёЛ - ForЎGL2JTW GameServer HighFive Alpha
if not exist %config_file% goto configure
ren %config_file% vars.bat
call vars.bat
ren vars.bat %config_file%
call :colors 17
if /i %config_version% == 2 goto ls_backup
set upgrade_mode=2
echo ±z¦ьҐG¬OІД¤@¦ёЁПҐОіo-УЄ©Ґ»Єє database_installer
echo ¦э¬O§ЪµoІ{¦wёЛёк®Ж®wЄєі]©wАЙ¤wёg¦s¦b
echo ¦]¦№§Ъ±N°Э±zґX-У°ЭГDЎA¤ЮѕЙ±zД~Дт¦wёЛ
echo.
echo §у·sі]©wїп¶µЎG
echo.
echo (1) ѕЙ¤JЎ®Д~ДтЁПҐОВВЄєі]©wЎG±NЁПҐО-쥻ВВЄєёк®ЖЁГҐB¶i¦ж§у·s§@·~
echo.
echo (2) ѕЙ¤JЎ®ЁПҐО·sЄєі]©wЎGѕЙ¤J·sЄєёк®ЖЁГҐB-«·sі]©wёк®Ж
echo.
echo (3) ѕЙ¤JҐю·sЄєёк®ЖЎG©Т¦іВВЄєёк®Ж±N·|Іѕ°ЈЁГҐBѕЙ¤J·sЄєёк®Ж
echo.
echo (4) ¬d¬Э¦sЁъЄєі]©w-И
echo.
echo (5) °hҐX
echo.
set /P upgrade_mode="їй¤JјЖ¦r«бЎAЅР«ц EnterЎ]№wі]-И¬°Ўu%upgrade_mode%ЎvЎ^: "
if %upgrade_mode%==1 goto ls_backup
if %upgrade_mode%==2 goto configure
if %upgrade_mode%==3 goto configure
if %upgrade_mode%==4 (cls&type %config_file%&pause&goto loadconfig)
if %upgrade_mode%==5 goto :eof
goto loadconfig
:colors
if /i "%cmode%"=="n" (
if not "%1"=="17" ( color F ) else ( color )
) else ( color %1 )
goto :eof
:configure
cls
call :colors 17
title L2JTW Datapack ¦wёЛ - ForЎGL2JTW GameServer HighFive Alpha
set config_version=2
if NOT %upgrade_mode% == 2 (
set fresh_setup=1
set mysqlBinPath=%ProgramFiles%\MySQL\MySQL Server 5.0\bin
:_MySQL51
if not exist "%ProgramFiles%\MySQL\MySQL Server 5.1\bin\mysql.exe" goto _MySQL55
set mysqlBinPath=%ProgramFiles%\MySQL\MySQL Server 5.1\bin
:_MySQL55
if not exist "%ProgramFiles%\MySQL\MySQL Server 5.5\bin\mysql.exe" goto _MySQL60
set mysqlBinPath=%ProgramFiles%\MySQL\MySQL Server 5.5\bin
:_MySQL60
if not exist "%ProgramFiles%\MySQL\MySQL Server 6.0\bin\mysql.exe" goto _AppServ
set mysqlBinPath=%ProgramFiles%\MySQL\MySQL Server 6.0\bin
:_AppServ
if not exist "%SystemDrive%\AppServ\MySQL\bin\mysql.exe" goto _other
set mysqlBinPath=%SystemDrive%\AppServ\MySQL\bin
:_other
set lsuser=root
set lspass=
set lsdb=l2jls
set lshost=localhost
set cbuser=root
set cbpass=
set cbdb=l2jcs
set cbhost=localhost
set gsuser=root
set gspass=
set gsdb=l2jgs
set gshost=localhost
set cmode=c
set backup=.
set logdir=.
)
set mysqlPath=%mysqlBinPath%\mysql.exe
echo ·sЄєі]©w-ИЎG
echo.
echo 1.MySql µ{¦Ў
echo --------------------
echo ЅРі]©w mysql.exe ©M mysqldump.exe Єє¦мёm
echo.
if "%mysqlBinPath%" == "" (
set mysqlBinPath=use path
echo ЁS¦і§дЁм MySQL Єє¦мёm
) else (
echo ЅРґъёХҐH¤U©Т§дЁмЄє MySQL ¦мёmЎA¬O§_ҐiҐH¶i¦жѕЙ¤J§@·~
echo.
echo %mysqlPath%
)
if not "%mysqlBinPath%" == "use path" call :binaryfind
echo.
path|find "MySQL">NUL
if %errorlevel% == 0 (
echo ¤W-±¬O§дЁмЄє MySQLЎA¦№¦мёm±N·|іQі]¬°№wі]-ИЎA¦pЄG·Qґ«¦мёmЅР-Ч§п...
set mysqlBinPath=use path
) else (
echo µLЄk§дЁм MySQLЎAЅРїй¤J mysql.exe Єє¦мёm...
echo.
echo ¦pЄG¤ЈЅT©wіo¬O¤°»т·N«д©M¦p¦уѕЮ§@ЎAЅРЁм¬ЫГцєфЇё¬dёЯ©ОЄМ¦Ь L2JTW ©x¤иєфЇёµo°Э©ОґM§д¬ЫГцёк°T
)
echo.
echo ЅРїй¤J mysql.exe Єє¦мёmЎG
set /P mysqlBinPath="(default %mysqlBinPath%): "
cls
echo.
echo 2.µn¤J¦шЄAѕ№і]©w
echo --------------------
echo ¦№§@·~±N·|іsЅu¦Ь©Т«ь©wЄє MySQL ¦шЄAѕ№ЎAЁГҐB¶i¦жѕЙ¤J§@·~
echo.
set /P lsuser="ЁПҐОЄМ¦WєЩЎ]№wі]-ИЎu%lsuser%ЎvЎ^: "
:_lspass
set /P lspass="ЁПҐОЄМ±KЅXЎ]№wі]-ИЎu%lspass%ЎvЎ^: "
if "%lspass%"=="" goto _lspass
set /P lsdb="ёк®Ж®wЎ]№wі]-ИЎu%lsdb%ЎvЎ^: "
set /P lshost="¦мёmЎ]№wі]-ИЎu%lshost%ЎvЎ^: "
echo.
cls
echo.
echo 3-°QЅЧЄ©¦шЄAѕ№і]©w
echo --------------------
echo ¦№§@·~±N·|іsЅu¦ЬЎu°QЅЧЄ©±MҐОЎvЄє MySQL ¦шЄAѕ№ЎAЁГҐB¶i¦жѕЙ¤J§@·~
echo.
set /P cbuser="ЁПҐОЄМ¦WєЩЎ]№wі]-ИЎu%cbuser%ЎvЎ^: "
:_cbpass
set /P cbpass="ЁПҐОЄМ±KЅXЎ]№wі]-ИЎu%cbpass%ЎvЎ^: "
if "%cbpass%"=="" goto _cbpass
set /P cbdb="ёк®Ж®wЎ]№wі]-ИЎu%cbdb%ЎvЎ^: "
set /P cbhost="¦мёmЎ]№wі]-ИЎu%cbhost%ЎvЎ^: "
echo.
cls
echo.
echo 4.№CАё¦шЄAѕ№і]©w
echo --------------------
set /P gsuser="ЁПҐОЄМ¦WєЩЎ]№wі]-ИЎu%gsuser%ЎvЎ^: "
:_gspass
set /P gspass="ЁПҐОЄМ±KЅXЎ]№wі]-ИЎu%gspass%ЎvЎ^: "
if "%gspass%"=="" goto _gspass
set /P gsdb="ёк®Ж®wЎ]№wі]-ИЎu%gsdb%ЎvЎ^: "
set /P gshost="¦мёmЎ]№wі]-ИЎu%gshost%ЎvЎ^: "
echo.
cls
echo.
echo 5.ЁдҐLі]©w
echo --------------------
set /P cmode="ГC¦вјТ¦Ў ©¬°ГC¦в ©О (n)¬°µLГC¦вЎ]№wі]-ИЎu%cmode%ЎvЎ^: "
set /P backup="іЖҐч¦мёmЎ]№wі]-ИЎu%backup%ЎvЎ^: "
set /P logdir="Logs°T®§¦мёmЎ]№wі]-ИЎu%logdir%ЎvЎ^: "
afe1
set safemode=y
set /P safemode="Debug јТ¦ЎЎ]y/nЎA №wі]-ИЎu%safemode%ЎvЎ^: "
if /i %safemode%==y (set safe_mode=1&goto safe2)
if /i %safemode%==n (set safe_mode=0&goto safe2)
goto safe1
afe2
cls
echo.
if "%mysqlBinPath%" == "use path" (
set mysqlBinPath=
set mysqldumpPath=mysqldump
set mysqlPath=mysql
) else (
set mysqldumpPath=%mysqlBinPath%\mysqldump.exe
set mysqlPath=%mysqlBinPath%\mysql.exe
)
echo @echo off > %config_file%
echo set config_version=%config_version% >> %config_file%
echo set cmode=%cmode%>> %config_file%
echo set safe_mode=%safe_mode% >> %config_file%
echo set mysqlPath=%mysqlPath%>> %config_file%
echo set mysqlBinPath=%mysqlBinPath%>> %config_file%
echo set mysqldumpPath=%mysqldumpPath%>> %config_file%
echo set lsuser=%lsuser%>> %config_file%
echo set lspass=%lspass%>> %config_file%
echo set lsdb=%lsdb%>> %config_file%
echo set lshost=%lshost% >> %config_file%
echo set cbuser=%cbuser%>> %config_file%
echo set cbpass=%cbpass%>> %config_file%
echo set cbdb=%cbdb%>> %config_file%
echo set cbhost=%cbhost% >> %config_file%
echo set gsuser=%gsuser%>> %config_file%
echo set gspass=%gspass%>> %config_file%
echo set gsdb=%gsdb%>> %config_file%
echo set gshost=%gshost%>> %config_file%
echo set logdir=%logdir%>> %config_file%
echo set backup=%backup%>> %config_file%
echo.
echo і]©w¦ЁҐ\ЎI
echo §AЄєі]©w-И±N·|Аx¦s¦bЎu%config_file%ЎvЎA©Т¦іЄє±bё№±KЅX±NҐH©ъ¤еЕгҐЬ
echo.
pause
goto loadconfig
:ls_backup
cls
call :colors 17
set cmdline=
set stage=1
title L2JTW Datapack ¦wёЛ - ForЎGL2JTW GameServer HighFive Alpha
echo.
echo Ґї¦bіЖҐчµn¤J¦шЄAѕ№Єєёк®Ж®w...
set cmdline="%mysqldumpPath%" --add-drop-table -h %lshost% -u %lsuser% --password=%lspass% %lsdb% ^> "%backup%\ls_backup.sql" 2^> NUL
%cmdline%
if %ERRORLEVEL% == 0 goto ls_db_ok
:ls_err1
cls
set lsdbprompt=y
call :colors 47
title L2JTW Datapack ¦wёЛ - ForЎGL2JTW GameServer HighFive Alpha
echo.
echo іЖҐчҐў±СЎI
echo -м¦]¬O¦]¬°ёк®Ж®w¤Ј¦s¦b
echo І{¦bҐiҐHА°§A«ШҐЯ %lsdb%ЎA©ОЄМД~ДтЁдҐ¦і]©w
echo.
echo «ШҐЯµn¤J¦шЄAѕ№Єєёк®Ж®wЎH
echo.
echo (y)ЅT©w
echo.
echo (n)Ёъ®ш
echo.
echo ®-«·sі]©w
echo.
echo (q)°hҐX
echo.
set /p lsdbprompt=ЅРїпѕЬЎ]№wі]-И-ЅT©wЎ^:
if /i %lsdbprompt%==y goto ls_db_create
if /i %lsdbprompt%==n goto cs_backup
if /i %lsdbprompt%==r goto configure
if /i %lsdbprompt%==q goto end
goto ls_err1
:ls_db_create
cls
call :colors 17
set cmdline=
set stage=2
title L2JTW Datapack ¦wёЛ - ForЎGL2JTW GameServer HighFive Alpha
echo.
echo Ґї¦b«ШҐЯµn¤J¦шЄAѕ№Єєёк®Ж®w...
set cmdline="%mysqlPath%" -h %lshost% -u %lsuser% --password=%lspass% -e "CREATE DATABASE %lsdb%" 2^> NUL
%cmdline%
if %ERRORLEVEL% == 0 goto ls_db_ok
if %safe_mode% == 1 goto omfg
:ls_err2
cls
set omfgprompt=q
call :colors 47
title L2JTW Datapack ¦wёЛ - ForЎGL2JTW GameServer HighFive Alpha
echo.
echo µn¤J¦шЄAѕ№Єєёк®Ж®w«ШҐЯҐў±СЎI
echo.
echo ҐiЇаЄє-м¦]ЎG
echo 1.їй¤JЄєёк®Жїщ»~ЎAЁТ¦pЎGЁПҐОЄМ¦WєЩ/ЁПҐОЄМ±KЅX/ЁдҐL¬ЫГцёк®Ж
echo 2.ЁПҐОЄМЎu%lsuser%ЎvЄєЕv--¤ЈЁ¬
echo 3.ёк®Ж®w¤w¦s¦b
echo.
echo ЅРАЛ¬dі]©wЁГҐB-ЧҐїЎA©ОЄМЄЅ±µ-«·sі]©w
echo.
echo ©Д~Дт
echo.
echo ®-«·sі]©w
echo.
echo (q)°hҐX
echo.
set /p omfgprompt=ЅРїпѕЬЎ]№wі]-И-°hҐXЎ^:
if /i %omfgprompt%==c goto cs_backup
if /i %omfgprompt%==r goto configure
if /i %omfgprompt%==q goto end
goto ls_err2
:ls_db_ok
cls
set loginprompt=u
call :colors 17
title L2JTW Datapack ¦wёЛ - ForЎGL2JTW GameServer HighFive Alpha
echo.
echo µn¤J¦шЄAѕ№Єєёк®Ж®w¦wёЛЎG
echo.
echo (f) §№ѕгЎG±NІѕ°Ј©Т¦іВВЄєёк®ЖЎA-«·sѕЙ¤J·sЄєёк®Ж
echo.
echo (u) §у·sЎG§Ъ·|єЙ¤O«O«щµnїэЄє©Т¦іёк®Ж
echo.
echo (s) ¬ЩІ¤ЎGёх№L¦№їп¶µ
echo.
echo ® -«·sі]©w
echo.
echo (q) °hҐX
echo.
set /p loginprompt=ЅРїпѕЬЎ]№wі]-И-§у·sЎ^:
if /i %loginprompt%==f goto ls_cleanup
if /i %loginprompt%==u goto ls_upgrade
if /i %loginprompt%==s goto cs_backup
if /i %loginprompt%==r goto configure
if /i %loginprompt%==q goto end
goto ls_db_ok
:ls_cleanup
call :colors 17
set cmdline=
title L2JTW Datapack ¦wёЛ - ForЎGL2JTW GameServer HighFive Alpha
echo.
echo Ґї¦bІѕ°Јµn¤J¦шЄAѕ№Єєёк®Ж®wЎAµM«бѕЙ¤J·sЄєёк®Ж®w...
set cmdline="%mysqlPath%" -h %lshost% -u %lsuser% --password=%lspass% -D %lsdb% ^< ls_cleanup.sql 2^> NUL
%cmdline%
if not %ERRORLEVEL% == 0 goto omfg
set full=1
echo.
echo µn¤J¦шЄAѕ№ёк®Ж®w¤wіQ§R°Ј
goto ls_install
:ls_upgrade
cls
echo.
echo §у·sµn¤J¦шЄAѕ№ёк®Ж®wµІєc
echo.
echo @echo off> temp.bat
if exist ls_errors.log del ls_errors.log
for %%i in (..\sql\login\updates\*.sql) do echo "%mysqlPath%" -h %lshost% -u %lsuser% --password=%lspass% -D %lsdb% --force ^< %%i 2^>^> ls_errors.log >> temp.bat
call temp.bat> nul
del temp.bat
move ls_errors.log %workdir%
goto ls_install
:ls_install
cls
set cmdline=
if %full% == 1 (
title L2JTW Ґї¦b¦wёЛµn¤J¦шЄAѕ№Єєёк®Ж®w...
echo.
echo Ґї¦b¦wёЛ·sЄєµn¤J¦шЄAѕ№Єєёк®Ж®w¤є®e
echo.
) else (
title L2JTW Ґї¦b§у·sµn¤J¦шЄAѕ№Єєёк®Ж®w...
echo.
echo Ґї¦b§у·sµn¤J¦шЄAѕ№Єєёк®Ж®w¤є®e
echo.
)
if %logging% == 0 set output=NUL
set dest=ls
for %%i in (..\sql\login\*.sql) do call :dump %%i
echo §№¦Ё...
echo.
goto cs_backup
:cs_backup
cls
call :colors 17
set cmdline=
set stage=3
title L2JTW Datapack ¦wёЛ - ForЎGL2JTW GameServer HighFive Alpha
echo.
echo Ґї¦bіЖҐчЎu°QЅЧЄ©±MҐОЎvЄєёк®Ж®w...
set cmdline="%mysqldumpPath%" --add-drop-table -h %cbhost% -u %cbuser% --password=%cbpass% %cbdb% ^> "%backup%\cs_backup.sql" 2^> NUL
%cmdline%
if %ERRORLEVEL% == 0 goto cs_db_ok
:cs_err1
cls
set cbdbprompt=y
call :colors 47
title L2JTW Datapack ¦wёЛ - ForЎGL2JTW GameServer HighFive Alpha
echo.
echo іЖҐчҐў±СЎI
echo -м¦]¬O¦]¬°Ўu°QЅЧЄ©±MҐОЎvЄєёк®Ж®w¤Ј¦s¦b
echo І{¦bҐiҐHА°§A«ШҐЯ %cbdb%ЎA©ОЄМД~ДтЁдҐ¦і]©w
echo.
echo «ШҐЯЎu°QЅЧЄ©±MҐОЎvЄєёк®Ж®wЎH
echo.
echo (y)ЅT©w
echo.
echo (n)Ёъ®ш
echo.
echo ®-«·sі]©w
echo.
echo (q)°hҐX
echo.
set /p cbdbprompt=ЅРїпѕЬЎ]№wі]-И-ЅT©wЎ^:
if /i %cbdbprompt%==y goto cs_db_create
if /i %cbdbprompt%==n goto gs_backup
if /i %cbdbprompt%==r goto configure
if /i %cbdbprompt%==q goto end
goto cs_err1
:cs_db_create
cls
call :colors 17
set cmdline=
set stage=4
title L2JTW Datapack ¦wёЛ - ForЎGL2JTW GameServer HighFive Alpha
echo.
echo Ґї¦b«ШҐЯЎu°QЅЧЄ©±MҐОЎvЄєёк®Ж®w...
set cmdline="%mysqlPath%" -h %cbhost% -u %cbuser% --password=%cbpass% -e "CREATE DATABASE %cbdb%" 2^> NUL
%cmdline%
if %ERRORLEVEL% == 0 goto cs_db_ok
if %safe_mode% == 1 goto omfg
:cs_err2
cls
set omfgprompt=q
call :colors 47
title L2JTW Datapack ¦wёЛ - ForЎGL2JTW GameServer HighFive Alpha
echo.
echo Ўu°QЅЧЄ©±MҐОЎvЄєёк®Ж®w«ШҐЯҐў±СЎI
echo.
echo ҐiЇаЄє-м¦]ЎG
echo 1.їй¤JЄєёк®Жїщ»~ЎAЁТ¦pЎGЁПҐОЄМ¦WєЩ/ЁПҐОЄМ±KЅX/ЁдҐL¬ЫГцёк®Ж
echo 2.ЁПҐОЄМЎu%cbuser%ЎvЄєЕv--¤ЈЁ¬
echo 3.ёк®Ж®w¤w¦s¦b
echo.
echo ЅРАЛ¬dі]©wЁГҐB-ЧҐїЎA©ОЄМЄЅ±µ-«·sі]©w
echo.
echo ©Д~Дт
echo.
echo ®-«·sі]©w
echo.
echo (q)°hҐX
echo.
set /p omfgprompt=ЅРїпѕЬЎ]№wі]-И-°hҐXЎ^:
if /i %omfgprompt%==c goto gs_backup
if /i %omfgprompt%==r goto configure
if /i %omfgprompt%==q goto end
goto cs_err2
:cs_db_ok
cls
set communityprompt=u
call :colors 17
title L2JTW Datapack ¦wёЛ - ForЎGL2JTW GameServer HighFive Alpha
echo.
echo Ўu°QЅЧЄ©±MҐОЎvЄєёк®Ж®w¦wёЛЎG
echo.
echo (f)§№ѕгЎG±NІѕ°Ј©Т¦іВВЄєёк®ЖЎA-«·sѕЙ¤J·sЄєёк®Ж
echo.
echo (u)§у·sЎG±N«OЇd©Т¦іВВЄєёк®ЖЎAЁГҐB¶i¦ж§у·s§@·~
echo.
echo (s)¬ЩІ¤ЎGёх№L¦№їп¶µ
echo.
echo ®-«·sі]©w
echo.
echo (q)°hҐX
echo.
set /p communityprompt=ЅРїпѕЬЎ]№wі]-И-§у·sЎ^:
if /i %communityprompt%==f goto cs_cleanup
if /i %communityprompt%==u goto cs_upgrade
if /i %communityprompt%==s goto gs_backup
if /i %communityprompt%==r goto configure
if /i %communityprompt%==q goto end
goto cs_db_ok
:cs_cleanup
call :colors 17
set cmdline=
title L2JTW Datapack ¦wёЛ - ForЎGL2JTW GameServer HighFive Alpha
echo.
echo Ґї¦bІѕ°ЈЎu°QЅЧЄ©±MҐОЎvЄєёк®Ж®wЎAµM«бѕЙ¤J·sЄєёк®Ж®w...
set cmdline="%mysqlPath%" -h %cbhost% -u %cbuser% --password=%cbpass% -D %cbdb% ^< cs_cleanup.sql 2^> NUL
%cmdline%
if not %ERRORLEVEL% == 0 goto omfg
set full=1
echo.
echo Ўu°QЅЧЄ©±MҐОЎvЄєёк®Ж®w¤wіQ§R°Ј
goto cs_install
:cs_upgrade
cls
echo.
echo §у·sЎu°QЅЧЄ©±MҐОЎvЄєёк®Ж®wµІєc
echo.
echo @echo off> temp.bat
if exist cs_errors.log del cs_errors.log
for %%i in (..\sql\community\updates\*.sql) do echo "%mysqlPath%" -h %cbhost% -u %cbuser% --password=%cbpass% -D %cbdb% --force ^< %%i 2^>^> cs_errors.log >> temp.bat
call temp.bat> nul
del temp.bat
move cs_errors.log %workdir%
goto cs_install
:cs_install
cls
set cmdline=
if %full% == 1 (
title L2JTW Datapack ¦wёЛ - ForЎGL2JTW GameServer HighFive Alpha
echo.
echo ¦wёЛ·sЄєЎu°QЅЧЄ©±MҐОЎvёк®Ж®w...
echo.
) else (
title L2JTW Datapack ¦wёЛ - ForЎGL2JTW GameServer HighFive Alpha
echo.
echo §у·sЎu°QЅЧЄ©±MҐОЎvёк®Ж®w...
echo.
)
if %logging% == 0 set output=NUL
set dest=cb
for %%i in (..\sql\community\*.sql) do call :dump %%i
echo done...
echo.
goto gs_backup
:gs_backup
cls
call :colors 17
set cmdline=
set stage=5
title L2JTW Datapack ¦wёЛ - ForЎGL2JTW GameServer HighFive Alpha
echo.
echo Ґї¦bіЖҐч№CАё¦шЄAѕ№Єєёк®Ж®w...
set cmdline="%mysqldumpPath%" --add-drop-table -h %gshost% -u %gsuser% --password=%gspass% %gsdb% ^> "%backup%\gs_backup.sql" 2^> NUL
%cmdline%
if %ERRORLEVEL% == 0 goto gs_db_ok
:gs_err1
cls
set gsdbprompt=y
call :colors 47
title L2JTW Datapack ¦wёЛ - ForЎGL2JTW GameServer HighFive Alpha
echo.
echo іЖҐчҐў±СЎI
echo -м¦]¬O¦]¬°ёк®Ж®w¤Ј¦s¦b
echo І{¦bҐiҐHА°§A«ШҐЯ %gsdb%ЎA©ОЄМД~ДтЁдҐ¦і]©w
echo.
echo «ШҐЯ№CАё¦шЄAѕ№Єєёк®Ж®wЎH
echo.
echo (y)ЅT©w
echo.
echo (n)Ёъ®ш
echo.
echo ®-«·sі]©w
echo.
echo (q)°hҐX
echo.
set /p gsdbprompt=ЅРїпѕЬЎ]№wі]-И-ЅT©wЎ^:
if /i %gsdbprompt%==y goto gs_db_create
if /i %gsdbprompt%==n goto eof
if /i %gsdbprompt%==r goto configure
if /i %gsdbprompt%==q goto end
goto gs_err1
:gs_db_create
cls
call :colors 17
set stage=6
set cmdline=
title L2JTW Datapack ¦wёЛ - ForЎGL2JTW GameServer HighFive Alpha
echo.
echo Ґї¦b«ШҐЯ№CАё¦шЄAѕ№Єєёк®Ж®w...
set cmdline="%mysqlPath%" -h %gshost% -u %gsuser% --password=%gspass% -e "CREATE DATABASE %gsdb%" 2^> NUL
%cmdline%
if %ERRORLEVEL% == 0 goto gs_db_ok
if %safe_mode% == 1 goto omfg
:gs_err2
cls
set omfgprompt=q
call :colors 47
title L2JTW Datapack ¦wёЛ - ForЎGL2JTW GameServer HighFive Alpha
echo.
echo №CАё¦шЄAѕ№Єєёк®Ж®w«ШҐЯҐў±СЎI
echo.
echo ҐiЇаЄє-м¦]ЎG
echo 1.їй¤JЄєёк®Жїщ»~ЎAЁТ¦pЎGЁПҐОЄМ¦WєЩ/ЁПҐОЄМ±KЅX/ЁдҐL¬ЫГцёк®Ж
echo 2.ЁПҐОЄМЎu%gsuser%ЎvЄєЕv--¤ЈЁ¬
echo 3.ёк®Ж®w¤w¦s¦b
echo.
echo ЅРАЛ¬dі]©wЁГҐB-ЧҐїЎA©ОЄМЄЅ±µ-«·sі]©w
echo.
echo ®-«·s°х¦жЁГҐB¶i¦жі]©w
echo.
echo (q)°hҐX
echo.
set /p omfgprompt=ЅРїпѕЬЎ]№wі]-И-°hҐXЎ^:
if /i %omfgprompt%==r goto configure
if /i %omfgprompt%==q goto end
goto gs_err2
:gs_db_ok
cls
set installtype=u
call :colors 17
title L2JTW Datapack ¦wёЛ - ForЎGL2JTW GameServer HighFive Alpha
echo.
echo №CАё¦шЄAѕ№Єєёк®Ж®w¦wёЛЎG
echo.
echo (f)§№ѕгЎG±NІѕ°Ј©Т¦іВВЄєёк®ЖЎA-«·sѕЙ¤J·sЄєёк®Ж
echo.
echo (u)§у·sЎG±N«OЇd©Т¦іВВЄєёк®ЖЎAЁГҐB¶i¦ж§у·s§@·~
echo.
echo (s)¬ЩІ¤ЎGёх№L¦№їп¶µ
echo.
echo (q)°hҐX
echo.
set /p installtype=ЅРїпѕЬЎ]№wі]-И-§у·sЎ^:
if /i %installtype%==f goto gs_cleanup
if /i %installtype%==u goto gs_upgrade
if /i %installtype%==s goto custom_ask
if /i %installtype%==q goto end
goto gs_db_ok
:gs_cleanup
call :colors 17
set cmdline=
title L2JTW Datapack ¦wёЛ - ForЎGL2JTW GameServer HighFive Alpha
echo.
echo Ґї¦bІѕ°Ј№CАё¦шЄAѕ№Єєёк®Ж®wЎAµM«бѕЙ¤J·sЄєёк®Ж®w...
set cmdline="%mysqlPath%" -h %gshost% -u %gsuser% --password=%gspass% -D %gsdb% ^< gs_cleanup.sql 2^> NUL
%cmdline%
if not %ERRORLEVEL% == 0 goto omfg
set full=1
echo.
echo №CАёёк®Ж®wІѕ°Ј§№¦Ё
goto gs_install
:gs_upgrade
cls
echo.
echo §у·s№CАёёк®Ж®wµІєc
echo.
echo @echo off> temp.bat
if exist gs_errors.log del gs_errors.log
for %%i in (..\sql\game\updates\*.sql) do echo "%mysqlPath%" -h %gshost% -u %gsuser% --password=%gspass% -D %gsdb% --force ^< %%i 2^>^> gs_errors.log >> temp.bat
call temp.bat> nul
del temp.bat
move gs_errors.log %workdir%
goto gs_install
:gs_install
cls
set cmdline=
if %full% == 1 (
title L2JTW Datapack ¦wёЛ - ForЎGL2JTW GameServer HighFive Alpha
echo.
echo ¦wёЛ·sЄє№CАёёк®Ж®w...
echo.
) else (
title L2JTW Datapack ¦wёЛ - ForЎGL2JTW GameServer HighFive Alpha
echo.
echo §у·s№CАёёк®Ж®w...
echo.
)
if %logging% == 0 set output=NUL
set dest=gs
for %%i in (..\sql\game\*.sql) do call :dump %%i
for %%i in (..\sql\game\mods\*.sql) do call :dump %%i
for %%i in (..\sql\L2JTW\*.sql) do call :dump %%i
echo §№¦Ё...
echo.
set charprompt=y
set /p charprompt=¦wёЛЎu§ЮЇа/Є««~/Вѕ·~/NPC»ЎёЬЎv¤¤¤е¤Ж: (y) ЅT©w ©О (N) Ёъ®шЎHЎ]№wі]-И-ЅT©wЎ^:
if /i %charprompt%==n goto custom_ask
for %%i in (..\sql\L2JTW_2\*.sql) do call :dump %%i
echo §№¦Ё...
echo.
echo ЎёЄ`·NЎGіЎ¤АЁtІО¦wёЛ¤¤¤е¤Ж·|Ґў±СЎAѕЙ-P№CАё¤¤ҐXІ{¶ГЅX
echo Ў@Ў@Ў@Ў@¦pЄG№JЁміoєШ±Ў§ОЎAЅР¦A¤в°КѕЙ¤J SQL ёМ-±Єє
echo Ў@Ў@Ў@Ў@skill_tw.sql / item_tw.sql / messagetable /
echo Ў@Ў@Ў@Ў@auto_chat_text_tw / char_templates_tw іo 5 -У SQL
goto custom_ask
:dump
set cmdline=
if /i %full% == 1 (set action=¦wёЛ) else (set action=§у·s)
echo %action% %1>>"%output%"
echo %action% %~nx1
if "%dest%"=="ls" set cmdline="%mysqlPath%" -h %lshost% -u %lsuser% --password=%lspass% -D %lsdb% ^< %1 2^>^>"%output%"
if "%dest%"=="cb" set cmdline="%mysqlPath%" -h %cbhost% -u %cbuser% --password=%cbpass% -D %cbdb% ^< %1 2^>^>"%output%"
if "%dest%"=="gs" set cmdline="%mysqlPath%" -h %gshost% -u %gsuser% --password=%gspass% -D %gsdb% ^< %1 2^>^>"%output%"
%cmdline%
if %logging%==0 if NOT %ERRORLEVEL%==0 call :omfg2 %1
goto :eof
:omfg2
cls
set ntpebcak=c
call :colors 47
title L2JTW Datapack ¦wёЛ - ForЎGL2JTW GameServer HighFive Alpha
echo.
echo ҐXІ{їщ»~ЎG
echo %mysqlPath% -h %gshost% -u %gsuser% --password=%gspass% -D %gsdb%
echo.
echo АЙ®Ч %~nx1
echo.
echo іBІz¤и¦ЎЎH
echo.
echo (l)«ШҐЯ°T®§АЙ®Ч¤и«K¬dёЯ
echo.
echo ©Д~Дт
echo.
echo ®-«·sі]©w
echo.
echo (q)°hҐX
echo.
set /p ntpebcak=ЅРїпѕЬЎ]№wі]-И-Д~ДтЎ^:
if /i %ntpebcak%==c (call :colors 17 & goto :eof)
if /i %ntpebcak%==l (call :logginon %1 & goto :eof)
if /i %ntpebcak%==r (call :configure & exit)
if /i %ntpebcak%==q (call :end)
goto omfg2
:logginon
cls
call :colors 17
title L2JTW Datapack ¦wёЛ - ForЎGL2JTW GameServer HighFive Alpha
set logging=1
if %full% == 1 (
set output=%logdir%\install-%~nx1.log
) else (
set output=%logdir%\upgrade-%~nx1.log
)
echo.
echo «ШҐЯ°T®§АЙ®Ч...
echo.
echo АЙ®Ч¬°Ўu%output%Ўv
echo.
echo ¦pЄG¦№АЙ®Ч¤w¦s¦bЎAЅР¶i¦жіЖҐчЎA§_«h±N·|ВР»\№LҐh
echo.
pause
set cmdline="%mysqlPath%" -h %gshost% -u %gsuser% --password=%gspass% -D %gsdb% ^<..\sql\%1 2^>^>"%output%"
date /t >"%output%"
time /t >>"%output%"
%cmdline%
echo «ШҐЯ°T®§ёк®Ж...
call :colors 17
set logging=0
set output=NUL
goto :eof
:custom_ask
title L2JTW Datapack ¦wёЛ - ForЎGL2JTW GameServer HighFive Alpha
cls
set cstprompt=y
echo.
echo custom ¦Ы-qёк®ЖЄнҐ[¤Jёк®Ж®w§№¦Ё
echo ©Т¦іїщ»~ёк°T±N©с¤JЎucustom_errors.logЎv
echo.
echo ЅРЄ`·NЎA¦pЄG-nЁПіoЁЗ¦Ы-qёк®ЖЄнЇа°ч±ТҐО
echo §AҐІ¶·-Ч§п config ЄєАЙ®Чі]©w
echo.
set /p cstprompt=¦wёЛ custom ¦Ы-qёк®ЖЄн: (y) ЅT©w ©О (N) Ёъ®шЎ]№wі]-И-ЅT©wЎ^:
if /i %cstprompt%==y goto custom_install
if /i %cstprompt%==n goto mod_ask
:custom_install
cls
echo.
echo ¦wёЛ custom ¦Ы-q¤є®e
echo @echo off> temp.bat
if exist custom_errors.log del custom_errors.log
for %%i in (..\sql\game\custom\*.sql) do echo "%mysqlPath%" -h %gshost% -u %gsuser% --password=%gspass% -D %gsdb% ^< %%i 2^>^> custom_errors.log >> temp.bat
call temp.bat> nul
del temp.bat
move custom_errors.log %workdir%
goto mod_ask
:mod_ask
title L2JTW Datapack ¦wёЛ - ForЎGL2JTW GameServer HighFive Alpha
cls
set cstprompt=y
echo.
echo Mod ¦Ы-qёк®ЖЄнҐ[¤Jёк®Ж®w§№¦Ё
echo ©Т¦іїщ»~ёк°T±N©с¤JЎumod_errors.logЎv
echo.
echo ЅРЄ`·NЎA¦pЄG-nЁПіoЁЗ¦Ы-qёк®ЖЄнЇа°ч±ТҐО
echo §AҐІ¶·-Ч§п config ЄєАЙ®Чі]©w
echo.
echo.
set /p cstprompt=¦wёЛ Mods ¦Ы-qёк®ЖЄн: (y) ЅT©w ©О (N) Ёъ®шЎ]№wі]-И-ЅT©wЎ^:
if /i %cstprompt%==y goto mod_install
if /i %cstprompt%==n goto end
:mod_install
cls
echo.
echo ¦wёЛ Mods ¦Ы-q¤є®e
echo @echo off> temp.bat
if exist mods_errors.log del mods_errors.log
for %%i in (..\sql\game\mods\*.sql) do echo "%mysqlPath%" -h %gshost% -u %gsuser% --password=%gspass% -D %gsdb% ^< %%i 2^>^> mods_errors.log >> temp.bat
call temp.bat> nul
del temp.bat
move mods_errors.log %workdir%
goto end
:omfg
set omfgprompt=q
call :colors 57
cls
title L2JTW Datapack ¦wёЛ - ForЎGL2JTW GameServer HighFive Alpha
echo.
echo °х¦ж®ЙҐXІ{їщ»~ЎG
echo.
echo "%cmdline%"
echo.
echo «ШДіАЛ¬d¤@¤Uі]©wЄєёк®ЖЎAҐHЅT«O©Т¦іїй¤JЄєјЖ-ИЁS¦іїщ»~ЎI
echo.
if %stage% == 1 set label=ls_err1
if %stage% == 2 set label=ls_err2
if %stage% == 3 set label=cs_err1
if %stage% == 4 set label=cs_err2
if %stage% == 5 set label=gs_err1
if %stage% == 6 set label=gs_err2
echo.
echo ©Д~Дт
echo.
echo ®-«·sі]©w
echo.
echo (q)°hҐX
echo.
set /p omfgprompt=ЅРїпѕЬЎ]№wі]-И-°hҐXЎ^:
if /i %omfgprompt%==c goto %label%
if /i %omfgprompt%==r goto configure
if /i %omfgprompt%==q goto end
goto omfg
:binaryfind
if EXIST "%mysqlBinPath%" (echo §дЁмЄє MySQL) else (echo ЁS¦і§дЁм MySQLЎAЅР¦b¤U-±їй¤JҐїЅTЄє¦мёm...)
goto :eof
:end
call :colors 17
title L2JTW DataPack ¦wёЛ - ForЎGL2JTW GameServer HighFive Alpha
cls
echo.
echo L2JTW DataPack ¦wёЛµ{§З - ForЎGL2JTW GameServer HighFive Alpha
echo © 2007-2012 L2JTW DataPack ¶}µo№О¶¤
echo.
echo ·PБВЁПҐО L2JTW ¦шЄAѕ№
echo ¬ЫГцёк°TҐiҐH¦b
http://www.l2jtw.com ¬dёЯЁм
echo.
pause