home *** CD-ROM | disk | FTP | other *** search
/ Chip 2005 May / CMCD0505.ISO / Software / Shareware / Programare / bugzero / WEB-INF / misc / upgrade / upgrade.bat < prev    next >
Encoding:
DOS Batch File  |  2004-12-30  |  2.2 KB  |  93 lines

  1. @echo off
  2. @REM 1. copy configuration/template files and JDBC drivers.
  3. @REM 2. update the database schema.
  4.  
  5. if not exist upgrade.jar (
  6. @echo on
  7. echo Error: this program must be run in the directory misc\upgrade
  8. @echo off
  9. pause
  10. goto end
  11. )
  12.  
  13. SET HOME_PRE=%1
  14. if ""%HOME_PRE%"" == """" (
  15. echo on
  16. echo Usage: upgrade path-to-the-installed-running-bugzero-home
  17. echo example:  upgrade "c:\tomcat\webapps\bugzero"
  18. echo off
  19. pause
  20. goto end
  21. )
  22. SET CONF_PRE=%HOME_PRE%\WEB-INF\classes\conf
  23. if not exist %CONF_PRE% (
  24. echo on
  25. echo Bugzero home is not entered correctly, no conf dir was found.
  26. echo off
  27. pause
  28. goto end
  29. )
  30. SET LIB_PRE=%HOME_PRE%\WEB-INF\lib
  31. if not exist %LIB_PRE% (
  32. echo on
  33. echo Bugzero home is not entered correctly, no lib dir was found.
  34. echo off
  35. pause
  36. goto end
  37. )
  38. SET TEMPLATE_PRE=%HOME_PRE%\WEB-INF\classes\template
  39. if not exist %TEMPLATE_PRE% (
  40. echo on
  41. echo Bugzero home is not entered correctly, no template dir was found.
  42. echo off
  43. pause
  44. goto end
  45. )
  46.  
  47. SET CONF_DIR=..\..\classes\conf\
  48. SET LIB_DIR=..\..\lib\
  49. SET TEMPLATE_DIR=..\..\classes\template\
  50. copy %CONF_PRE%\system.properties %CONF_DIR%
  51. copy %CONF_PRE%\db.properties %CONF_DIR%
  52. copy %CONF_PRE%\mail.properties %CONF_DIR%
  53. copy %TEMPLATE_PRE%\email_subject %TEMPLATE_DIR%
  54. copy %TEMPLATE_PRE%\email_body %TEMPLATE_DIR%
  55. if exist %TEMPLATE_PRE%\reminder_subject (
  56.   copy %TEMPLATE_PRE%\reminder_subject %TEMPLATE_DIR%
  57. )
  58. if exist %TEMPLATE_PRE%\reminder_body (
  59.   copy %TEMPLATE_PRE%\reminder_body %TEMPLATE_DIR%
  60. )
  61. if exist %CONF_PRE%\schedule.properties (
  62.   copy %CONF_PRE%\schedule.properties %CONF_DIR%
  63. )
  64.  
  65. IF %ERRORLEVEL% LEQ 0 (
  66.   for  %%i in (%LIB_PRE%\*.*) do call copyjar.bat %%~nxi %LIB_PRE% %LIB_DIR% 
  67. )
  68.  
  69. IF %ERRORLEVEL% LEQ 0 goto okey
  70. @echo on
  71. @echo ////////////////////////////////////////////////////////////////////
  72. @echo Failed to copy required files, you may need do it manually
  73. @echo ................................. and then run checkdb.bat
  74. @echo off
  75. pause
  76. goto end
  77.  
  78. :okey
  79. @REM remove the mail.jar and activation.jar if the original ones are not present.
  80. if not exist %LIB_PRE%\mail.jar (
  81.   del /F %LIB_DIR%\mail.jar
  82. )
  83. if not exist %LIB_PRE%\activation.jar (
  84.   del /F %LIB_DIR%\activation.jar
  85. )
  86.  
  87. @echo on
  88. @echo Now updating the database schema ....
  89. @echo off
  90. call checkdb.bat
  91.  
  92. :end
  93.