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.

200 lines
5.5 KiB

  1. @echo off
  2. REM ------------------------------------------------------------------
  3. REM
  4. REM Adminpak.cmd
  5. REM Make CAB files for Adminpak distribution (adminpak.msi)
  6. REM
  7. REM Copyright (c) Microsoft Corporation. All rights reserved.
  8. REM
  9. REM ------------------------------------------------------------------
  10. if defined _CPCMAGIC goto CPCBegin
  11. perl -x "%~f0" %*
  12. goto :EOF
  13. #!perl
  14. use strict;
  15. use lib $ENV{RAZZLETOOLPATH} . "\\PostBuildScripts";
  16. use lib $ENV{RAZZLETOOLPATH};
  17. use PbuildEnv;
  18. use ParseArgs;
  19. sub Usage { print<<USAGE; exit(1) }
  20. Adminpak.cmd [-l <language>]
  21. Make CAB files for Adminpak distribution (adminpak.msi)
  22. USAGE
  23. parseargs('?' => \&Usage);
  24. # *** NEXT FEW LINES ARE TEMPLATE ***
  25. $ENV{"_CPCMAGIC"}++;exit(system($0)>>8);
  26. __END__
  27. :CPCBegin
  28. set _CPCMAGIC=
  29. setlocal ENABLEDELAYEDEXPANSION ENABLEEXTENSIONS
  30. REM *** BEGIN YOUR CMD SCRIPT BELOW ***
  31. if not defined 386 (
  32. call logmsg.cmd "adminpak.cmd do nothing on non i386"
  33. goto :EOF
  34. )
  35. REM adminpak.msi is not applicable to languages with no server products.
  36. perl %RazzleToolPath%\cksku.pm -t:bla -l:%lang%
  37. if %errorlevel% EQU 0 goto :ValidSKU
  38. perl %RazzleToolPath%\cksku.pm -t:sbs -l:%lang%
  39. if %errorlevel% EQU 0 goto :ValidSKU
  40. perl %RazzleToolPath%\cksku.pm -t:srv -l:%lang%
  41. if %errorlevel% EQU 0 goto :ValidSKU
  42. perl %RazzleToolPath%\cksku.pm -t:ads -l:%lang%
  43. if %errorlevel% EQU 0 goto :ValidSKU
  44. perl %RazzleToolPath%\cksku.pm -t:dtc -l:%lang%
  45. if %errorlevel% EQU 0 goto :ValidSKU
  46. call logmsg.cmd "CABGEN: no server products for %lang%; nothing to do."
  47. goto :EOF
  48. :ValidSKU
  49. REM
  50. REM Generate cmbins.exe as it is needed below.
  51. REM
  52. call cmbins.cmd
  53. REM
  54. REM Generate adminpak.msi
  55. REM
  56. if not exist %_NTPostBld%\adminpak (
  57. call errmsg.cmd "Directory %_NTPostBld%\adminpak not found."
  58. goto :EOF
  59. )
  60. pushd %_NTPostBld%\adminpak
  61. for %%i in (.\admin_pk.msi .\adminpak.ddf) do (
  62. if not exist %%i (
  63. call errmsg.cmd "File %_NTPostBld%\adminpak\%%i not found."
  64. popd& goto :EOF
  65. )
  66. )
  67. REM
  68. REM Only run if relevant files changed
  69. REM
  70. if exist %_NtPostBld%\build_logs\bindiff.txt (
  71. for /f "skip=15 tokens=1 delims=" %%b in (adminpak.ddf) do (
  72. findstr /ilc:%%b %_NTPostBld%\build_logs\bindiff.txt
  73. if /i "!ErrorLevel!" == "0" (
  74. call LogMsg.cmd "%%b changed - running cab generation"
  75. goto :RunIt
  76. )
  77. )
  78. call LogMsg.cmd "No relevant files changed - ending"
  79. popd& goto :EOF
  80. )
  81. :RunIt
  82. REM
  83. REM Create adminpak.cab.
  84. REM As iexpress.exe does not set errorlevel in all error cases,
  85. REM base verification on adminpak.cab's existence.
  86. REM
  87. if exist adminpak.cab call ExecuteCmd.cmd "del /f adminpak.cab"
  88. if errorlevel 1 popd& goto :EOF
  89. call ExecuteCmd.cmd "start /wait /min makecab /D SourceDir=%_NTPOSTBLD% /F adminpak.ddf"
  90. if not exist adminpak.cab (
  91. call errmsg.cmd "Cab creation for adminpak.cab."
  92. popd& goto :EOF
  93. )
  94. REM
  95. REM Create adminpak.msi
  96. REM msifiler.exe needs the uncompressed files, so uncab adminpak.cab.
  97. REM
  98. call ExecuteCmd.cmd "copy admin_pk.msi adminpak.msi"
  99. if errorlevel 1 popd& goto :EOF
  100. REM
  101. REM Extract the Cabs table
  102. REM Copy the cab file into the Cabs directory
  103. REM Import the new Cab into the Cabs directory
  104. REM
  105. call ExecuteCmd.cmd "msidb.exe -d .\adminpak.msi -f %_NTPostBld%\adminpak -e Cabs"
  106. if errorlevel 1 popd& goto :EOF
  107. call ExecuteCmd.cmd "copy /y .\adminpak.CAB .\Cabs\adminpak.CAB.ibd"
  108. if errorlevel 1 popd& goto :EOF
  109. call ExecuteCmd.cmd "msidb.exe -d .\adminpak.msi -f %_NTPostBld%\adminpak -i Cabs.idt"
  110. if errorlevel 1 popd& goto :EOF
  111. call ExecuteCmd.cmd "del .\cabs.idt"
  112. if errorlevel 1 popd& goto :EOF
  113. call ExecuteCmd.cmd "rd /s /q Cabs"
  114. if errorlevel 1 popd& goto :EOF
  115. if exist .\cabtemp call ExecuteCmd.cmd "rd /q /s .\cabtemp"
  116. if errorlevel 1 popd& goto :EOF
  117. call ExecuteCmd.cmd "md .\cabtemp"
  118. if errorlevel 1 popd& goto :EOF
  119. call ExecuteCmd.cmd "extract.exe /Y /E /L .\cabtemp adminpak.cab"
  120. if errorlevel 1 popd& goto :EOF
  121. REM
  122. REM Rename some of the files in cabtemp so that
  123. REM msifiler.exe can find them in the file table
  124. REM and correctly update the verion and size informaiton.
  125. REM
  126. call ExecuteCmd.cmd "rename .\cabtemp\readme32.txt readme.txt"
  127. call ExecuteCmd.cmd "rename .\cabtemp\template.pmc template.cmp"
  128. call ExecuteCmd.cmd "rename .\cabtemp\template.smc template.cms"
  129. call ExecuteCmd.cmd "rename .\cabtemp\adcon.chm adconcepts.chm"
  130. call ExecuteCmd.cmd "rename .\cabtemp\secon.chm seconcepts.chm"
  131. call ExecuteCmd.cmd "rename .\cabtemp\tapiconS.chm tapiconcepts.chm"
  132. call ExecuteCmd.cmd "rename .\cabtemp\rsscon.chm rssconcepts.chm"
  133. call ExecuteCmd.cmd "rename .\cabtemp\riscon.chm risconcepts.chm"
  134. call ExecuteCmd.cmd "rename .\cabtemp\rrascon.chm rrasconcepts.chm"
  135. call ExecuteCmd.cmd "rename .\cabtemp\mscscon.chm mscsconcepts.chm"
  136. call ExecuteCmd.cmd "rename .\cabtemp\ntarts.chm ntart.chm"
  137. call ExecuteCmd.cmd "rename .\cabtemp\dnscon.chm dnsconcepts.chm"
  138. call ExecuteCmd.cmd "rename .\cabtemp\dhcpcon.chm dhcpconcepts.chm"
  139. call ExecuteCmd.cmd "rename .\cabtemp\dfcon.chm dfconcepts.chm"
  140. call ExecuteCmd.cmd "rename .\cabtemp\cscon.chm csconcepts.chm"
  141. call ExecuteCmd.cmd "rename .\cabtemp\tslic_el.chm tslic.chm"
  142. call ExecuteCmd.cmd "rename .\cabtemp\vpncon.chm vpnconcepts.chm"
  143. call ExecuteCmd.cmd "rename .\cabtemp\winscon.chm winsconcepts.chm"
  144. call ExecuteCmd.cmd "msifiler.exe -d .\adminpak.msi -s .\cabtemp\"
  145. if errorlevel 1 popd& goto :EOF
  146. rem
  147. rem Cleanup
  148. rem
  149. call ExecuteCmd.cmd "del /f .\adminpak.cab"
  150. call ExecuteCmd.cmd "rd /q /s .\cabtemp"
  151. REM
  152. REM Copy adminpak.msi to "retail"
  153. REM
  154. call ExecuteCmd.cmd "copy adminpak.msi ..\"
  155. if errorlevel 1 popd& goto :EOF
  156. popd