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.

258 lines
4.9 KiB

  1. @echo off
  2. @if NOT defined HOST_PROCESSOR_ARCHITECTURE set HOST_PROCESSOR_ARCHITECTURE=%PROCESSOR_ARCHITECTURE%
  3. if defined _echo echo on
  4. if defined verbose echo on
  5. setlocal ENABLEEXTENSIONS
  6. REM -----------------------------------------------------------------------------------
  7. REM tagmsi - Script written by VijeshS
  8. REM -----------------------------------------------------------------------------------
  9. REM ------------------------------------------------------------------------------------
  10. REM
  11. REM tagmsi.cmd <MSI package> <script dir> <Destination> <infofile> <language>
  12. REM
  13. REM Note : All paths are relative
  14. REM
  15. REM <MSI package> - winnt32 MSI mackage that is checked in (relative path)
  16. REM
  17. REM <script dir> - Path to the location of the Package Update script (relative path)
  18. REM
  19. REM <Destination> - Destination MSI package
  20. REM
  21. REM <Infofile> - File that contains product-specific information
  22. REM
  23. REM <Language> - Language being used
  24. REM
  25. REM
  26. REM
  27. REM
  28. REM
  29. REM
  30. REM
  31. REM
  32. REM
  33. REM
  34. REM
  35. REM
  36. REM
  37. REM ------------------------------------------------------------------------------------
  38. goto MAIN
  39. :START
  40. REM Start Process
  41. REM
  42. REM Get the value of the locale ID (LCID) for the current language,
  43. REM per public\tools\codes.txt.
  44. REM USA is the default language.
  45. REM
  46. set lang=%5
  47. if not defined lang set lang=USA
  48. call :SetLCID %lang%
  49. echo %LCID%
  50. if errorlevel 1 goto errend
  51. set arch=%HOST_PROCESSOR_ARCHITECTURE%
  52. REM
  53. REM Get the (prodnomajor), (bldnomajor), and (prodnominor), (bldnominor) n.n.nnnn.nnnn from buildno.txt
  54. REM
  55. call :SetBldno
  56. if errorlevel 1 goto errend
  57. REM
  58. REM Define "mybinaries" as the directory of binaries to be processed by this
  59. REM build rule option. On US build machine, the files to be processed reside
  60. REM in %binaries%. On international build machines the files to be processed
  61. REM are in a directory called "relbins". %Relbins% contains the localized
  62. REM version of the files from %binaries%.
  63. REM
  64. REM Do not redefine mybinaries if already defined.
  65. REM
  66. REM
  67. REM Make external deployment winnt32.msi files.
  68. REM
  69. set ERROR=
  70. echo Copying %1 to %3
  71. echo
  72. compdir /deknstz %1 %3
  73. if NOT "%errorlevel%" == "0" (
  74. call errmsg.cmd "Copying %1 to %3 failed"
  75. goto errend
  76. )
  77. set ERROR=
  78. call :ExecuteCmd "cscript.exe %2\updateos.vbs %3 %arch% %prodnomajor% %prodnominor% %bldno% %bldnoMin% %LCID% %4"
  79. if errorlevel 1 set /A ERROR=1
  80. if defined ERROR goto errend
  81. goto end
  82. REM BEGIN
  83. :MAIN
  84. REM
  85. REM Define SCRIPT_NAME. Used by the logging scripts.
  86. REM
  87. set script_name=TAGMSI
  88. REM
  89. REM Save the command line.
  90. REM
  91. set cmdline=%script_name% %*
  92. REM
  93. REM Mark the beginning of script's execution.
  94. REM
  95. REM
  96. REM Execute the build rule option.
  97. REM
  98. call :START %1 %2 %3 %4 %5
  99. if errorlevel 1 (set /A ERRORS=%errorlevel%) else (set /A ERRORS=0)
  100. REM
  101. REM Mark the end of script's execution.
  102. REM
  103. if "%ERRORS%" == "0" goto end_main
  104. goto errend_main
  105. :end_main
  106. endlocal
  107. goto end
  108. :errend_main
  109. endlocal
  110. goto errend
  111. :errend
  112. seterror.exe 1
  113. goto :EOF
  114. :end
  115. seterror.exe 0
  116. goto :EOF
  117. REM END
  118. :SetLCID
  119. REM First parameter must be language
  120. if "%1" == "" (
  121. echo "TAGMSIinternal error: GetLCID requires language as parameter"
  122. goto errend
  123. )
  124. set codes=%_ntbindir%\tools\codes.txt
  125. if not exist %codes% (
  126. call errmsg.cmd "File %codes% not found."
  127. goto errend
  128. )
  129. set LCID=
  130. for /f "tokens=3 eol=;" %%i in ('findstr /ib /c:"%1 " %codes%') do (
  131. set LCID=%%i
  132. )
  133. if "%LCID%" == "" (
  134. call errmsg.cmd "Unable to find LCID for %1 in %codes%."
  135. goto errend
  136. )
  137. goto end
  138. :Set Product Number
  139. :SetBldno
  140. set ntverfile=%_NTPostBld%\congeal_scripts\setupmsi\buildno.txt
  141. if not exist %ntverfile% (
  142. call errmsg.cmd "File %ntverfile% not found."
  143. goto errend
  144. )
  145. set prodnomajor=
  146. for /f "tokens=2" %%i in ('findstr /c:"prodnomajor " %ntverfile%') do (
  147. set prodnomajor=%%i
  148. )
  149. set prodnominor=
  150. for /f "tokens=2" %%i in ('findstr /c:"prodnominor " %ntverfile%') do (
  151. set prodnominor=%%i
  152. )
  153. set bldno=
  154. for /f "tokens=2" %%i in ('findstr /c:"major " %ntverfile%') do (
  155. set bldno=%%i
  156. )
  157. set bldnoMin=
  158. for /f "tokens=2" %%i in ('findstr /c:"minor " %ntverfile%') do (
  159. set bldnoMin=%%i
  160. )
  161. if "%prodnomajor%" == "" (
  162. call errmsg.cmd "Unable to define prodNoMajor per %ntverfile%"
  163. goto errend
  164. )
  165. if "%prodnominor%" == "" (
  166. call errmsg.cmd "Unable to define prodnominor per %ntverfile%"
  167. goto errend
  168. )
  169. if "%bldno%" == "" (
  170. call errmsg.cmd "Unable to define bldnoMajor per %ntverfile%"
  171. goto errend
  172. )
  173. if "%bldnoMin%" == "" (
  174. call errmsg.cmd "Unable to define bldnoMin per %ntverfile%"
  175. goto errend
  176. )
  177. goto end
  178. :ExecuteCmd
  179. set cmd=%1
  180. set cmd=%cmd:"=%
  181. REM call logmsg.cmd "Running %cmd%." %tmpfile%
  182. %cmd%
  183. if NOT "%errorlevel%" == "0" (
  184. call errmsg.cmd "%cmd% Failed"
  185. goto errend
  186. )
  187. goto end