Leaked source code of windows server 2003
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.

189 lines
4.2 KiB

  1. @REM -----------------------------------------------------------------
  2. @REM
  3. @REM supporttools.cmd - ClarkG
  4. @REM create the suppport tools cab
  5. @REM
  6. @REM Copyright (c) Microsoft Corporation. All rights reserved.
  7. @REM
  8. @REM -----------------------------------------------------------------
  9. @if defined _CPCMAGIC goto CPCBegin
  10. @perl -x "%~f0" %*
  11. @goto :EOF
  12. #!perl
  13. use strict;
  14. use lib $ENV{RAZZLETOOLPATH} . "\\PostBuildScripts";
  15. use lib $ENV{RAZZLETOOLPATH};
  16. use PbuildEnv;
  17. use ParseArgs;
  18. sub Usage { print<<USAGE; exit(1) }
  19. supporttools [-l <language>]
  20. Create the support tools cab.
  21. USAGE
  22. parseargs('?' => \&Usage);
  23. # *** TEMPLATE CODE ***
  24. $ENV{"_CPCMAGIC"}++;exit(system($0)>>8);
  25. __END__
  26. @:CPCBegin
  27. @set _CPCMAGIC=
  28. @setlocal ENABLEDELAYEDEXPANSION ENABLEEXTENSIONS
  29. @if not defined DEBUG echo off
  30. @REM *** CMD SCRIPT BELOW ***
  31. REM
  32. REM Check for the working folder
  33. REM
  34. if NOT EXIST %_NTPostBld%\dump\supporttools (
  35. call errmsg.cmd "%_NTPostBld%\dump\supporttools does not exist; unable to create support.cab."
  36. goto end
  37. )
  38. cd /d %_NTPostBld%\dump\supporttools
  39. if errorlevel 1 (
  40. goto end
  41. )
  42. REM
  43. REM Support Tools: check whether the ddf is there
  44. REM
  45. if NOT exist suptools.ddf (
  46. call errmsg.cmd "Unable to find suptools.ddf."
  47. goto end
  48. )
  49. REM
  50. REM Support Tools: Generate the suppport.cab cabinet
  51. REM
  52. if exist support.cab call ExecuteCmd.cmd "del /f support.cab"
  53. if errorlevel 1 (
  54. call errmsg.cmd "Error deleting old support.cab."
  55. goto end
  56. )
  57. call ExecuteCmd.cmd "makecab /D SourceDir=%_NTPOSTBLD% /F suptools.ddf"
  58. if errorlevel 1 (
  59. call errmsg.cmd "Error generating support.cab."
  60. goto end
  61. )
  62. REM
  63. REM Support Tools: check whether the msi database is there for the updating
  64. REM
  65. if NOT exist suptools.msi (
  66. call errmsg.cmd "Unable to find suptools.msi."
  67. goto end
  68. )
  69. REM
  70. REM Support Tools: check whether WiStream.vbs is present
  71. REM
  72. if NOT exist WiStream.vbs (
  73. call errmsg.cmd "Unable to find WiStream.vbs ."
  74. goto end
  75. )
  76. REM
  77. REM Support Tools: check whether the CA dll is present
  78. REM
  79. if NOT exist %_NTPostBld%\reskit\bin\suptools.dll (
  80. call errmsg.cmd "Unable to find suptools.dll ."
  81. goto end
  82. )
  83. REM
  84. REM Support Tools: Stream the Suptools.dll into the Binary table
  85. REM
  86. call ExecuteCmd.cmd "WiStream.vbs suptools.msi %_NTPostBld%\reskit\bin\suptools.dll Binary.SupToolsDll"
  87. if errorlevel 1 (
  88. call errmsg.cmd "Error updating Binary table."
  89. goto end
  90. )
  91. REM
  92. REM SetBldno
  93. REM
  94. set ntverp=%_ntbindir%\public\sdk\inc\ntverp.h
  95. if not exist %ntverp% (
  96. call errmsg.cmd "File %ntverp% not found."
  97. goto end
  98. )
  99. set bldno=
  100. for /f "tokens=6" %%i in ('findstr /c:"#define VER_PRODUCTBUILD " %ntverp%') do (
  101. set bldno=%%i
  102. )
  103. if "%bldno%" == "" (
  104. call errmsg.cmd "Unable to define bldno per %ntverp%"
  105. goto end
  106. )
  107. REM
  108. REM Update the 'ProductVersion' property in the msi with the current build
  109. REM
  110. call ExecuteCmd.cmd "cscript.exe updversn.vbs suptools.msi %bldno%"
  111. if errorlevel 1 (
  112. call errmsg.cmd "Error updating Property table."
  113. goto end
  114. )
  115. REM
  116. REM Support Tools: create a 'cabtemp' folder to extract the cab files.
  117. REM
  118. call ExecuteCmd.cmd "if not exist cabtemp md cabtemp"
  119. if errorlevel 1 (
  120. goto end
  121. )
  122. REM
  123. REM Support Tools: check whether the cab is present.
  124. REM
  125. if NOT exist support.cab (
  126. call errmsg.cmd "Unable to find support.cab."
  127. goto end
  128. )
  129. REM
  130. REM Support Tools: extract the cabs
  131. REM
  132. call ExecuteCmd.cmd "extract.exe /y /e /l cabtemp support.cab"
  133. if errorlevel 1 (
  134. goto end
  135. )
  136. REM
  137. REM Support Tools: Use msifiler to update the msi database with the cab contents.
  138. REM
  139. call ExecuteCmd.cmd "msifiler.exe -d suptools.msi -s cabtemp\"
  140. if errorlevel 1 (
  141. popd
  142. goto end
  143. )
  144. REM
  145. REM Support Tools: Remove the cabtemp folder as it is not needed.
  146. REM
  147. call ExecuteCmd.cmd "rd /q /s cabtemp"
  148. REM
  149. REM Copy msi to destination
  150. REM
  151. call ExecuteCmd.cmd "copy /Y suptools.msi %_NTPostBld%\support\tools\"
  152. if errorlevel 1 (
  153. goto end
  154. )
  155. call ExecuteCmd.cmd "copy /Y support.cab %_NTPostBld%\support\tools\"
  156. if errorlevel 1 (
  157. goto end
  158. )
  159. call logmsg.cmd "Whistler Support Tools Cabgen completed successfully."
  160. popd
  161. goto end
  162. :end
  163. seterror.exe "%errors%"& goto :EOF