bldutil.bat 2.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. REM #######################################################################
  2. REM #
  3. REM # Licensed Material - Property Of IBM
  4. REM #
  5. REM # "Restricted Materials of IBM"
  6. REM #
  7. REM # IBM Informix Dynamic Server
  8. REM #
  9. REM # (c) Copyright IBM Corporation 1996, 2004 All rights reserved.
  10. REM #
  11. REM # Description:
  12. REM # build the administrative database and load initial data
  13. REM #
  14. REM ######################################################################/
  15. REM ###
  16. REM #inherit the message constants
  17. REM ###
  18. call %INFORMIXDIR%\etc\conv\strmaps.bat
  19. REM ###
  20. REM # setup the WINROOT path
  21. REM ###
  22. set WINROOT=%SystemRoot%
  23. if "x%WINROOT%" == "x" set WINROOT=C:\WINNT
  24. REM ###
  25. REM # remove emergency boot file since it's data is now obsolete
  26. REM ###
  27. copyboot
  28. REM ###
  29. REM # where to put output
  30. REM ###
  31. set OUTFILE=%INFORMIXDIR%\etc\bldutil.%INFORMIXSERVER%.out
  32. set BLDUTL_STATFILE=%INFORMIXDIR%\etc\bldutil.%INFORMIXSERVER%.sql
  33. REM # Put something in output file, so user knows something happened
  34. type %INFORMIXDIR%\etc\bldutil.1in > %OUTFILE% 2>&1
  35. REM # Since we don't know if the database already exists, try to drop it.
  36. REM # Ignore errors, since we don't care if we couldn't drop a
  37. REM # non-existent database
  38. REM # Drop sysutils in the current server instance.
  39. set DBPATH_PREV=%DBPATH%
  40. set DBPATH=
  41. echo "About to drop the old sysutils database" >> %OUTFILE% 2>&1
  42. dbaccess - < %INFORMIXDIR%\etc\bldutil.2in > nul 2>&1
  43. REM # Restore the DBPATH
  44. set DBPATH=%DBPATH_PREV%
  45. REM ###
  46. REM # build the sysutils database
  47. REM ###
  48. echo "About to run sysutils.sql" >> %OUTFILE% 2>&1
  49. dbaccess - %INFORMIXDIR%\etc\sysutils.sql >> %OUTFILE% 2>&1
  50. REM # Check to see that there were no errors
  51. REM # Make sure find.exe runs from \winnt\system32 and not from a DOS directory
  52. %WINROOT%\System32\find /V "%INFORMIXDIR%" %OUTFILE% | %WINROOT%\System32\find /I "error"
  53. REM # 0 means found and error so sysutils.sql failed
  54. if ERRORLEVEL 1 goto SUCCESS
  55. if ERRORLEVEL 0 goto FAILURE
  56. :SUCCESS
  57. REM ###
  58. REM # else it was successful, so remove OUTFILE and ...
  59. REM # put s_sysutil_succ msg into sysmaster 'logmessage' table.
  60. REM # See olmsg.src for msg.
  61. REM ###
  62. echo "Inserting success msg into logmessage table" >> %OUTFILE% 2>&1
  63. echo insert into logmessage(message_num) values (%S_SYSUTIL_SUCC%); > %BLDUTL_STATFILE%
  64. dbaccess sysmaster %BLDUTL_STATFILE% >> %OUTFILE% 2>&1
  65. del %OUTFILE%
  66. goto exit
  67. :FAILURE
  68. REM ###
  69. REM # was there an error?
  70. REM # If yes, then drop sysutils and ...
  71. REM # put s_sysutil_err msg into the sysmaster 'logmessage' table.
  72. REM # See olmsg.src for msg.
  73. REM # always exit with 0 for buildsmi
  74. REM ###
  75. echo Cleaning up whatever was successfully created >> %OUTFILE%
  76. dbaccess - - < %INFORMIXDIR%\etc\bldutil.2in >> %OUTFILE% 2>&1
  77. echo insert into logmessage(message_num) values (%S_SYSUTIL_ERR%); > %BLDUTL_STATFILE%
  78. dbaccess sysmaster %BLDUTL_STATFILE% >> %OUTFILE% 2>&1
  79. :exit
  80. del %BLDUTL_STATFILE%
  81. del %INFORMIXDIR%\etc\vermsg.sql