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.

406 lines
12 KiB

  1. @REM -----------------------------------------------------------------
  2. @REM
  3. @REM wsrmpostbuild.cmd - sujoyG
  4. @REM Creates the layout and MSI package for WSRM
  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. wsrmpostbuild.cmd
  20. Make MSI files for WSRM distribution (wsrm.msi)
  21. USAGE
  22. parseargs('?' => \&Usage);
  23. # *** TEMPLATE CODE ***
  24. $ENV{"_CPCMAGIC"}++;exit(system("$0 @ARGV")>>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. setlocal
  32. set SourcePath=%~1
  33. set TargetRootPath=%~2
  34. if /i %lang% equ CS goto :EOF
  35. if /i %lang% equ NL goto :EOF
  36. if /i %lang% equ HU goto :EOF
  37. if /i %lang% equ TR goto :EOF
  38. perl %RazzleToolPath%\cksku.pm -t:ads -l:%lang%
  39. if %errorlevel% EQU 0 goto :ValidSKU
  40. perl %RazzleToolPath%\cksku.pm -t:dtc -l:%lang%
  41. if %errorlevel% EQU 0 goto :ValidSKU
  42. call logmsg.cmd "%~nx0: WSRM not localized for %lang%; nothing to do."
  43. goto :EOF
  44. :ValidSKU
  45. if %sourcepath%x equ x (
  46. set SourcePath=%_NTPOSTBLD%\wsrm\dump
  47. )
  48. if %TargetRootPath%x equ x (
  49. set TargetRootPath=%SourcePath%\..\setup
  50. )
  51. path=%path%;%sourcepath%\msi;%BUILD_PATH%;%managed_tool_path%\sdk\bin;%managed_tool_path%\urt\%complus_version%
  52. @echo /\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
  53. @echo set the required variables
  54. set TargetBinPath=%TargetRootpath%\bin
  55. set TargetMSC2kPath=%TargetBinPath%\MSC2k
  56. set TargetMSCDotNetPath=%TargetBinPath%\MSCDotNet
  57. set TargetDataPath=%TargetRootpath%\data
  58. set TargetHelpPath=%TargetRootpath%\help
  59. set datadir=%sourcepath%\msi
  60. set msiName=wsrm.msi
  61. set errorFile=%_NTPOSTBLD%\BUILD_LOGS\wsrmpostbuild.err
  62. cd /d "%sourcepath%"
  63. @echo /\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
  64. @echo create the required directories
  65. rd /s /q "%TargetRootPath%" 2>nul
  66. md "%TargetRootPath%"
  67. md "%TargetBinPath%"
  68. md "%TargetDataPath%"
  69. if %_BuildArch% equ x86 (
  70. md "%TargetHelpPath%"
  71. md "%TargetMSC2kPath%"
  72. md "%TargetMSCDotNetPath%"
  73. )
  74. del /q %errorFile% 2>nul 1>nul
  75. @echo /\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
  76. @echo strong naming the managed binaries
  77. @echo \/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/
  78. if /i %_BuildArch% neq x86 goto :skipstrongname
  79. @echo /\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
  80. @echo setproperty
  81. @echo \/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/
  82. perl %SourcePath%\msi\setproperty.pl
  83. set SNASMFILES=wsrmsnapin.resources.dll wsrmlib.dll sysmonitor.dll wsrmsnapin.dll wbemclient.dll
  84. call %razzletoolpath%\postbuildscripts\snsignfiles.cmd %SNASMFILES%
  85. if %errorlevel% neq 0 (
  86. @echo FAILED: ERROR in Strong Name signing
  87. goto :end
  88. )
  89. :skipstrongname
  90. copy /y %msiname% $%msiname%$ 1>nul
  91. if /I %_BuildArch% neq x86 goto :skipManaged
  92. @echo /\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
  93. @echo to update registry table with inteop com dll entries for managed dll
  94. @echo /\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
  95. copy /y "%datadir%\regasmFiles.txt" $t.txt$ 1>nul
  96. msidb -e Registry -f %cd% -d $%msiname%$
  97. for /f "delims=" %%i in ($t.txt$) do (
  98. if exist %errorFile% goto :eof
  99. regasm /regfile:%%i.reg %%i
  100. if %errorlevel% neq 0 (
  101. @echo FAILED: ERROR in regasm
  102. @echo FAILED: ERROR in regasm for file %%i, errlevel=%errorlevel% >> %errorFile%
  103. )
  104. )
  105. if exist %errorFile% goto :end
  106. del /q ComDllReg.err 2> nul 1>nul
  107. for /f "delims=" %%i in ($t.txt$) do (
  108. if exist ComDllReg.err goto :eof
  109. wscript "%datadir%\ComDllReg.wsf" /idtfile:registry.idt /regfile:"%cd%\%%i.reg"
  110. if exist ComDllReg.err type ComDllReg.err >> %errorFile%
  111. )
  112. if exist %errorFile% goto :end
  113. msidb -i Registry.idt -f %cd% -d $%msiname%$
  114. del /q Registry.idt 2> nul 1> nul
  115. @echo /\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
  116. @echo update msiassemblyname table for managed binaries
  117. @echo /\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
  118. del /q MsiAssemblyNameMerge.idt 1>nul 2>nul
  119. copy /y "%DataDir%\msiassemName.txt" $t.txt$ 1>nul
  120. del /q CreateMsiAssName.err 2> nul 1>nul
  121. for /f "delims=" %%i in ($t.txt$) do (
  122. if exist CreateMsiAssName.err goto :eof
  123. wscript "%datadir%\CreateMsiAssName.wsf" /AssFile:"%cd%\%%i" /idtfile:MsiAssemblyNameMerge.idt
  124. if exist CreateMsiAssName.err type CreateMsiAssName.err >> %errorFile%
  125. )
  126. if exist %errorFile% goto :end
  127. rem export the existing msiassemblyname table
  128. msidb -e MsiAssemblyName -f "%cd%" -d $%msiname%$
  129. type MsiAssemblyNameMerge.idt >> MsiAssemblyName.idt
  130. msidb -i MsiAssemblyName.idt -f "%cd%" -d $%msiname%$
  131. del MsiAssemblyName.idt
  132. del MsiAssemblyNameMerge.idt
  133. :skipManaged
  134. @echo /\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
  135. @echo import the setupdll into MSI
  136. copy /y wsrmsetupdll.dll msi\binary\Callwrmsetupdll.ibd 1>nul
  137. msidb -d $%msiName%$ -f %cd%\msi -i Binary.idt
  138. del msi\binary\Callwrmsetupdll.ibd
  139. @echo /\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
  140. @echo update product code, package code, langID and EULA
  141. msidb -e Property -f "%cd%" -d $%msiname%$
  142. msidb -e _SummaryInformation -f "%cd%" -d $%msiname%$
  143. msidb -e Upgrade -f "%cd%" -d $%msiname%$
  144. perl %SourcePath%\msi\updatelangid.pl %SourcePath%
  145. perl %SourcePath%\msi\integrate_eula.pl %SourcePath%
  146. rem /\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/
  147. rem updating product code BUGBUG
  148. uuidgen /c /o$uuid.tmp$
  149. for /f "delims=" %%i in ($uuid.tmp$) do set uuidcode=%%i
  150. rep 11111111-2222-3333-4444-555555555555 %uuidcode% Property.idt 1>nul
  151. rem /\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/
  152. rem updating package code
  153. uuidgen /c /o$uuid.tmp$
  154. for /f "delims=" %%i in ($uuid.tmp$) do set uuidcode=%%i
  155. rep 11111111-2222-3333-4444-555555555555 %uuidcode% _SummaryInformation.idt 1>nul
  156. msidb -i Property.idt -f "%cd%" -d $%msiname%$
  157. msidb -i _SummaryInformation.idt -f "%cd%" -d $%msiname%$
  158. msidb -i Upgrade.idt -f "%cd%" -d $%msiname%$
  159. del /q Property.idt 2> nul 1> nul
  160. del /q _SummaryInformation.idt 2> nul 1> nul
  161. del /q Upgrade.idt 2> nul 1> nul
  162. @echo /\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
  163. @echo copy the files into appropriate directories
  164. set /a totalerc=0
  165. if /I %_BuildArch% neq x86 goto :skipClientFiles
  166. :: dotnetfx.exe
  167. copy /y dotnetfx.exe "%TargetRootPath%\dotnetfx.exe" 1>nul
  168. set /a totalerc=%totalerc%+%errorlevel%
  169. :: copy langpack.exe
  170. if %lang%x neq x (
  171. if %lang%x neq USAx (
  172. copy /y langpack\%lang%\langpack.exe "%TargetRootPath%\langpack.exe" 1>nul
  173. set /a totalerc=%totalerc%+%errorlevel%
  174. )
  175. )
  176. copy /y index.htm "%TargetBinPath%\WSRMStatus.htm" 1>nul
  177. set /a totalerc=%totalerc%+%errorlevel%
  178. copy /y wrmdisconnected.htm "%TargetBinPath%\WSRMDisconnected.htm" 1>nul
  179. set /a totalerc=%totalerc%+%errorlevel%
  180. copy /y Sysmonitor.dll "%TargetBinPath%\SysMonitor.dll" 1>nul
  181. set /a totalerc=%totalerc%+%errorlevel%
  182. copy /y wsrmlib.dll "%TargetBinPath%\WSRMLib.dll" 1>nul
  183. set /a totalerc=%totalerc%+%errorlevel%
  184. copy /y WbemClient.dll "%TargetBinPath%\WbemClient.dll" 1>nul
  185. set /a totalerc=%totalerc%+%errorlevel%
  186. copy /y wsrmsnapin.dll "%TargetBinPath%\wsrmsnapin.dll" 1>nul
  187. set /a totalerc=%totalerc%+%errorlevel%
  188. copy /y wsrmsnapin.resources.dll "%TargetBinPath%\wsrmsnapin.resources.dll" 1>nul
  189. set /a totalerc=%totalerc%+%errorlevel%
  190. copy /y wsrmc.exe "%TargetBinPath%\wsrmc.exe" 1>nul
  191. set /a totalerc=%totalerc%+%errorlevel%
  192. copy /y wsrmps.dll "%TargetBinPath%\wsrmps.dll" 1>nul
  193. set /a totalerc=%totalerc%+%errorlevel%
  194. copy /y wsrmc.resources.dll "%TargetBinPath%\wsrmc.resources.dll" 1>nul
  195. set /a totalerc=%totalerc%+%errorlevel%
  196. copy /y wsrmwrappers.dll "%TargetBinPath%\wsrmwrappers.dll" 1>nul
  197. set /a totalerc=%totalerc%+%errorlevel%
  198. copy /y WSRM_2k.msc "%TargetMSC2kPath%\wsrm.msc" 1>nul
  199. set /a totalerc=%totalerc%+%errorlevel%
  200. copy /y WSRM.msc "%TargetMSCDotNetPath%\wsrm.msc" 1>nul
  201. set /a totalerc=%totalerc%+%errorlevel%
  202. copy /y wrmsnap.chm "%TargetHelpPath%\wrmsnap.chm" 1>nul
  203. set /a totalerc=%totalerc%+%errorlevel%
  204. copy /y wsrmcs.chm "%TargetHelpPath%\wsrmcs.chm" 1>nul
  205. set /a totalerc=%totalerc%+%errorlevel%
  206. :skipClientFiles
  207. :: copy Symbols
  208. if exist %SourcePath%\..\..\Symbols (
  209. @echo /\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
  210. @echo copy symbols into dump
  211. xcopy %SourcePath%\..\..\Symbols\* %SourcePath%\WSRMSym\* /s /e /v /y 1>nul
  212. set /a totalerc=%totalerc%+%errorlevel%
  213. )
  214. copy /y WSRMEventList.xml "%TargetBinPath%\WSRMEventList.xml" 1>nul
  215. set /a totalerc=%totalerc%+%errorlevel%
  216. copy /y relnotes.htm "%TargetRootPath%\relnotes.htm" 1>nul
  217. set /a totalerc=%totalerc%+%errorlevel%
  218. copy /y logo.gif "%TargetRootPath%\logo.gif" 1>nul
  219. set /a totalerc=%totalerc%+%errorlevel%
  220. copy /y wsrm.ico "%TargetRootPath%\wsrm.ico" 1>nul
  221. set /a totalerc=%totalerc%+%errorlevel%
  222. copy /y $%msiname%$ "%TargetRootPath%\wsrm.msi" 1>nul
  223. set /a totalerc=%totalerc%+%errorlevel%
  224. copy /y setup.exe "%TargetRootPath%\setup.exe" 1>nul
  225. set /a totalerc=%totalerc%+%errorlevel%
  226. copy /y settings.ini "%TargetRootPath%\settings.ini" 1>nul
  227. set /a totalerc=%totalerc%+%errorlevel%
  228. copy /y wsrm.exe "%TargetBinPath%\wsrm.exe" 1>nul
  229. set /a totalerc=%totalerc%+%errorlevel%
  230. copy /y wsrmeventlog.dll "%TargetBinPath%\wsrmeventlog.dll" 1>nul
  231. set /a totalerc=%totalerc%+%errorlevel%
  232. copy /y wsrmperfcounter.dll "%TargetBinPath%\wsrmperfcounter.dll" 1>nul
  233. set /a totalerc=%totalerc%+%errorlevel%
  234. copy /y wsrmctr.h "%TargetBinPath%\wsrmctr.h" 1>nul
  235. set /a totalerc=%totalerc%+%errorlevel%
  236. copy /y wsrmctr.ini "%TargetBinPath%\wsrmctr.ini" 1>nul
  237. set /a totalerc=%totalerc%+%errorlevel%
  238. if %_BuildArch% equ x86 (
  239. if %_BuildType% equ chk (
  240. copy /y msvcrtd.dll "%TargetBinPath%\msvcrtd.dll" 1>nul
  241. set /a totalerc=%totalerc%+%errorlevel%
  242. copy /y msvcp60d.dll "%TargetBinPath%\msvcp60d.dll" 1>nul
  243. set /a totalerc=%totalerc%+%errorlevel%
  244. )
  245. ) else (
  246. if %_BuildType% equ chk (
  247. copy /y msvcrtd_64.dll "%TargetBinPath%\msvcrtd.dll" 1>nul
  248. set /a totalerc=%totalerc%+%errorlevel%
  249. copy /y msvcp60d_64.dll "%TargetBinPath%\msvcp60d.dll" 1>nul
  250. set /a totalerc=%totalerc%+%errorlevel%
  251. )
  252. )
  253. copy /y Allocationpol.xml "%TargetDataPath%\Allocationpol.xml" 1>nul
  254. set /a totalerc=%totalerc%+%errorlevel%
  255. copy /y Selectionpol.xml "%TargetDataPath%\Selectionpol.xml" 1>nul
  256. set /a totalerc=%totalerc%+%errorlevel%
  257. copy /y Calendar.xml "%TargetDataPath%\Calendar.xml" 1>nul
  258. set /a totalerc=%totalerc%+%errorlevel%
  259. if not "%totalerc%" == "0" (
  260. @echo FAILED: Copying of files failed.
  261. @echo FAILED: Copying of files failed, %totalerc% failures >> %errorFile%
  262. goto :end
  263. )
  264. cd /d "%TargetRootPath%"
  265. @echo /\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
  266. @echo upadate for unmanaged binaries and unversioned files
  267. msifiler -d wsrm.msi -v -h > nul
  268. @echo /\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
  269. call %razzletoolpath%\postbuildscripts\wsrmcdscript.cmd
  270. :end
  271. call :cleanup
  272. if exist %errorFile% endlocal && exit /b 1
  273. endlocal
  274. exit /b 0
  275. :cleanup
  276. cd %sourcepath%
  277. pushd.
  278. del $*$ 1>nul 2>nul
  279. del *.reg 1>nul 2>nul
  280. popd
  281. goto :eof