database_installer.bat 26 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885
  1. @echo off
  2. REM ##############################################
  3. REM ## L2JDP Database Installer - (by DrLecter) ##
  4. REM ##############################################
  5. REM ## Interactive script setup - (by TanelTM) ##
  6. REM ##############################################
  7. REM Copyright (C) 2008 L2J DataPack
  8. REM This program is free software; you can redistribute it and/or modify
  9. REM it under the terms of the GNU General Public License as published by
  10. REM the Free Software Foundation; either version 2 of the License, or (at
  11. REM your option) any later version.
  12. REM
  13. REM This program is distributed in the hope that it will be useful, but
  14. REM WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
  15. REM or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
  16. REM for more details.
  17. REM
  18. REM You should have received a copy of the GNU General Public License along
  19. REM with this program; if not, write to the Free Software Foundation, Inc.,
  20. REM 675 Mass Ave, Cambridge, MA 02139, USA. Or contact the Official L2J
  21. REM DataPack Project at http://www.l2jdp.com, http://www.l2jdp.com/forum or
  22. REM #l2j-datapack @ irc://irc.freenode.net
  23. set config_file=vars.txt
  24. set config_version=0
  25. set workdir="%cd%"
  26. set full=0
  27. set stage=0
  28. set logging=0
  29. set upgrade_mode=0
  30. set backup=.
  31. set logdir=.
  32. set safe_mode=1
  33. set cmode=c
  34. set fresh_setup=0
  35. :loadconfig
  36. title L2JDP installer - Reading configuration from file...
  37. cls
  38. if not exist %config_file% goto configure
  39. ren %config_file% vars.bat
  40. call vars.bat
  41. ren vars.bat %config_file%
  42. call :colors 17
  43. if /i %config_version% == 1 goto ls_section
  44. set upgrade_mode=2
  45. echo It seems to be the first time you run this version of
  46. echo database_installer but I found a settings file already.
  47. echo I'll hopefully ask this questions just once.
  48. echo.
  49. echo Configuration upgrade options:
  50. echo.
  51. echo (1) Import and continue: I'll read your old settings and
  52. echo continue execution, but since no new settings will be
  53. echo saved, you'll see this menu again next time.
  54. echo.
  55. echo (2) Import and configure: This tool has some new available
  56. echo options, you choose the values that fit your needs
  57. echo using former settings as a base.
  58. echo.
  59. echo (3) Ignose stored settings: I'll let you configure me
  60. echo with a fresh set of default values as a base.
  61. echo.
  62. echo (4) View saved settings: See the contents of the config
  63. echo file.
  64. echo.
  65. echo (5) Quit: Did you came here by mistake?
  66. echo.
  67. set /P upgrade_mode="Type a number, press Enter (default is '%upgrade_mode%'): "
  68. if %upgrade_mode%==1 goto ls_section
  69. if %upgrade_mode%==2 goto configure
  70. if %upgrade_mode%==3 goto configure
  71. if %upgrade_mode%==4 (cls&type %config_file%&pause&goto loadconfig)
  72. if %upgrade_mode%==5 goto :eof
  73. goto loadconfig
  74. :colors
  75. if /i "%cmode%"=="n" (
  76. if not "%1"=="17" ( color F ) else ( color )
  77. ) else ( color %1 )
  78. goto :eof
  79. :configure
  80. call :colors 17
  81. title L2JDP installer - Setup
  82. cls
  83. set config_version=1
  84. if NOT %upgrade_mode% == 2 (
  85. set fresh_setup=1
  86. set mysqlBinPath=%ProgramFiles%\MySQL\MySQL Server 5.0\bin
  87. set lsuser=root
  88. set lspass=
  89. set lsdb=l2jdb
  90. set lshost=localhost
  91. set gsuser=root
  92. set gspass=
  93. set gsdb=l2jdb
  94. set gshost=localhost
  95. set cmode=c
  96. set backup=.
  97. set logdir=.
  98. )
  99. set mysqlPath=%mysqlBinPath%\mysql.exe
  100. echo New settings will be created for this tool to run in
  101. echo your computer, so I need to ask you some questions.
  102. echo.
  103. echo 1-MySql Binaries
  104. echo --------------------
  105. echo In order to perform my tasks, I need the path for commands
  106. echo such as 'mysql' and 'mysqldump'. Both executables are
  107. echo usually stored in the same place.
  108. echo.
  109. if "%mysqlBinPath%" == "" (
  110. set mysqlBinPath=use path
  111. echo I can't determine if the binaries are available with your
  112. echo default settings.
  113. ) else (
  114. echo I can try to find out if the current setting actually works...
  115. echo.
  116. echo %mysqlPath%
  117. )
  118. if not "%mysqlBinPath%" == "use path" call :binaryfind
  119. echo.
  120. path|find "MySQL">NUL
  121. if %errorlevel% == 0 (
  122. echo I found MySQL is in your PATH, this will be used by default.
  123. echo If you want to use something different, change 'use path' for
  124. echo something else.
  125. set mysqlBinPath=use path
  126. ) else (
  127. echo Look, I can't find "MYSQL" in your PATH environment variable.
  128. echo It would be good if you go and find out where "mysql.exe" and
  129. echo "mysqldump.exe" are.
  130. echo.
  131. echo If you have no idea about the meaning of words such as MYSQL
  132. echo or PATH, you'd better close this window, and consider googling
  133. echo and reading about it. Setup and host an L2J server requires a
  134. echo minimum of technical skills.
  135. )
  136. echo.
  137. echo Write the path to your MySQL binaries (no trailing slash needed):
  138. set /P mysqlBinPath="(default %mysqlBinPath%): "
  139. cls
  140. echo.
  141. echo 2-LoginServer settings
  142. echo --------------------
  143. echo I will connect to the MySQL server you specify, and setup a
  144. echo Loginserver database there, most people use a single MySQL
  145. echo server and database for both Login and Gameserver tables.
  146. echo.
  147. set /P lsuser="MySQL Username (default is '%lsuser%'): "
  148. set /P lspass="Password (will be shown as you type, default '%lspass%'): "
  149. set /P lsdb="Database (default is '%lsdb%'): "
  150. set /P lshost="Host (default is '%lshost%'): "
  151. if NOT "%lsuser%"=="%gsuser%" set gsuser=%lsuser%
  152. if NOT "%lspass%"=="%gspass%" set gspass=%lspass%
  153. if NOT "%lsdb%"=="%gsdb%" set gsdb=%lsdb%
  154. if NOT "%lshost%"=="%gshost%" set gshost=%lshost%
  155. echo.
  156. echo 3-GameServer settings
  157. echo --------------------
  158. set /P gsuser="User (default is '%gsuser%'): "
  159. set /P gspass="Pass (default is '%gspass%'): "
  160. set /P gsdb="Database (default is '%gsdb%'): "
  161. set /P gshost="Host (default is '%gshost%'): "
  162. echo.
  163. echo 4-Misc. settings
  164. echo --------------------
  165. set /P cmode="Color mode (c)olor or (n)on-color, default %cmode% : "
  166. set /P backup="Path for your backups (default '%backup%'): "
  167. set /P logdir="Path for your logs (default '%logdir%'): "
  168. :safe1
  169. set safemode=y
  170. set /P safemode="Debugging messages and increase verbosity a lil bit (y/n, default '%safemode%'): "
  171. if /i %safemode%==y (set safe_mode=1&goto safe2)
  172. if /i %safemode%==n (set safe_mode=0&goto safe2)
  173. goto safe1
  174. :safe2
  175. echo.
  176. if "%mysqlBinPath%" == "use path" (
  177. set mysqlBinPath=
  178. set mysqldumpPath=mysqldump
  179. set mysqlPath=mysql
  180. ) else (
  181. set mysqldumpPath=%mysqlBinPath%\mysqldump.exe
  182. set mysqlPath=%mysqlBinPath%\mysql.exe
  183. )
  184. echo @echo off > %config_file%
  185. echo set config_version=%config_version% >> %config_file%
  186. echo set cmode=%cmode%>> %config_file%
  187. echo set safe_mode=%safe_mode% >> %config_file%
  188. echo set mysqlPath=%mysqlPath%>> %config_file%
  189. echo set mysqlBinPath=%mysqlBinPath%>> %config_file%
  190. echo set mysqldumpPath=%mysqldumpPath%>> %config_file%
  191. echo set lsuser=%lsuser%>> %config_file%
  192. echo set lspass=%lspass%>> %config_file%
  193. echo set lsdb=%lsdb%>> %config_file%
  194. echo set lshost=%lshost% >> %config_file%
  195. echo set gsuser=%gsuser%>> %config_file%
  196. echo set gspass=%gspass%>> %config_file%
  197. echo set gsdb=%gsdb%>> %config_file%
  198. echo set gshost=%gshost%>> %config_file%
  199. echo set logdir=%logdir%>> %config_file%
  200. echo set backup=%backup%>> %config_file%
  201. echo.
  202. echo Script setup complete, your settings were saved in the
  203. echo '%config_file%' file. Remember: your passwords are stored
  204. echo as clear text.
  205. echo.
  206. echo press any key to continue...
  207. pause> nul
  208. goto loadconfig
  209. :ls_section
  210. cls
  211. call :colors 17
  212. set cmdline=
  213. set stage=1
  214. title L2JDP installer - Login Server database setup
  215. echo.
  216. echo Trying to make a backup of your loginserver database.
  217. set cmdline="%mysqldumpPath%" --add-drop-table -h %lshost% -u %lsuser% --password=%lspass% %lsdb% ^> "%backup%\loginserver_backup.sql" 2^> NUL
  218. %cmdline%
  219. if %ERRORLEVEL% == 0 goto lsdbok
  220. REM if %safe_mode% == 1 goto omfg
  221. :ls_err1
  222. call :colors 47
  223. title L2JDP installer - Login Server database setup ERROR!!!
  224. cls
  225. echo.
  226. echo Backup attempt failed! A possible reason for this to
  227. echo happen, is that your DB doesn't exist yet. I could
  228. echo try to create %lsdb% for you, or maybe you prefer to
  229. echo proceed with the GameServer part of this tool.
  230. echo.
  231. :ls_ask1
  232. set lsdbprompt=y
  233. echo ATTEMPT TO CREATE LOGINSERVER DATABASE:
  234. echo.
  235. echo (y)es
  236. echo.
  237. echo (n)o
  238. echo.
  239. echo (r)econfigure
  240. echo.
  241. echo (q)uit
  242. echo.
  243. set /p lsdbprompt= Choose (default yes):
  244. if /i %lsdbprompt%==y goto lsdbcreate
  245. if /i %lsdbprompt%==n goto gs_backup
  246. if /i %lsdbprompt%==r goto configure
  247. if /i %lsdbprompt%==q goto end
  248. goto ls_ask1
  249. :omfg
  250. cls
  251. call :colors 57
  252. title L2JDP installer - potential PICNIC detected at stage %stage%
  253. echo.
  254. echo There was some problem while executing:
  255. echo.
  256. echo "%cmdline%"
  257. echo.
  258. echo I'd suggest you to look for correct values and try this
  259. echo script again later. But maybe you'd prefer to go on now.
  260. echo.
  261. if %stage% == 1 set label=ls_err1
  262. if %stage% == 2 set label=ls_err2
  263. if %stage% == 3 set label=gs_backup
  264. if %stage% == 4 set label=gs_err1
  265. if %stage% == 5 set label=gs_err2
  266. if %stage% == 6 set label=horrible_end
  267. if %stage% == 7 set label=horrible_end
  268. :omfgask1
  269. set omfgprompt=q
  270. echo (c)ontinue running the script
  271. echo.
  272. echo (r)econfigure
  273. echo.
  274. echo (q)uit now
  275. echo.
  276. set /p omfgprompt= Choose (default quit):
  277. if /i %omfgprompt%==c goto %label%
  278. if /i %omfgprompt%==r goto configure
  279. if /i %omfgprompt%==q goto horrible_end
  280. goto omfgask1
  281. :lsdbcreate
  282. call :colors 17
  283. set cmdline=
  284. set stage=2
  285. title L2JDP installer - Login Server database setup - DB Creation
  286. echo.
  287. echo Trying to create a Login Server database...
  288. set cmdline="%mysqlPath%" -h %lshost% -u %lsuser% --password=%lspass% -e "CREATE DATABASE %lsdb%" 2^> NUL
  289. %cmdline%
  290. if %ERRORLEVEL% == 0 goto logininstall
  291. if %safe_mode% == 1 goto omfg
  292. :ls_err2
  293. call :colors 47
  294. title L2JDP installer - Login Server database setup - DB Creation error
  295. cls
  296. echo An error occured while trying to create a database for
  297. echo your login server.
  298. echo.
  299. echo Possible reasons:
  300. echo 1-You provided innacurate info , check user, password, etc.
  301. echo 2-User %lsuser% don't have enough privileges for
  302. echo database creation. Check your MySQL privileges.
  303. echo 3-Database exists already...?
  304. echo.
  305. echo Unless you're sure that the pending actions of this tool
  306. echo could work, i'd suggest you to look for correct values
  307. echo and try this script again later.
  308. echo.
  309. :ls_ask2
  310. set omfgprompt=q
  311. echo (c)ontinue running
  312. echo.
  313. echo (r)econfigure
  314. echo.
  315. echo (q)uit now
  316. echo.
  317. set /p omfgprompt= Choose (default quit):
  318. if /i %omfgprompt%==c goto gs_backup
  319. if /i %omfgprompt%==q goto horrible_end
  320. if /i %omfgprompt%==r goto configure
  321. goto ls_ask2
  322. :lsdbok
  323. call :colors 17
  324. title L2JDP installer - Login Server database setup - WARNING!!!
  325. echo.
  326. :asklogin
  327. if %fresh_setup%==0 (
  328. set loginprompt=s
  329. set msg=default skip
  330. ) else (
  331. set loginprompt=x
  332. set msg=no default for fresh install
  333. )
  334. echo LOGINSERVER DATABASE install type:
  335. echo.
  336. echo (f)ull: I will destroy data in your `accounts` and
  337. echo and `gameserver` tables.
  338. echo.
  339. echo (s)kip: I'll take you to the gameserver database
  340. echo installation and upgrade options.
  341. echo.
  342. echo (r)econfigure: You'll be able to redefine MySQL path,
  343. echo user and database information and start over with
  344. echo those fresh values.
  345. echo.
  346. echo (q)uit
  347. echo.
  348. set /p loginprompt= Choose (%msg%) :
  349. if /i %loginprompt%==f goto logininstall
  350. if /i %loginprompt%==s goto gs_backup
  351. if /i %loginprompt%==r goto configure
  352. if /i %loginprompt%==q goto end
  353. goto asklogin
  354. :logininstall
  355. set stage=3
  356. call :colors 17
  357. set cmdline=
  358. title L2JDP installer - Login Server database setup - Full install
  359. echo Deleting loginserver tables for new content.
  360. set cmdline="%mysqlPath%" -h %lshost% -u %lsuser% --password=%lspass% -D %lsdb% ^< login_install.sql 2^> NUL
  361. %cmdline%
  362. if not %ERRORLEVEL% == 0 goto omfg
  363. set full=1
  364. goto gs_backup
  365. :gs_backup
  366. call :colors 17
  367. set cmdline=
  368. if %full% == 1 goto fullinstall
  369. set stage=4
  370. title L2JDP installer - Game server database setup
  371. cls
  372. echo.
  373. echo Making a backup of the original gameserver database.
  374. set cmdline="%mysqldumpPath%" --add-drop-table -h %gshost% -u %gsuser% --password=%gspass% %gsdb% ^> "%backup%\gameserver_backup.sql" 2^> NUL
  375. %cmdline%
  376. if %ERRORLEVEL% == 0 goto gsdbok
  377. if %safe_mode% == 1 goto omfg
  378. :gs_err1
  379. call :colors 47
  380. title L2JDP installer - Game Server database setup - Backup failed!
  381. cls
  382. echo.
  383. echo Backup attempt failed! A possible reason for this to happen,
  384. echo is that your DB doesn't exist yet. I could try to create
  385. echo %gsdb% for you, but maybe you prefer me to continue with
  386. echo last part of the script.
  387. echo.
  388. :askgsdb
  389. set gsdbprompt=y
  390. echo ATTEMPT TO CREATE GAMESERVER DATABASE?
  391. echo.
  392. echo (y)es
  393. echo.
  394. echo (n)o
  395. echo.
  396. echo (r)econfigure
  397. echo.
  398. echo (q)uit
  399. echo.
  400. set /p gsdbprompt= Choose (default yes):
  401. if /i %gsdbprompt%==y goto gsdbcreate
  402. if /i %gsdbprompt%==n goto horrible_end
  403. if /i %gsdbprompt%==r goto configure
  404. if /i %gsdbprompt%==q goto end
  405. goto askgsdb
  406. :gsdbcreate
  407. call :colors 17
  408. set stage=5
  409. set cmdline=
  410. title L2JDP installer - Game Server database setup - DB Creation
  411. cls
  412. echo Trying to create Game Server database...
  413. set cmdline="%mysqlPath%" -h %gshost% -u %gsuser% --password=%gspass% -e "CREATE DATABASE %gsdb%" 2^> NUL
  414. %cmdline%
  415. if %ERRORLEVEL% == 0 goto fullinstall
  416. if %safe_mode% == 1 goto omfg
  417. :gs_err2
  418. call :colors 47
  419. title L2JDP installer - Game Server database setup - DB Creation failed!
  420. cls
  421. echo.
  422. echo An error occured while trying to create a database for
  423. echo your game server.
  424. echo.
  425. echo Possible reasons:
  426. echo 1-You provided innacurate info, check username, pass, etc.
  427. echo 2-User %gsuser% don't have enough privileges for
  428. echo database creation.
  429. echo 3-Database exists already...?
  430. echo.
  431. echo I'd suggest you to look for correct values and try this
  432. echo script again later. But you can try to reconfigure it now.
  433. echo.
  434. :askgsdbcreate
  435. set omfgprompt=q
  436. echo (r)estart script with fresh configuration values
  437. echo.
  438. echo (q)uit now
  439. echo.
  440. set /p omfgprompt= Choose (default quit):
  441. if /i %omfgprompt%==r goto configure
  442. if /i %omfgprompt%==q goto horrible_end
  443. goto askgsdbcreate
  444. :gsdbok
  445. call :colors 17
  446. title L2JDP installer - Game Server database setup - WARNING!!!
  447. cls
  448. echo.
  449. :asktype
  450. set installtype=u
  451. echo GAMESERVER DATABASE install:
  452. echo.
  453. echo (f)ull: WARNING! I'll destroy ALL of your existing character
  454. echo data (i really mean it: items, pets.. ALL)
  455. echo.
  456. echo (u)pgrade: I'll do my best to preserve all of your character
  457. echo data.
  458. echo.
  459. echo (s)kip: We'll get into the last set of questions (cummulative
  460. echo updates, custom stuff...)
  461. echo.
  462. echo (q)uit
  463. echo.
  464. set /p installtype= Choose (default upgrade):
  465. if /i %installtype%==f goto fullinstall
  466. if /i %installtype%==u goto upgradeinstall
  467. if /i %installtype%==s goto custom
  468. if /i %installtype%==q goto end
  469. goto asktype
  470. :fullinstall
  471. call :colors 17
  472. set stage=6
  473. set cmdline=
  474. title L2JDP installer - Game Server database setup - Full install
  475. echo Deleting all gameserver tables for new content...
  476. set cmdline="%mysqlPath%" -h %gshost% -u %gsuser% --password=%gspass% -D %gsdb% ^< full_install.sql 2^> NUL
  477. %cmdline%
  478. if not %ERRORLEVEL% == 0 goto omfg
  479. set full=1
  480. echo.
  481. echo Game Server tables were deleted.
  482. goto upgradeinstall
  483. :upgradeinstall
  484. set stage=6
  485. set cmdline=
  486. if %full% == 1 (
  487. title L2JDP installer - Game Server database setup - Installing...
  488. echo Installing new gameserver content.
  489. ) else (
  490. title L2JDP installer - Game Server database setup - Upgrading...
  491. echo Upgrading gameserver content.
  492. )
  493. if %logging% == 0 set output=NUL
  494. set dest=ls
  495. for %%i in (
  496. accounts.sql
  497. account_data.sql
  498. gameservers.sql
  499. ) do call :dump %%i
  500. set dest=gs
  501. for %%i in (
  502. access_levels.sql
  503. admin_command_access_rights.sql
  504. armor.sql
  505. armorsets.sql
  506. auction.sql
  507. auction_bid.sql
  508. auction_watch.sql
  509. augmentations.sql
  510. auto_chat.sql
  511. auto_chat_text.sql
  512. boxaccess.sql
  513. boxes.sql
  514. castle.sql
  515. castle_door.sql
  516. castle_doorupgrade.sql
  517. castle_functions.sql
  518. castle_manor_procure.sql
  519. castle_manor_production.sql
  520. castle_siege_guards.sql
  521. char_templates.sql
  522. character_friends.sql
  523. character_hennas.sql
  524. character_macroses.sql
  525. character_quests.sql
  526. character_recipebook.sql
  527. character_recommends.sql
  528. character_shortcuts.sql
  529. character_skills.sql
  530. character_skills_save.sql
  531. character_subclasses.sql
  532. characters.sql
  533. clan_data.sql
  534. clan_privs.sql
  535. clan_skills.sql
  536. clan_subpledges.sql
  537. clan_wars.sql
  538. clanhall.sql
  539. clanhall_functions.sql
  540. class_list.sql
  541. cursed_weapons.sql
  542. dimensional_rift.sql
  543. droplist.sql
  544. enchant_skill_trees.sql
  545. etcitem.sql
  546. fish.sql
  547. fishing_skill_trees.sql
  548. fort_door.sql
  549. fort_doorupgrade.sql
  550. fort_siege_guards.sql
  551. fort.sql
  552. fortsiege_clans.sql
  553. forums.sql
  554. games.sql
  555. global_tasks.sql
  556. grandboss_data.sql
  557. grandboss_list.sql
  558. helper_buff_list.sql
  559. henna.sql
  560. henna_trees.sql
  561. heroes.sql
  562. items.sql
  563. itemsonground.sql
  564. locations.sql
  565. lvlupgain.sql
  566. mapregion.sql
  567. merchant_areas_list.sql
  568. merchant_buylists.sql
  569. merchant_lease.sql
  570. merchant_shopids.sql
  571. merchants.sql
  572. minions.sql
  573. npc.sql
  574. npc_buffer.sql
  575. npcskills.sql
  576. olympiad_nobles.sql
  577. pets.sql
  578. pets_stats.sql
  579. pledge_skill_trees.sql
  580. posts.sql
  581. quest_global_data.sql
  582. raidboss_spawnlist.sql
  583. random_spawn.sql
  584. random_spawn_loc.sql
  585. seven_signs.sql
  586. seven_signs_festival.sql
  587. seven_signs_status.sql
  588. siege_clans.sql
  589. skill_learn.sql
  590. skill_spellbooks.sql
  591. skill_trees.sql
  592. spawnlist.sql
  593. teleport.sql
  594. topic.sql
  595. transform_skill_trees.sql;
  596. walker_routes.sql
  597. weapon.sql
  598. zone_vertices.sql
  599. ) do call :dump %%i
  600. echo done...
  601. echo.
  602. goto custom
  603. :dump
  604. set cmdline=
  605. if /i %full% == 1 (set action=Installing) else (set action=Upgrading)
  606. echo %action% %1>>"%output%"
  607. echo %action% %~nx1
  608. if "%dest%"=="ls" set cmdline="%mysqlPath%" -h %lshost% -u %lsuser% --password=%lspass% -D %lsdb% ^< ..\sql\%1 2^>^>"%output%"
  609. if "%dest%"=="gs" set cmdline="%mysqlPath%" -h %gshost% -u %gsuser% --password=%gspass% -D %gsdb% ^< ..\sql\%1 2^>^>"%output%"
  610. %cmdline%
  611. if %logging%==0 if NOT %ERRORLEVEL%==0 call :omfg2 %1
  612. goto :eof
  613. :omfg2
  614. cls
  615. call :colors 47
  616. title L2JDP installer - potential database issue at stage %stage%
  617. echo.
  618. echo Something caused an error while executing instruction :
  619. echo %mysqlPath% -h %gshost% -u %gsuser% --password=%gspass% -D %gsdb%
  620. echo.
  621. echo with file %~nx1
  622. echo.
  623. echo What we should do now?
  624. echo.
  625. :askomfg2
  626. set ntpebcak=c
  627. echo (l)og it: I will create a log for this file, then continue
  628. echo with the rest of the list in non-logging mode.
  629. echo.
  630. echo (c)ontinue: Let's pretend that nothing happened and continue with
  631. echo the rest of the list.
  632. echo.
  633. echo (r)econfigure: Perhaps these errors were caused by a typo.
  634. echo you can restart from scratch and redefine paths, databases
  635. echo and user info again.
  636. echo.
  637. echo (q)uit now
  638. echo.
  639. set /p ntpebcak= Choose (default continue):
  640. if /i %ntpebcak%==c (call :colors 17 & goto :eof)
  641. if /i %ntpebcak%==l (call :logginon %1 & goto :eof)
  642. if /i %ntpebcak%==r (call :configure & exit)
  643. if /i %ntpebcak%==q (call :horrible_end & exit)
  644. goto askomfg2
  645. :logginon
  646. cls
  647. call :colors 17
  648. title L2JDP installer - Game Server database setup - Logging options turned on
  649. set logging=1
  650. if %full% == 1 (
  651. set output=%logdir%\install-%~nx1.log
  652. ) else (
  653. set output=%logdir%\upgrade-%~nx1.log
  654. )
  655. echo.
  656. echo Per your request, i'll create a log file for your reading pleasure.
  657. echo.
  658. echo I'll call it %output%
  659. echo.
  660. echo If you already have such a file and would like to keep a copy.
  661. echo go now and read it or back it up, because it's not going to be rotated
  662. echo or anything, instead i'll just overwrite it.
  663. echo.
  664. echo When you're done or if you don't mind, press any key to start.
  665. pause>NUL
  666. set cmdline="%mysqlPath%" -h %gshost% -u %gsuser% --password=%gspass% -D %gsdb% ^<..\sql\%1 2^>^>"%output%"
  667. date /t >"%output%"
  668. time /t >>"%output%"
  669. %cmdline%
  670. echo Log file created, resuming normal operations...
  671. call :colors 17
  672. set logging=0
  673. set output=NUL
  674. goto :eof
  675. :custom
  676. echo.
  677. set cstprompt=n
  678. set /p cstprompt=Install custom gameserver DB tables: (y) yes or (N) no or (q) quit?
  679. if /i %cstprompt%==y goto cstinstall
  680. if /i %cstprompt%==n goto newbie_helper
  681. if /i %cstprompt%==q goto end
  682. goto newbie_helper
  683. :cstinstall
  684. echo Installing custom content.
  685. cd ..\sql\custom\
  686. echo @echo off> temp.bat
  687. if exist errors.txt del errors.txt
  688. for %%i in (*.sql) do echo "%mysqlPath%" -h %gshost% -u %gsuser% --password=%gspass% -D %gsdb% ^< %%i 2^>^> custom_errors.txt >> temp.bat
  689. call temp.bat> nul
  690. del temp.bat
  691. move custom_errors.txt %workdir%
  692. title L2JDP installer - Game Server database setup - custom tables processing complete
  693. cls
  694. echo Database structure for custom additions finished, i'm leaving a
  695. echo 'custom_errors.txt' file for your consideration.
  696. echo.
  697. echo Remember that in order to get these additions actually working
  698. echo you need to edit your configuration files.
  699. echo.
  700. pause
  701. cd %workdir%
  702. title L2JDP installer - Game Server database setup - L2J Mods
  703. cls
  704. echo L2J provides a basic infraestructure for some non-retail features
  705. echo (aka L2J mods) to get enabled with a minimum of changes.
  706. echo.
  707. echo Some of these mods would require extra tables in order to work
  708. echo and those tables could be created now if you wanted to.
  709. echo.
  710. cd ..\sql\mods\
  711. REM L2J mods that needed extra tables to work properly, should be
  712. REM listed here. To do so copy & paste the following 4 lines and
  713. REM change them properly:
  714. REM MOD: Wedding.
  715. set modprompt=n
  716. set /p modprompt=Install "Wedding Mod" tables: (y) yes or (N) no?
  717. if /i %modprompt%==y "%mysqlPath%" -h %gshost% -u %gsuser% --password=%gspass% -D %gsdb% < mods_wedding.sql 2>>NUL
  718. title L2JDP installer - Game Server database setup - L2J Mods setup complete
  719. cls
  720. echo Database structure for L2J mods finished.
  721. echo.
  722. echo Remember that in order to get these additions actually working
  723. echo you need to edit your configuration files.
  724. echo.
  725. pause
  726. cd %workdir%
  727. goto newbie_helper
  728. :newbie_helper
  729. call :colors 17
  730. set stage=7
  731. title L2JDP installer - Game Server database setup - update SQL files
  732. cls
  733. if %full% == 1 goto end
  734. echo.
  735. echo In the sql/updates folder, we use to store cummulative
  736. echo changes needed by the database structures.
  737. echo.
  738. echo Usually these SQL files are created whenever some new
  739. echo feature implementation requires it.
  740. echo.
  741. echo If you're too lame to know what these changes are about,
  742. echo i can try to apply these patches for you.
  743. :asknb
  744. set nbprompt=a
  745. echo.
  746. echo What we do with the files in sql/updates folder?
  747. echo.
  748. echo (a)utomagic processing: I'll get into the folder and
  749. echo try to dump _every_ '.sql' file i find there, into
  750. echo your database. A fresh setup wouldn't usually need
  751. echo such a thing. And, as any automagic task, this may
  752. echo pose a risk on your data.
  753. echo.
  754. echo (s)kip: I'll do nothing, it's up to you to find out
  755. echo which file does what, which one could be of use for
  756. echo you, etc.
  757. echo.
  758. set /p nbprompt= Choose (default auto):
  759. if /i %nbprompt%==a goto nbinstall
  760. if /i %nbprompt%==s goto end
  761. goto asknb
  762. :nbinstall
  763. cd ..\sql\updates\
  764. echo @echo off> temp.bat
  765. if exist errors.txt del errors.txt
  766. for %%i in (*.sql) do echo "%mysqlPath%" -h %gshost% -u %gsuser% --password=%gspass% -D %gsdb% ^< %%i 2^>^> errors.txt >> temp.bat
  767. call temp.bat> nul
  768. del temp.bat
  769. move errors.txt %workdir%
  770. cd %workdir%
  771. title L2JDP installer - Game Server database setup - updates processing complete
  772. cls
  773. echo Automagic processing finished, i'm leaving an 'errors.txt'
  774. echo file for your consideration.
  775. echo.
  776. echo Remember that some of these files could have tried to add stuff that were
  777. echo part of your database structure already, so don't go out yelling about
  778. echo.
  779. echo 'Duplicate column name'
  780. echo.
  781. echo messages you may find there.
  782. echo.
  783. echo Rather you should focus in those that say
  784. echo.
  785. echo 'Table doesn't exist'
  786. echo.
  787. echo for example.
  788. echo.
  789. pause
  790. goto end
  791. :binaryfind
  792. if EXIST "%mysqlBinPath%" (echo Found) else (echo Not Found)
  793. goto :eof
  794. :horrible_end
  795. call :colors 47
  796. title L2JDP installer - Oops!
  797. cls
  798. echo This wasn't a clean run, but don't worry.
  799. echo You can get help and support:
  800. echo.
  801. echo 1-Read the L2J Datapack project wiki :
  802. echo (http://www.l2jdp.com/trac/wiki)
  803. echo 2-Search for a similar problem in our forums
  804. echo (http://www.l2jdp.com/forum)
  805. echo.
  806. echo You can ask for support in our forums or irc channel:
  807. echo irc://irc.freenode.net channel: #l2j-datapack
  808. echo.
  809. echo I'll try to gather some versioning information that you
  810. echo may find useful when asking for support :
  811. echo.
  812. echo Datapack revision reported by 'SVN version':
  813. svnversion -n 2>NUL
  814. echo.
  815. if %ERRORLEVEL% == 9009 (
  816. echo SVN commandline tools not found!
  817. echo Please download and install "Windows installer with
  818. echo the basic win32 binaries" (or something that fits our
  819. echo binaries needs) from :
  820. echo http://subversion.tigris.org/servlets/ProjectDocumentList?folderID=91
  821. echo.
  822. )
  823. set dpvf="..\config\l2jdp-version.properties"
  824. echo Datapack revision reported by properties file :
  825. if NOT EXIST %dpvf% (
  826. echo Your %dpvf% file is missing!
  827. echo Use eclipse/ant to build one from your DP SVN copy.
  828. echo With it we'll be able to help you better.
  829. ) else (
  830. type %dpvf% | find "version" 2> NUL
  831. if not %ERRORLEVEL% == 0 (
  832. echo An error occured while trying to read
  833. echo your %dpvf% file!
  834. echo Make sure you keep it up to date
  835. echo and in the correct place.
  836. echo %ERRORLEVEL%
  837. ))
  838. echo.
  839. rem del %config_file%
  840. pause
  841. goto end
  842. :end
  843. call :colors 17
  844. title L2JDP installer - Script execution finished
  845. cls
  846. echo.
  847. echo L2JDP database_installer version 0.2.2
  848. echo (C) 2007-2008 L2J Datapack Team
  849. echo database_installer comes with ABSOLUTELY NO WARRANTY;
  850. echo This is free software, and you are welcome to redistribute it
  851. echo under certain conditions; See the file gpl.txt for further
  852. echo details.
  853. echo.
  854. echo Thanks for using our software.
  855. echo visit http://www.l2jdp.com for more info about
  856. echo the Official L2J Datapack project.
  857. echo.
  858. pause
  859. color