Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

157 lines
3.6 KiB

  1. @echo off
  2. REM ------------------------------------------------------------------
  3. REM
  4. REM WBEMODBC.cmd
  5. REM Create an MSI install (WBEMODBC.msi)
  6. REM
  7. REM Copyright 2001 (c) Microsoft Corporation. All rights reserved.
  8. REM
  9. REM CONTACT: ShBrown
  10. REM ------------------------------------------------------------------
  11. if defined _CPCMAGIC goto CPCBegin
  12. perl -x "%~f0" %*
  13. goto :EOF
  14. #!perl
  15. use strict;
  16. use lib $ENV{RAZZLETOOLPATH} . "\\PostBuildScripts";
  17. use lib $ENV{RAZZLETOOLPATH};
  18. use PbuildEnv;
  19. use ParseArgs;
  20. sub Usage { print<<USAGE; exit(1) }
  21. WBEMODBC.cmd [-l <language>]
  22. contact: ShBrown or wcimomd
  23. Make WBEMODBC.msi (WMI ODBC Adapter install for ValueAdd)
  24. USAGE
  25. parseargs('?' => \&Usage);
  26. # *** NEXT FEW LINES ARE TEMPLATE ***
  27. $ENV{"_CPCMAGIC"}++;exit(system($0)>>8);
  28. __END__
  29. :CPCBegin
  30. set _CPCMAGIC=
  31. setlocal ENABLEDELAYEDEXPANSION ENABLEEXTENSIONS
  32. REM *** BEGIN YOUR CMD SCRIPT BELOW ***
  33. REM
  34. REM This is for 32-bit only
  35. REM
  36. if not defined 386 (
  37. call logmsg.cmd "WBEMODBC.cmd does nothing on non-x86"
  38. goto :EOF
  39. )
  40. REM
  41. REM Check to see that all our files are present
  42. REM
  43. if not exist %_NTPostBld%\wbemodbc (
  44. call errmsg.cmd "Directory %_NTPostBld%\wbemodbc not found."
  45. goto :EOF
  46. )
  47. pushd %_NTPostBld%\wbemodbc
  48. for %%i in (
  49. .\readme.htm
  50. .\wbemdr32.chm
  51. .\wbemdr32.dll
  52. .\wbemodbc.ddf
  53. .\wbem_odb.msi
  54. ) do (
  55. if not exist %%i (
  56. call errmsg.cmd "File %_NTPostBld%\wbemodbc\%%i not found."
  57. popd& goto :EOF
  58. )
  59. )
  60. REM
  61. REM Only run if relevant files changed
  62. REM
  63. if exist %_NtPostBld%\build_logs\bindiff.txt (
  64. for /f "skip=15 tokens=1 delims=" %%b in (wbemodbc.ddf) do (
  65. findstr /ilc:%%b %_NTPostBld%\build_logs\bindiff.txt
  66. if /i "!ErrorLevel!" == "0" (
  67. call LogMsg.cmd "%%b changed - running cab generation"
  68. goto :RunIt
  69. )
  70. )
  71. call LogMsg.cmd "No relevant files changed - ending"
  72. popd& goto :EOF
  73. )
  74. :RunIt
  75. REM
  76. REM Create wbemodbc.cab
  77. REM As iexpress.exe does not set errorlevel in all error cases,
  78. REM base verification on wbemodbc.cab's existence.
  79. REM
  80. if exist .\wbemodbc.cab call ExecuteCmd.cmd "del /f wbemodbc.cab"
  81. if errorlevel 1 goto :EOF
  82. call ExecuteCmd.cmd "start /min /wait makecab /D SourceDir=%_NTPOSTBLD%\wbemodbc /F wbemodbc.ddf"
  83. if not exist wbemodbc.cab (
  84. call errmsg.cmd "Cab creation for wbemodbc.cab failed."
  85. popd& goto :EOF
  86. )
  87. REM
  88. REM Create WBEMODBC.msi
  89. REM msifiler.exe needs the uncompressed files, so uncab wbemodbc.cab.
  90. REM
  91. call ExecuteCmd.cmd "copy wbem_odb.msi WBEMODBC.msi"
  92. if errorlevel 1 popd& goto :EOF
  93. REM
  94. REM Add the cab to the msi
  95. REM Update the file sizes and versions in the msi
  96. REM
  97. call ExecuteCmd.cmd "msidb.exe -d .\WBEMODBC.msi -a .\wbemodbc.cab"
  98. if errorlevel 1 popd& goto :EOF
  99. if exist .\cabtemp call ExecuteCmd.cmd "rd /q /s .\cabtemp"
  100. if errorlevel 1 popd& goto :EOF
  101. call ExecuteCmd.cmd "md .\cabtemp"
  102. if errorlevel 1 popd& goto :EOF
  103. call ExecuteCmd.cmd "extract.exe /Y /E /L .\cabtemp wbemodbc.cab"
  104. if errorlevel 1 popd& goto :EOF
  105. call ExecuteCmd.cmd "msifiler.exe -d .\WBEMODBC.msi -s .\cabtemp\"
  106. if errorlevel 1 popd& goto :EOF
  107. REM
  108. REM Cleanup
  109. REM
  110. call ExecuteCmd.cmd "del /f .\wbemodbc.cab"
  111. call ExecuteCmd.cmd "rd /q /s .\cabtemp"
  112. REM
  113. REM Copy WBEMODBC.msi and ReadMe.htm to ValueAdd directory
  114. REM
  115. if not exist %_NtPostBld%\ValueAdd\msft\mgmt\wbemodbc mkdir %_NtPostBld%\ValueAdd\msft\mgmt\wbemodbc
  116. if errorlevel 1 (
  117. call errmsg.cmd "mkdir %_NTPostBld%\ValueAdd\msft\mgmt\wbemodbc failed"
  118. popd& goto :EOF
  119. )
  120. for %%i in (.\WBEMODBC.msi .\ReadMe.htm) do (
  121. call ExecuteCmd.cmd "copy %%i %_NtPostBld%\ValueAdd\msft\mgmt\wbemodbc\."
  122. if errorlevel 1 popd& goto :EOF
  123. )
  124. call logmsg.cmd "WBEMODBC.cmd completed successfully"
  125. popd