database_installer.bat 26 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896
  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.1\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. armor.sql
  503. armorsets.sql
  504. auction_bid.sql
  505. auction_watch.sql
  506. auto_announcements.sql
  507. auto_chat.sql
  508. auto_chat_text.sql
  509. castle_door.sql
  510. castle_doorupgrade.sql
  511. castle_functions.sql
  512. castle_manor_procure.sql
  513. castle_manor_production.sql
  514. castle_siege_guards.sql
  515. char_creation_items.sql
  516. char_templates.sql
  517. character_friends.sql
  518. character_hennas.sql
  519. character_macroses.sql
  520. character_quests.sql
  521. character_raid_points.sql
  522. character_recipebook.sql
  523. character_recommends.sql
  524. character_shortcuts.sql
  525. character_skills.sql
  526. character_skills_save.sql
  527. character_subclasses.sql
  528. characters.sql
  529. clan_data.sql
  530. clan_privs.sql
  531. clan_skills.sql
  532. clan_subpledges.sql
  533. clan_wars.sql
  534. clanhall_functions.sql
  535. class_list.sql
  536. cursed_weapons.sql
  537. dimensional_rift.sql
  538. droplist.sql
  539. enchant_skill_trees.sql
  540. etcitem.sql
  541. fish.sql
  542. fishing_skill_trees.sql
  543. fort_doorupgrade.sql
  544. fort_functions.sql
  545. fort_siege_guards.sql
  546. fort_spawnlist.sql
  547. fort_staticobjects.sql
  548. fortsiege_clans.sql
  549. four_sepulchers_spawnlist.sql
  550. games.sql
  551. global_tasks.sql
  552. grandboss_list.sql
  553. helper_buff_list.sql
  554. henna.sql
  555. henna_trees.sql
  556. heroes.sql
  557. item_attributes.sql
  558. items.sql
  559. itemsonground.sql
  560. locations.sql
  561. lvlupgain.sql
  562. mapregion.sql
  563. merchant_areas_list.sql
  564. merchant_buylists.sql
  565. merchant_lease.sql
  566. merchant_shopids.sql
  567. merchants.sql
  568. minions.sql
  569. npc.sql
  570. npcskills.sql
  571. olympiad_nobles.sql
  572. olympiad_nobles_eom.sql
  573. pets.sql
  574. pets_skills.sql
  575. pets_stats.sql
  576. pledge_skill_trees.sql
  577. posts.sql
  578. quest_global_data.sql
  579. raidboss_spawnlist.sql
  580. random_spawn.sql
  581. random_spawn_loc.sql
  582. seven_signs.sql
  583. siege_clans.sql
  584. skill_learn.sql
  585. skill_spellbooks.sql
  586. skill_trees.sql
  587. spawnlist.sql
  588. teleport.sql
  589. topic.sql
  590. transform_skill_trees.sql;
  591. walker_routes.sql
  592. weapon.sql
  593. zone_vertices.sql
  594. ) do call :dump %%i
  595. if %full% == 1 (
  596. for %%i in (
  597. access_levels.sql
  598. admin_command_access_rights.sql
  599. auction.sql
  600. castle.sql
  601. clanhall.sql
  602. fort.sql
  603. forums.sql
  604. grandboss_data.sql
  605. npc_buffer.sql
  606. seven_signs_festival.sql
  607. seven_signs_status.sql
  608. ) do call :dump %%i
  609. )
  610. echo done...
  611. echo.
  612. goto custom
  613. :dump
  614. set cmdline=
  615. if /i %full% == 1 (set action=Installing) else (set action=Upgrading)
  616. echo %action% %1>>"%output%"
  617. echo %action% %~nx1
  618. if "%dest%"=="ls" set cmdline="%mysqlPath%" -h %lshost% -u %lsuser% --password=%lspass% -D %lsdb% ^< ..\sql\%1 2^>^>"%output%"
  619. if "%dest%"=="gs" set cmdline="%mysqlPath%" -h %gshost% -u %gsuser% --password=%gspass% -D %gsdb% ^< ..\sql\%1 2^>^>"%output%"
  620. %cmdline%
  621. if %logging%==0 if NOT %ERRORLEVEL%==0 call :omfg2 %1
  622. goto :eof
  623. :omfg2
  624. cls
  625. call :colors 47
  626. title L2JDP installer - potential database issue at stage %stage%
  627. echo.
  628. echo Something caused an error while executing instruction :
  629. echo %mysqlPath% -h %gshost% -u %gsuser% --password=%gspass% -D %gsdb%
  630. echo.
  631. echo with file %~nx1
  632. echo.
  633. echo What we should do now?
  634. echo.
  635. :askomfg2
  636. set ntpebcak=c
  637. echo (l)og it: I will create a log for this file, then continue
  638. echo with the rest of the list in non-logging mode.
  639. echo.
  640. echo (c)ontinue: Let's pretend that nothing happened and continue with
  641. echo the rest of the list.
  642. echo.
  643. echo (r)econfigure: Perhaps these errors were caused by a typo.
  644. echo you can restart from scratch and redefine paths, databases
  645. echo and user info again.
  646. echo.
  647. echo (q)uit now
  648. echo.
  649. set /p ntpebcak= Choose (default continue):
  650. if /i %ntpebcak%==c (call :colors 17 & goto :eof)
  651. if /i %ntpebcak%==l (call :logginon %1 & goto :eof)
  652. if /i %ntpebcak%==r (call :configure & exit)
  653. if /i %ntpebcak%==q (call :horrible_end & exit)
  654. goto askomfg2
  655. :logginon
  656. cls
  657. call :colors 17
  658. title L2JDP installer - Game Server database setup - Logging options turned on
  659. set logging=1
  660. if %full% == 1 (
  661. set output=%logdir%\install-%~nx1.log
  662. ) else (
  663. set output=%logdir%\upgrade-%~nx1.log
  664. )
  665. echo.
  666. echo Per your request, i'll create a log file for your reading pleasure.
  667. echo.
  668. echo I'll call it %output%
  669. echo.
  670. echo If you already have such a file and would like to keep a copy.
  671. echo go now and read it or back it up, because it's not going to be rotated
  672. echo or anything, instead i'll just overwrite it.
  673. echo.
  674. echo When you're done or if you don't mind, press any key to start.
  675. pause>NUL
  676. set cmdline="%mysqlPath%" -h %gshost% -u %gsuser% --password=%gspass% -D %gsdb% ^<..\sql\%1 2^>^>"%output%"
  677. date /t >"%output%"
  678. time /t >>"%output%"
  679. %cmdline%
  680. echo Log file created, resuming normal operations...
  681. call :colors 17
  682. set logging=0
  683. set output=NUL
  684. goto :eof
  685. :custom
  686. echo.
  687. set cstprompt=n
  688. set /p cstprompt=Install custom gameserver DB tables: (y) yes or (N) no or (q) quit?
  689. if /i %cstprompt%==y goto cstinstall
  690. if /i %cstprompt%==n goto newbie_helper
  691. if /i %cstprompt%==q goto end
  692. goto newbie_helper
  693. :cstinstall
  694. echo Installing custom content.
  695. cd ..\sql\custom\
  696. echo @echo off> temp.bat
  697. if exist errors.txt del errors.txt
  698. for %%i in (*.sql) do echo "%mysqlPath%" -h %gshost% -u %gsuser% --password=%gspass% -D %gsdb% ^< %%i 2^>^> custom_errors.txt >> temp.bat
  699. call temp.bat> nul
  700. del temp.bat
  701. move custom_errors.txt %workdir%
  702. title L2JDP installer - Game Server database setup - custom tables processing complete
  703. cls
  704. echo Database structure for custom additions finished, i'm leaving a
  705. echo 'custom_errors.txt' file for your consideration.
  706. echo.
  707. echo Remember that in order to get these additions actually working
  708. echo you need to edit your configuration files.
  709. echo.
  710. pause
  711. cd %workdir%
  712. title L2JDP installer - Game Server database setup - L2J Mods
  713. cls
  714. echo L2J provides a basic infraestructure for some non-retail features
  715. echo (aka L2J mods) to get enabled with a minimum of changes.
  716. echo.
  717. echo Some of these mods would require extra tables in order to work
  718. echo and those tables could be created now if you wanted to.
  719. echo.
  720. cd ..\sql\mods\
  721. REM L2J mods that needed extra tables to work properly, should be
  722. REM listed here. To do so copy & paste the following 4 lines and
  723. REM change them properly:
  724. REM MOD: Wedding.
  725. set modprompt=n
  726. set /p modprompt=Install "Wedding Mod" tables: (y) yes or (N) no?
  727. if /i %modprompt%==y "%mysqlPath%" -h %gshost% -u %gsuser% --password=%gspass% -D %gsdb% < mods_wedding.sql 2>>NUL
  728. title L2JDP installer - Game Server database setup - L2J Mods setup complete
  729. cls
  730. echo Database structure for L2J mods finished.
  731. echo.
  732. echo Remember that in order to get these additions actually working
  733. echo you need to edit your configuration files.
  734. echo.
  735. pause
  736. cd %workdir%
  737. goto newbie_helper
  738. :newbie_helper
  739. call :colors 17
  740. set stage=7
  741. title L2JDP installer - Game Server database setup - update SQL files
  742. cls
  743. if %full% == 1 goto end
  744. echo.
  745. echo In the sql/updates folder, we use to store cummulative
  746. echo changes needed by the database structures.
  747. echo.
  748. echo Usually these SQL files are created whenever some new
  749. echo feature implementation requires it.
  750. echo.
  751. echo If you're too lame to know what these changes are about,
  752. echo i can try to apply these patches for you.
  753. :asknb
  754. set nbprompt=a
  755. echo.
  756. echo What we do with the files in sql/updates folder?
  757. echo.
  758. echo (a)utomagic processing: I'll get into the folder and
  759. echo try to dump _every_ '.sql' file i find there, into
  760. echo your database. A fresh setup wouldn't usually need
  761. echo such a thing. And, as any automagic task, this may
  762. echo pose a risk on your data.
  763. echo.
  764. echo (s)kip: I'll do nothing, it's up to you to find out
  765. echo which file does what, which one could be of use for
  766. echo you, etc.
  767. echo.
  768. set /p nbprompt= Choose (default auto):
  769. if /i %nbprompt%==a goto nbinstall
  770. if /i %nbprompt%==s goto end
  771. goto asknb
  772. :nbinstall
  773. cd ..\sql\updates\
  774. echo @echo off> temp.bat
  775. if exist errors.txt del errors.txt
  776. for %%i in (*.sql) do echo "%mysqlPath%" -h %gshost% -u %gsuser% --password=%gspass% -D %gsdb% ^< %%i 2^>^> errors.txt >> temp.bat
  777. call temp.bat> nul
  778. del temp.bat
  779. move errors.txt %workdir%
  780. cd %workdir%
  781. title L2JDP installer - Game Server database setup - updates processing complete
  782. cls
  783. echo Automagic processing finished, i'm leaving an 'errors.txt'
  784. echo file for your consideration.
  785. echo.
  786. echo Remember that some of these files could have tried to add stuff that were
  787. echo part of your database structure already, so don't go out yelling about
  788. echo.
  789. echo 'Duplicate column name'
  790. echo.
  791. echo messages you may find there.
  792. echo.
  793. echo Rather you should focus in those that say
  794. echo.
  795. echo 'Table doesn't exist'
  796. echo.
  797. echo for example.
  798. echo.
  799. pause
  800. goto end
  801. :binaryfind
  802. if EXIST "%mysqlBinPath%" (echo Found) else (echo Not Found)
  803. goto :eof
  804. :horrible_end
  805. call :colors 47
  806. title L2JDP installer - Oops!
  807. cls
  808. echo This wasn't a clean run, but don't worry.
  809. echo You can get help and support:
  810. echo.
  811. echo 1-Read the L2J Datapack project wiki :
  812. echo (http://www.l2jdp.com/trac/wiki)
  813. echo 2-Search for a similar problem in our forums
  814. echo (http://www.l2jdp.com/forum)
  815. echo.
  816. echo You can ask for support in our forums or irc channel:
  817. echo irc://irc.freenode.net channel: #l2j-datapack
  818. echo.
  819. echo I'll try to gather some versioning information that you
  820. echo may find useful when asking for support :
  821. echo.
  822. echo Datapack revision reported by 'SVN version':
  823. svnversion -n 2>NUL
  824. echo.
  825. if %ERRORLEVEL% == 9009 (
  826. echo SVN commandline tools not found!
  827. echo Please download and install "Windows installer with
  828. echo the basic win32 binaries" (or something that fits our
  829. echo binaries needs) from :
  830. echo http://subversion.tigris.org/servlets/ProjectDocumentList?folderID=91
  831. echo.
  832. )
  833. set dpvf="..\config\l2jdp-version.properties"
  834. echo Datapack revision reported by properties file :
  835. if NOT EXIST %dpvf% (
  836. echo Your %dpvf% file is missing!
  837. echo Use eclipse/ant to build one from your DP SVN copy.
  838. echo With it we'll be able to help you better.
  839. ) else (
  840. type %dpvf% | find "version" 2> NUL
  841. if not %ERRORLEVEL% == 0 (
  842. echo An error occured while trying to read
  843. echo your %dpvf% file!
  844. echo Make sure you keep it up to date
  845. echo and in the correct place.
  846. echo %ERRORLEVEL%
  847. ))
  848. echo.
  849. rem del %config_file%
  850. pause
  851. goto end
  852. :end
  853. call :colors 17
  854. title L2JDP installer - Script execution finished
  855. cls
  856. echo.
  857. echo L2JDP database_installer version 0.2.2
  858. echo (C) 2007-2008 L2J Datapack Team
  859. echo database_installer comes with ABSOLUTELY NO WARRANTY;
  860. echo This is free software, and you are welcome to redistribute it
  861. echo under certain conditions; See the file gpl.txt for further
  862. echo details.
  863. echo.
  864. echo Thanks for using our software.
  865. echo visit http://www.l2jdp.com for more info about
  866. echo the Official L2J Datapack project.
  867. echo.
  868. pause
  869. color