1 | @echo off |
---|
2 | rem |
---|
3 | rem install-win.bat |
---|
4 | rem |
---|
5 | |
---|
6 | rem Copyright (C) 2006 Gregory Vincic, Jari Hakkinen, Olle Mansson |
---|
7 | rem Copyright (C) 2007 Gregory Vincic, Olle Mansson |
---|
8 | rem |
---|
9 | rem Files are copyright by their respective authors. The contributions to |
---|
10 | rem files where copyright is not explicitly stated can be traced with the |
---|
11 | rem source code revision system. |
---|
12 | rem |
---|
13 | rem This file is part of Proteios. |
---|
14 | rem Available at http://www.proteios.org/ |
---|
15 | rem |
---|
16 | rem Proteios is free software; you can redistribute it and/or |
---|
17 | rem modify it under the terms of the GNU General Public License |
---|
18 | rem as published by the Free Software Foundation; either version 2 |
---|
19 | rem of the License, or (at your option) any later version. |
---|
20 | rem |
---|
21 | rem Proteios is distributed in the hope that it will be useful, |
---|
22 | rem but WITHOUT ANY WARRANTY, without even the implied warranty of |
---|
23 | rem MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
24 | rem GNU General Public License for more details. |
---|
25 | rem |
---|
26 | rem You should have received a copy of the GNU General Public License |
---|
27 | rem along with this program; if not, write to the Free Software |
---|
28 | rem Foundation, Inc., 59 Temple Place - Suite 330, |
---|
29 | rem Boston, MA 02111-1307, USA. |
---|
30 | |
---|
31 | rem |
---|
32 | rem Performs Proteios 2.x installation on Microsoft Windows. |
---|
33 | rem |
---|
34 | rem Uses bat file inp2var.bat to store console input data |
---|
35 | rem into a given variable. |
---|
36 | rem |
---|
37 | rem Usage: inp2var.bat var_name [promptfile [mask_input]] |
---|
38 | rem |
---|
39 | rem Used programs/files: |
---|
40 | rem |
---|
41 | rem inp2var.bat |
---|
42 | rem inp2var.jar |
---|
43 | rem Replace.jar |
---|
44 | rem |
---|
45 | |
---|
46 | rem |
---|
47 | rem Configuration |
---|
48 | rem |
---|
49 | set sql_client=mysql |
---|
50 | set app_name=proteios |
---|
51 | set build_dir=www\WEB-INF\classes |
---|
52 | rem Store system host name in environment variable %host_name% for use in default notification e-mail "from"-address |
---|
53 | java -jar GetHostName.jar > prompt.txt |
---|
54 | call inp2var.bat host_name prompt.txt no_input |
---|
55 | rem |
---|
56 | rem End Configuration |
---|
57 | rem |
---|
58 | |
---|
59 | rem |
---|
60 | rem Welcome message and installation references |
---|
61 | rem |
---|
62 | echo. |
---|
63 | echo. |
---|
64 | echo Welcome to the %app_name% installation. |
---|
65 | echo. |
---|
66 | echo For more information on the installation steps, see: |
---|
67 | echo http://www.proteios.org/wiki/Installation |
---|
68 | echo. |
---|
69 | |
---|
70 | rem |
---|
71 | rem Get DBMS hostname, administrator name and password |
---|
72 | rem |
---|
73 | :step_1a |
---|
74 | set body_text=1. Enter database host name and user name with create privileges on your DBMS. |
---|
75 | set next_step=step_1b |
---|
76 | goto print |
---|
77 | :step_1b |
---|
78 | echo Database Host [localhost]: > prompt.txt |
---|
79 | call inp2var.bat db_host prompt.txt |
---|
80 | if "%db_host%"=="" set db_host=localhost |
---|
81 | echo Username [root]: > prompt.txt |
---|
82 | call inp2var.bat db_manager prompt.txt |
---|
83 | if "%db_manager%"=="" set db_manager=root |
---|
84 | echo Password: > prompt.txt |
---|
85 | call inp2var.bat db_manager_pwd prompt.txt mask_input |
---|
86 | echo. |
---|
87 | |
---|
88 | rem |
---|
89 | rem Get Proteios root password |
---|
90 | rem |
---|
91 | :step_2a |
---|
92 | set body_text=2. Enter a password for the root account in %app_name%. |
---|
93 | set next_step=step_2b |
---|
94 | goto print |
---|
95 | :step_2b |
---|
96 | echo Password: > prompt.txt |
---|
97 | call inp2var.bat root_pwd prompt.txt mask_input |
---|
98 | echo. |
---|
99 | |
---|
100 | rem |
---|
101 | rem Get DBMS name |
---|
102 | rem |
---|
103 | :step_3a |
---|
104 | set body_text=3. Configure the database name and user that %app_name% will use to connect to your DBMS. |
---|
105 | set next_step=step_3b |
---|
106 | goto print |
---|
107 | :step_3b |
---|
108 | echo Database name [%app_name%]: > prompt.txt |
---|
109 | call inp2var.bat db_name prompt.txt |
---|
110 | if "%db_name%"=="" set db_name=%app_name% |
---|
111 | |
---|
112 | rem |
---|
113 | rem Get DBMS user name and password |
---|
114 | rem |
---|
115 | echo Username [%app_name%]: > prompt.txt |
---|
116 | call inp2var.bat app_user prompt.txt |
---|
117 | if "%app_user%"=="" set app_user=%app_name% |
---|
118 | echo Password: > prompt.txt |
---|
119 | call inp2var.bat app_user_pwd prompt.txt mask_input |
---|
120 | echo. |
---|
121 | |
---|
122 | |
---|
123 | rem |
---|
124 | rem Get user files directory. |
---|
125 | rem |
---|
126 | :step_4a |
---|
127 | set body_text=4. Select a directory for %app_name% to use for user files. |
---|
128 | set next_step=step_4b |
---|
129 | goto print |
---|
130 | :step_4b |
---|
131 | echo User files directory [C:\%app_name%]: > prompt.txt |
---|
132 | call inp2var.bat user_files_dir prompt.txt |
---|
133 | if "%user_files_dir%"=="" set user_files_dir=C:\%app_name% |
---|
134 | rem |
---|
135 | rem Store user files directory name with backslashes "\" |
---|
136 | rem exchanged for slashes "/" in variable %user_files_dir_slashes% |
---|
137 | rem |
---|
138 | echo %user_files_dir% > prompt.txt |
---|
139 | call inp2var.bat user_files_dir_slashes prompt.txt no_input_convert_backslashes |
---|
140 | |
---|
141 | rem |
---|
142 | rem Get temporary files directory. |
---|
143 | rem |
---|
144 | :step_5a |
---|
145 | set body_text=5. Select a directory for %app_name% to use for temporary files. |
---|
146 | set next_step=step_5b |
---|
147 | goto print |
---|
148 | :step_5b |
---|
149 | echo Temporary files directory [C:\temp]: > prompt.txt |
---|
150 | call inp2var.bat temp_files_dir prompt.txt |
---|
151 | if "%temp_files_dir%"=="" set temp_files_dir=C:\temp |
---|
152 | rem |
---|
153 | rem Store temporary files directory name with backslashes "\" |
---|
154 | rem exchanged for slashes "/" in variable %temp_files_dir_slashes% |
---|
155 | rem |
---|
156 | echo %temp_files_dir% > prompt.txt |
---|
157 | call inp2var.bat temp_files_dir_slashes prompt.txt no_input_convert_backslashes |
---|
158 | |
---|
159 | rem |
---|
160 | rem Get FTP control port. |
---|
161 | rem |
---|
162 | :step_6a |
---|
163 | set body_text=6. Select control port for %app_name% FTP Server. |
---|
164 | set next_step=step_6b |
---|
165 | goto print |
---|
166 | :step_6b |
---|
167 | echo FTP Server Control Port [8021]: > prompt.txt |
---|
168 | call inp2var.bat ftp_control_port prompt.txt |
---|
169 | if "%ftp_control_port%"=="" set ftp_control_port=8021 |
---|
170 | |
---|
171 | rem |
---|
172 | rem Get optional FTP passive port range. |
---|
173 | rem |
---|
174 | :step_7a |
---|
175 | set body_text=7. Set optional passive port range for %app_name% FTP Server (min,max or blank). |
---|
176 | set next_step=step_7b |
---|
177 | goto print |
---|
178 | :step_7b |
---|
179 | echo FTP Server Passive Port Range []: > prompt.txt |
---|
180 | call inp2var.bat ftp_passive_port_range prompt.txt |
---|
181 | if "%ftp_passive_port_range%"=="" set ftp_passive_port_range= |
---|
182 | |
---|
183 | rem |
---|
184 | rem Get outgoing mail server for notification e-mail. |
---|
185 | rem |
---|
186 | :step_8a |
---|
187 | set body_text=8. Set outgoing mail server for %app_name% notification e-mail. |
---|
188 | set next_step=step_8b |
---|
189 | goto print |
---|
190 | :step_8b |
---|
191 | echo Mail server []: > prompt.txt |
---|
192 | call inp2var.bat mail_server prompt.txt |
---|
193 | if "%mail_server%"=="" set mail_server= |
---|
194 | |
---|
195 | rem |
---|
196 | rem Get "from"-address for notification e-mail. |
---|
197 | rem |
---|
198 | :step_9a |
---|
199 | set body_text=9. Set "from"-address for %app_name% notification e-mail. |
---|
200 | set next_step=step_9b |
---|
201 | goto print |
---|
202 | :step_9b |
---|
203 | echo Mail "from"-address [noreply@%host_name%]: > prompt.txt |
---|
204 | call inp2var.bat mail_from_address prompt.txt |
---|
205 | if "%mail_from_address%"=="" set mail_from_address=noreply@%host_name% |
---|
206 | |
---|
207 | :step_9c |
---|
208 | rem |
---|
209 | rem Print summary of selected options |
---|
210 | rem |
---|
211 | set body_text=Thank you! Selected options for the installation: |
---|
212 | set next_step=step_9c1 |
---|
213 | goto print |
---|
214 | :step_9c1 |
---|
215 | echo Database Host name : %db_host% |
---|
216 | echo Database Manager Username: %db_manager% |
---|
217 | echo Database name : %db_name% |
---|
218 | echo '%app_name%' Database Username : %app_user% |
---|
219 | echo '%app_name%' User Files Directory : %user_files_dir% |
---|
220 | echo '%app_name%' Temporary Files Directory : %temp_files_dir% |
---|
221 | echo '%app_name%' FTP Server Control Port : %ftp_control_port% |
---|
222 | echo '%app_name%' FTP Server Passive Port Range : %ftp_passive_port_range% |
---|
223 | echo '%app_name%' Outgoing mail server : %mail_server% |
---|
224 | echo '%app_name%' notification e-mail "from"-address: %mail_from_address% |
---|
225 | echo. |
---|
226 | echo Do you want to continue the installation[y/N]? > prompt.txt |
---|
227 | call inp2var.bat continue_install prompt.txt |
---|
228 | if "%continue_install%"=="" set continue_install=N |
---|
229 | if "%continue_install%"=="y" set continue_install=Y |
---|
230 | if not "%continue_install%"=="Y" set continue_install=N |
---|
231 | if "%continue_install%"=="Y" goto yes_install |
---|
232 | set body_text=Installation stopped. Please try again later. |
---|
233 | set next_step=step_9c2 |
---|
234 | goto print |
---|
235 | :step_9c2 |
---|
236 | goto finish |
---|
237 | rem |
---|
238 | rem |
---|
239 | rem |
---|
240 | :yes_install |
---|
241 | set body_text=Let's continue with the installation. |
---|
242 | set next_step=step_9c3 |
---|
243 | goto print |
---|
244 | :step_9c3 |
---|
245 | |
---|
246 | |
---|
247 | rem |
---|
248 | rem Installation |
---|
249 | rem |
---|
250 | rem |
---|
251 | rem Database setup. If database at localhost, do not use -h option. |
---|
252 | rem |
---|
253 | set sql_exec=%sql_client% -h %db_host% -u %db_manager% -p%db_manager_pwd% -e |
---|
254 | if "%db_host%"=="localhost" set sql_exec=%sql_client% -u %db_manager% -p%db_manager_pwd% -e |
---|
255 | rem |
---|
256 | rem Only ask if database should be dropped, if it shouldn't be updated. |
---|
257 | rem |
---|
258 | echo Do you want to update an existing '%db_name%' database [y/N]? > prompt.txt |
---|
259 | call inp2var.bat update_db prompt.txt |
---|
260 | if "%update_db%"=="" set update_db=N |
---|
261 | if "%update_db%"=="y" set update_db=Y |
---|
262 | if not "%update_db%"=="Y" set update_db=N |
---|
263 | if "%update_db%"=="Y" goto yes_update |
---|
264 | rem |
---|
265 | rem No database update, ask if database should be dropped. |
---|
266 | rem |
---|
267 | echo Do you want to drop the existing '%db_name%' database [y/N]? > prompt.txt |
---|
268 | call inp2var.bat drop_db prompt.txt |
---|
269 | if "%drop_db%"=="" set drop_db=N |
---|
270 | if "%drop_db%"=="y" set drop_db=Y |
---|
271 | if not "%drop_db%"=="Y" set drop_db=N |
---|
272 | if "%drop_db%"=="N" goto no_drop |
---|
273 | rem |
---|
274 | rem Dropping existing database [optional] |
---|
275 | rem |
---|
276 | echo Dropping database... |
---|
277 | %sql_exec% "DROP DATABASE IF EXISTS `%db_name%`;" |
---|
278 | echo done |
---|
279 | :no_drop |
---|
280 | :yes_update |
---|
281 | |
---|
282 | rem |
---|
283 | rem Create database if not existing |
---|
284 | rem |
---|
285 | rem (Error checking is needed here) |
---|
286 | rem |
---|
287 | %sql_exec% "CREATE DATABASE IF NOT EXISTS `%db_name%` DEFAULT CHARACTER SET utf8;" |
---|
288 | %sql_exec% "GRANT ALL ON `%db_name%`.* TO '%app_user%'@'%db_host%' IDENTIFIED BY '%app_user_pwd%'; FLUSH PRIVILEGES;" |
---|
289 | |
---|
290 | rem |
---|
291 | rem Update proteios configuration file (parsed by InitDB program) |
---|
292 | rem |
---|
293 | rem |
---|
294 | rem Store current directory in variable %here% |
---|
295 | rem |
---|
296 | cd > prompt.txt |
---|
297 | call inp2var.bat here prompt.txt no_input |
---|
298 | echo Updating %app_name% *.config files in %build_dir% |
---|
299 | cd %build_dir% |
---|
300 | rem |
---|
301 | rem Insert database username, password, name, and user files directory |
---|
302 | rem in file proteios.config.in. |
---|
303 | rem |
---|
304 | java -jar "%here%"\Replace.jar proteios.config.in proteios.config __USERNAME__=%app_user% __PASSWORD__=%app_user_pwd% __DATABASE__=%db_name% __USERFILES__=%user_files_dir_slashes% __HOST__=%db_host% __SMTPHOST__=%mail_server% __MAIL_FROM_ADDRESS__=%mail_from_address% |
---|
305 | cd %here% |
---|
306 | |
---|
307 | rem |
---|
308 | rem Update proteios web.xml file (used by Tomcat) |
---|
309 | rem |
---|
310 | echo Updating %app_name% web.xml file |
---|
311 | cd %build_dir%\.. |
---|
312 | rem |
---|
313 | rem Insert temporary files directory |
---|
314 | rem in file web.xml.in. |
---|
315 | rem |
---|
316 | java -jar "%here%"\Replace.jar web.xml.in web.xml __TEMPFILES__=%temp_files_dir_slashes% |
---|
317 | cd %here% |
---|
318 | |
---|
319 | rem |
---|
320 | rem Update proteios ftp.properties file (used by FTP Server) |
---|
321 | rem |
---|
322 | echo Updating %app_name% ftp.properties file |
---|
323 | cd %build_dir% |
---|
324 | rem |
---|
325 | rem Insert control port number |
---|
326 | rem and passive port range |
---|
327 | rem in file ftp.properties.in. |
---|
328 | rem |
---|
329 | java -jar "%here%"\Replace.jar ftp.properties.in ftp.properties __CONTROL_PORT__=%ftp_control_port% __PASSIVE_PORT_RANGE__=%ftp_passive_port_range% __USERNAME__=%app_user% __PASSWORD__=%app_user_pwd% __DATABASE__=%db_name% __USERFILES__=%user_files_dir_slashes% __HOST__=%db_host% |
---|
330 | cd %here% |
---|
331 | |
---|
332 | rem |
---|
333 | rem Create proteios xtandem.properties file if not existing. |
---|
334 | rem |
---|
335 | cd %build_dir% |
---|
336 | if exist xtandem.properties goto xtandem_properties_file_ok |
---|
337 | echo Creating X!Tandem search config file xtandem.properties... |
---|
338 | copy xtandem.properties.in xtandem.properties |
---|
339 | goto xtandem_properties_file_end |
---|
340 | :xtandem_properties_file_ok |
---|
341 | echo X!Tandem search config file xtandem.properties exists - OK. |
---|
342 | :xtandem_properties_file_end |
---|
343 | cd %here% |
---|
344 | |
---|
345 | rem |
---|
346 | rem Create proteios mascot.properties file if not existing. |
---|
347 | rem |
---|
348 | cd %build_dir% |
---|
349 | if exist mascot.properties goto mascot_properties_file_ok |
---|
350 | echo Creating Mascot search config file mascot.properties... |
---|
351 | copy mascot.properties.in mascot.properties |
---|
352 | goto mascot_properties_file_end |
---|
353 | :mascot_properties_file_ok |
---|
354 | echo Mascot search config file mascot.properties exists - OK. |
---|
355 | :mascot_properties_file_end |
---|
356 | cd %here% |
---|
357 | |
---|
358 | rem |
---|
359 | rem Create proteios omssa.properties file if not existing. |
---|
360 | rem |
---|
361 | cd %build_dir% |
---|
362 | if exist omssa.properties goto omssa_properties_file_ok |
---|
363 | echo Creating OMSSA search config file omssa.properties... |
---|
364 | copy omssa.properties.in omssa.properties |
---|
365 | goto omssa_properties_file_end |
---|
366 | :omssa_properties_file_ok |
---|
367 | echo OMSSA search config file omssa.properties exists - OK. |
---|
368 | :omssa_properties_file_end |
---|
369 | cd %here% |
---|
370 | |
---|
371 | rem |
---|
372 | rem Create proteios pike.properties file if not existing. |
---|
373 | rem |
---|
374 | cd %build_dir% |
---|
375 | if exist pike.properties goto pike_properties_file_ok |
---|
376 | echo Creating PIKE search config file pike.properties... |
---|
377 | copy pike.properties.in pike.properties |
---|
378 | goto pike_properties_file_end |
---|
379 | :pike_properties_file_ok |
---|
380 | echo PIKE search config file pike.properties exists - OK. |
---|
381 | :pike_properties_file_end |
---|
382 | cd %here% |
---|
383 | |
---|
384 | rem |
---|
385 | rem Create proteios msinspect.properties file if not existing. |
---|
386 | rem |
---|
387 | cd %build_dir% |
---|
388 | if exist msinspect.properties goto msinspect_properties_file_ok |
---|
389 | echo Creating msInspect feature detection config file msinspect.properties... |
---|
390 | copy msinspect.properties.in msinspect.properties |
---|
391 | goto msinspect_properties_file_end |
---|
392 | :msinspect_properties_file_ok |
---|
393 | echo msInspect feature detection config file msinspect.properties exists - OK. |
---|
394 | :msinspect_properties_file_end |
---|
395 | cd %here% |
---|
396 | |
---|
397 | rem |
---|
398 | rem Create proteios log4j.properties file if not existing. |
---|
399 | rem |
---|
400 | cd %build_dir% |
---|
401 | if exist log4j.properties goto log4j_properties_file_ok |
---|
402 | echo Creating log config file log4j.properties... |
---|
403 | copy log4j.properties.in log4j.properties |
---|
404 | goto log4j_properties_file_end |
---|
405 | :log4j_properties_file_ok |
---|
406 | echo Log config file log4j.properties exists - OK. |
---|
407 | :log4j_properties_file_end |
---|
408 | cd %here% |
---|
409 | |
---|
410 | rem |
---|
411 | rem Build class path |
---|
412 | rem |
---|
413 | set cp=.\%build_dir% |
---|
414 | rem |
---|
415 | rem Note: Variables like %cp% are interpreted before a for-statement |
---|
416 | rem is executed, so a for-loop like |
---|
417 | rem |
---|
418 | rem for %%i in (.\www\WEB-INF\lib\*.jar) do set cp=%cp%;%%i |
---|
419 | rem |
---|
420 | rem will only add the last of the *.jar files to the %cp% list |
---|
421 | rem after the for-loop is finished. This can be solved by calling |
---|
422 | rem a temporary batch file that updates the %cp% value for each loop. |
---|
423 | rem The contents of the temporary batch file tmp1.bat is |
---|
424 | rem |
---|
425 | rem set cp=%cp%;%1 |
---|
426 | rem |
---|
427 | rem where %1 is the argument that will be provided by the |
---|
428 | rem for-loop variable %%i. |
---|
429 | rem |
---|
430 | echo set cp=%%cp%%;%%1> tmp1.bat |
---|
431 | for %%i in (.\www\WEB-INF\lib\*.jar) do call tmp1.bat %%i |
---|
432 | del tmp1.bat |
---|
433 | rem |
---|
434 | rem Run proteios java installation program InitDB |
---|
435 | rem |
---|
436 | rem java -server -cp %cp% org.proteios.install.InitDB %root_pwd% |
---|
437 | |
---|
438 | rem |
---|
439 | rem Initialize database. |
---|
440 | rem |
---|
441 | if not "%update_db%"=="Y" goto no_update |
---|
442 | java -cp %cp% org.proteios.install.InitDB update %root_pwd% |
---|
443 | goto db_init_end |
---|
444 | :no_update |
---|
445 | java -cp %cp% org.proteios.install.InitDB %root_pwd% |
---|
446 | :db_init_end |
---|
447 | |
---|
448 | rem |
---|
449 | rem Create user files directory if not existing. |
---|
450 | rem |
---|
451 | if exist %user_files_dir% goto user_files_dir_ok |
---|
452 | echo Creating user files directory... |
---|
453 | mkdir %user_files_dir% |
---|
454 | rem |
---|
455 | rem Check if user files directory exists. |
---|
456 | rem |
---|
457 | if exist %user_files_dir% goto user_files_dir_ok2 |
---|
458 | echo Failed. |
---|
459 | echo User files directory could not be created. |
---|
460 | echo Create user files directory %user_files_dir% yourself. |
---|
461 | goto user_files_dir_end |
---|
462 | :user_files_dir_ok2 |
---|
463 | echo done |
---|
464 | goto user_files_dir_end |
---|
465 | :user_files_dir_ok |
---|
466 | echo User files directory exists - OK. |
---|
467 | :user_files_dir_end |
---|
468 | |
---|
469 | rem |
---|
470 | rem Create "conf" directory in user files directory if not existing. |
---|
471 | rem |
---|
472 | if exist "%user_files_dir%\conf" goto user_files_conf_dir_ok |
---|
473 | echo Creating \"conf\" directory in user files directory... |
---|
474 | mkdir "%user_files_dir%\conf" |
---|
475 | rem |
---|
476 | rem Check if "conf" directory in user files directory exists. |
---|
477 | rem |
---|
478 | if exist "%user_files_dir%\conf" goto user_files_conf_dir_ok2 |
---|
479 | echo Failed. |
---|
480 | echo Directory \"conf\" in user files directory could not be created. |
---|
481 | echo Create \"conf\" directory in user files directory %user_files_dir% yourself. |
---|
482 | goto user_files_conf_dir_end |
---|
483 | :user_files_conf_dir_ok2 |
---|
484 | echo done |
---|
485 | goto user_files_dir_end |
---|
486 | :user_files_conf_dir_ok |
---|
487 | echo Directory \"conf\" in user files directory exists - OK. |
---|
488 | :user_files_conf_dir_end |
---|
489 | |
---|
490 | rem |
---|
491 | rem Create temporary files directory if not existing. |
---|
492 | rem |
---|
493 | if exist %temp_files_dir% goto temp_files_dir_ok |
---|
494 | echo Creating temporary files directory... |
---|
495 | mkdir %temp_files_dir% |
---|
496 | rem |
---|
497 | rem Check if temporary files directory exists. |
---|
498 | rem |
---|
499 | if exist %temp_files_dir% goto temp_files_dir_ok2 |
---|
500 | echo Failed. |
---|
501 | echo Temporary files directory could not be created. |
---|
502 | echo Create temporary files directory %temp_files_dir% yourself. |
---|
503 | goto temp_files_dir_end |
---|
504 | :temp_files_dir_ok2 |
---|
505 | echo done |
---|
506 | goto temp_files_dir_end |
---|
507 | :temp_files_dir_ok |
---|
508 | echo Temporary files directory exists - OK. |
---|
509 | :temp_files_dir_end |
---|
510 | |
---|
511 | rem |
---|
512 | rem Set variable catalina_home (tomcat installation directory) |
---|
513 | rem |
---|
514 | :step_10a |
---|
515 | set body_text=10. Let's deploy the web application into tomcat. |
---|
516 | set next_step=step_10b |
---|
517 | goto print |
---|
518 | :step_10b |
---|
519 | if defined catalina_home goto catalina_ok |
---|
520 | echo Catalina home: > prompt.txt |
---|
521 | call inp2var.bat catalina_home prompt.txt |
---|
522 | rem echo catalina_home = %catalina_home% |
---|
523 | :catalina_ok |
---|
524 | echo. |
---|
525 | |
---|
526 | rem |
---|
527 | rem Create link in tomcat webapps directory to proteomics directory |
---|
528 | rem |
---|
529 | |
---|
530 | rem |
---|
531 | rem Store current directory in variable %here% |
---|
532 | rem |
---|
533 | cd > prompt.txt |
---|
534 | call inp2var.bat here prompt.txt no_input |
---|
535 | echo Deploying %app_name% into %catalina_home% |
---|
536 | echo ________________________________________________________________________ |
---|
537 | echo Copying new installation from %here%\www to %catalina_home%\webapps\www. |
---|
538 | xcopy "%here%"\www "%catalina_home%"\webapps\www /E /I /V /Q |
---|
539 | if ERRORLEVEL 1 goto failure |
---|
540 | echo Removing old installation. |
---|
541 | rmdir "%catalina_home%"\webapps\%app_name% /S /Q |
---|
542 | if ERRORLEVEL 1 goto failure |
---|
543 | echo Activating new installation in %catalina_home%\webapps\%app_name%. |
---|
544 | move "%catalina_home%"\webapps\www "%catalina_home%"\webapps\%app_name% |
---|
545 | if ERRORLEVEL 1 goto failure |
---|
546 | echo ________________________________________________________________________ |
---|
547 | echo. |
---|
548 | |
---|
549 | rem |
---|
550 | rem Update proteios Proteios FTP Server start script (bat-file) |
---|
551 | rem |
---|
552 | echo Updating Proteios FTP Server start script (bat-file) |
---|
553 | cd %here% |
---|
554 | rem |
---|
555 | rem Insert Tomcat installation directory |
---|
556 | rem in file proteios_ftp_server.bat.in. |
---|
557 | rem |
---|
558 | java -jar "%here%"\Replace.jar proteios_ftp_server.bat.in proteios_ftp_server.bat __CATALINA_HOME__="%catalina_home%" |
---|
559 | rem |
---|
560 | rem Insert Tomcat installation directory |
---|
561 | rem in files proteios_ftp_server_start.bat.in. |
---|
562 | rem and proteios_ftp_server_stop.bat.in. |
---|
563 | rem |
---|
564 | java -jar "%here%"\Replace.jar proteios_ftp_server_start.bat.in proteios_ftp_server_start.bat __CATALINA_HOME__="%catalina_home%" |
---|
565 | java -jar "%here%"\Replace.jar proteios_ftp_server_stop.bat.in proteios_ftp_server_stop.bat __CATALINA_HOME__="%catalina_home%" |
---|
566 | cd %here% |
---|
567 | echo. |
---|
568 | |
---|
569 | rem |
---|
570 | rem Print finishing remarks |
---|
571 | rem |
---|
572 | :step_11a |
---|
573 | set body_text=%app_name% is now installed. Start tomcat before use. |
---|
574 | set next_step=step_11b |
---|
575 | goto print |
---|
576 | :step_11b |
---|
577 | echo. |
---|
578 | echo. |
---|
579 | rem |
---|
580 | rem Extra dummy input to keep command prompt window open until input is given |
---|
581 | rem |
---|
582 | echo Press Enter to finish: > prompt.txt |
---|
583 | call inp2var.bat dummy_var prompt.txt |
---|
584 | |
---|
585 | goto finish |
---|
586 | |
---|
587 | |
---|
588 | :print |
---|
589 | rem |
---|
590 | rem Subroutine print |
---|
591 | rem |
---|
592 | rem |
---|
593 | rem Prints header text for current step. |
---|
594 | rem |
---|
595 | echo. |
---|
596 | echo. |
---|
597 | echo %body_text% |
---|
598 | echo. |
---|
599 | goto %next_step% |
---|
600 | |
---|
601 | |
---|
602 | :failure |
---|
603 | echo Activation of installation failed |
---|
604 | goto step_11b |
---|
605 | |
---|
606 | :finish |
---|
607 | rem |
---|
608 | rem Clear used environment variables |
---|
609 | rem |
---|
610 | rem |
---|
611 | rem Remove values of used batch file parameters, |
---|
612 | rem so they cannot be accessed from the command line. |
---|
613 | rem |
---|
614 | set db_socket= |
---|
615 | set sql_client= |
---|
616 | set app_name= |
---|
617 | set db_manager= |
---|
618 | set db_manager_pwd= |
---|
619 | set db_name= |
---|
620 | set db_host= |
---|
621 | set app_user= |
---|
622 | set app_user_pwd= |
---|
623 | set user_files_dir= |
---|
624 | set user_files_dir_slashes= |
---|
625 | set ftp_control_port= |
---|
626 | set ftp_passive_port_range= |
---|
627 | set mail_server= |
---|
628 | set mail_from_address= |
---|
629 | set sql_exec= |
---|
630 | set continue_install= |
---|
631 | set drop_db= |
---|
632 | set cp= |
---|
633 | set body_text= |
---|
634 | set next_step= |
---|
635 | set here= |
---|
636 | set dummy_var= |
---|
637 | :end |
---|