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.

265 lines
7.7 KiB

  1. @REM -----------------------------------------------------------------
  2. @REM
  3. @REM setupw95.cmd - OvidiuT
  4. @REM build hwcomp.dat, a file containing all NT-supported
  5. @REM PNP devices used by winnt32a|u.dll and w95upg.dll.
  6. @REM Also generate a list of destination directories for
  7. @REM setup INF files
  8. @REM
  9. @REM History:
  10. @REM MLekas - created it 1/30/97
  11. @REM MLekas - added comments, -c to commandline
  12. @REM MLekas - remove -c 3/24/97
  13. @REM MLekas - add filegen 4/29/98
  14. @REM jimschm - moved hwdatgen to new POSTCOMPRESS option
  15. @REM ovidiut - run hwdatgen for server SKUs as well
  16. @REM
  17. @REM Copyright (c) Microsoft Corporation. All rights reserved.
  18. @REM
  19. @REM -----------------------------------------------------------------
  20. @if defined _CPCMAGIC goto CPCBegin
  21. @perl -x "%~f0" %*
  22. @goto :EOF
  23. #!perl
  24. use strict;
  25. use lib $ENV{RAZZLETOOLPATH} . "\\PostBuildScripts";
  26. use lib $ENV{RAZZLETOOLPATH};
  27. use PbuildEnv;
  28. use ParseArgs;
  29. sub Usage { print<<USAGE; exit(1) }
  30. setupw95
  31. Win95 project post-build file and PNP ID list generation
  32. Build hwcomp.dat, a file containing all NT-supported
  33. PNP devices used by w95upg.dll. Also generate a list
  34. of destination directories for setup INF files.
  35. USAGE
  36. parseargs('?' => \&Usage);
  37. # *** TEMPLATE CODE ***
  38. $ENV{"_CPCMAGIC"}++;exit(system($0)>>8);
  39. __END__
  40. @:CPCBegin
  41. @set _CPCMAGIC=
  42. @setlocal ENABLEDELAYEDEXPANSION ENABLEEXTENSIONS
  43. @if not defined DEBUG echo off
  44. @REM *** CMD SCRIPT BELOW ***
  45. REM cause filelist.dat and hwcomp.dat to get generated on x86 only:
  46. REM Not any more. The file is needed for other platforms as well
  47. REM if not defined x86 goto :EOF
  48. call logmsg.cmd "Beginning Win9x upgrade data generation"
  49. set _PRO=1
  50. set _PER=1
  51. set _BLA=1
  52. set _SRV=1
  53. set _ADS=1
  54. set _SBS=1
  55. REM Exclude skus even they are defined in prodskus.txt
  56. REM
  57. set CmdIni=perl %RazzleToolPath%\PostBuildScripts\CmdIniSetting.pl
  58. set CommandLine=%CmdIni% -l:%lang% -f:ExcludeSkus::%_BuildArch%%_BuildType%
  59. %CommandLine% >nul 2>nul
  60. if ERRORLEVEL 0 (
  61. for /f "tokens=1 delims=" %%a in ('%CommandLine%') do (
  62. set ExcludeSkus=%%a
  63. )
  64. )
  65. call logmsg "Exclude skus are [%ExcludeSkus%]"
  66. for %%a in ( %ExcludeSkus% ) do (
  67. if /i "%%a" == "pro" set _PRO=
  68. if /i "%%a" == "per" set _PER=
  69. if /i "%%a" == "bla" set _BLA=
  70. if /i "%%a" == "sbs" set _SBS=
  71. if /i "%%a" == "srv" set _SRV=
  72. if /i "%%a" == "ads" set _ADS=
  73. )
  74. if defined _PRO (
  75. perl %RazzleToolPath%\cksku.pm -t:pro -l:%lang% -a:%_BuildArch%
  76. if errorlevel 1 set _PRO=
  77. )
  78. if defined _PER (
  79. perl %RazzleToolPath%\cksku.pm -t:per -l:%lang% -a:%_BuildArch%
  80. if errorlevel 1 set _PER=
  81. )
  82. if defined _BLA (
  83. perl %RazzleToolPath%\cksku.pm -t:bla -l:%lang% -a:%_BuildArch%
  84. if errorlevel 1 set _BLA=
  85. )
  86. if defined _SBS (
  87. perl %RazzleToolPath%\cksku.pm -t:sbs -l:%lang% -a:%_BuildArch%
  88. if errorlevel 1 set _SBS=
  89. )
  90. if defined _SRV (
  91. perl %RazzleToolPath%\cksku.pm -t:srv -l:%lang% -a:%_BuildArch%
  92. if errorlevel 1 set _SRV=
  93. )
  94. if defined _ADS (
  95. perl %RazzleToolPath%\cksku.pm -t:ads -l:%lang% -a:%_BuildArch%
  96. if errorlevel 1 set _ADS=
  97. )
  98. REM Set ProductList to the subdirs of products that support upgrades from Win9x.
  99. if defined _PRO set ProductList=pro
  100. if defined _PER set ProductList=%ProductList% per
  101. echo.
  102. echo Beginning Win9x Upgrade data generation
  103. echo ---------------------------------------
  104. REM
  105. REM Build filelist.dat, a list of all the files installed by NT for a specific product
  106. REM
  107. set filegen_counter=0
  108. if not defined x86 goto HWDATGEN
  109. for %%a in (%ProductList%) do (
  110. if /i "%%a" == "pro" (
  111. set infdir=.
  112. ) else (
  113. set infdir=perinf
  114. )
  115. set /a filegen_counter=!filegen_counter!+1
  116. start /min cmd /c wrapper.cmd !filegen_counter! filegen -i:%_NTPostBld%\%%a\i386 -o:%_NTPostBld%\!infdir!\filelist.dat -a:%_NtPostBld%\mstools\filegen.inf -w:%tmp%\filelist.%%a.wrn -b:%_NTPostBld%\congeal_scripts\setupw95.%%a.txt -t:%_NTPostBld%\build_logs\%%a
  117. )
  118. :HWDATGEN
  119. REM
  120. REM Product hwcomp.dat, a database of compatible PNP IDs
  121. REM
  122. set HwDatgenProductList=%ProductList%
  123. if defined _BLA set HwDatgenProductList=%HwDatgenProductList% bla
  124. if defined _SBS set HwDatgenProductList=%HwDatgenProductList% sbs
  125. if defined _SRV set HwDatgenProductList=%HwDatgenProductList% srv
  126. if defined _ADS set HwDatgenProductList=%HwDatgenProductList% ads
  127. if /i "%_BuildArch%" == "x86" (
  128. set bindir=i386
  129. ) else (
  130. set bindir=%_BuildArch%
  131. )
  132. set hwdatgen_counter=0
  133. for %%a in (%HwDatgenProductList%) do (
  134. if /i "%%a" == "pro" (
  135. set infdir=.
  136. ) else if /i "%%a" == "per" (
  137. set infdir=perinf
  138. ) else if /i "%%a" == "bla" (
  139. set infdir=blainf
  140. ) else if /i "%%a" == "sbs" (
  141. set infdir=sbsinf
  142. ) else if /i "%%a" == "srv" (
  143. set infdir=srvinf
  144. ) else if /i "%%a" == "ads" (
  145. set infdir=entinf
  146. )
  147. set /a hwdatgen_counter=!hwdatgen_counter!+1
  148. start /min cmd /c wrapper.cmd !hwdatgen_counter! hwdatgen -i:%_NTPOSTBLD%\%%a\%bindir% -o:%_NTPOSTBLD%\!infdir!\hwcomp.dat
  149. )
  150. REM Wait for all of the processes to complete
  151. set WaitEvents=
  152. for /l %%a in (1,1,%filegen_counter%) do (
  153. set WaitEvents=!WaitEvents! filegen.%%a
  154. )
  155. for /l %%a in (1,1,%hwdatgen_counter%) do (
  156. set WaitEvents=!WaitEvents! hwdatgen.%%a
  157. )
  158. perl %RazzleToolPath%\PostBuildScripts\cmdevt.pl -iwv %WaitEvents%
  159. REM
  160. REM Now copy resulting files into the appropriate locations
  161. REM
  162. if "%filegen_counter%" == "0" goto CopyHWDATGEN
  163. for %%a in (%ProductList%) do (
  164. if /i "%%a" == "pro" (
  165. set infdir=.
  166. ) else (
  167. set infdir=perinf
  168. )
  169. if NOT EXIST %_NTPostBld%\!infdir!\filelist.dat (
  170. call errmsg "failed to generate filelist.dat for %%a"
  171. goto end
  172. )
  173. if exist !_NTPostBld!\comp\!infdir! (
  174. REM put filelist.da_ into comp so that release will copy and link it on the release server
  175. compress -r -zx21 -s %_NTPostBld%\!infdir!\filelist.dat %_NTPostBld%\comp\!infdir!\
  176. REM we also need to copy it into the cd image on the build machine because cdimage has already run
  177. if exist %_NTPostBld%\%%a\i386\filelist.da_ del %_NTPostBld%\%%a\i386\filelist.da_
  178. call ExecuteCmd.cmd "copy %_NTPostBld%\comp\!infdir!\filelist.da_ %_NTPostBld%\%%a\i386"
  179. ) else (
  180. REM we also need to copy it into the cd image on the build machine because cdimage has already run
  181. if exist %_NTPostBld%\%%a\i386\filelist.dat del %_NTPostBld%\%%a\i386\filelist.dat
  182. call ExecuteCmd.cmd "copy %_NTPostBld%\!infdir!\filelist.dat %_NTPostBld%\%%a\i386"
  183. )
  184. )
  185. :CopyHWDATGEN
  186. for %%a in (%HwDatgenProductList%) do (
  187. if /i "%%a" == "pro" (
  188. set infdir=.
  189. ) else if /i "%%a" == "per" (
  190. set infdir=perinf
  191. ) else if /i "%%a" == "bla" (
  192. set infdir=blainf
  193. ) else if /i "%%a" == "sbs" (
  194. set infdir=sbsinf
  195. ) else if /i "%%a" == "srv" (
  196. set infdir=srvinf
  197. ) else if /i "%%a" == "ads" (
  198. set infdir=entinf
  199. )
  200. if NOT EXIST %_NTPostBld%\!infdir!\hwcomp.dat (
  201. set errorlevel=1
  202. goto end
  203. )
  204. REM we also need to copy it into the cd image on the build machine because cdimage has already run
  205. if exist %_NTPostBld%\%%a\%bindir%\hwcomp.dat del %_NTPostBld%\%%a\%bindir%\hwcomp.dat
  206. call ExecuteCmd.cmd "copy %_NTPostBld%\!infdir!\hwcomp.dat %_NTPostBld%\%%a\%bindir%"
  207. REM NOTE: Do not compress -- code does not support hwcomp.da_
  208. )
  209. call logmsg.cmd "Win9x upgrade data generation completed"
  210. goto end
  211. :end
  212. seterror.exe "%errorlevel%"& goto :EOF