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.

310 lines
8.9 KiB

  1. @echo off
  2. if defined _echo echo on
  3. if defined verbose echo on
  4. setlocal ENABLEDELAYEDEXPANSION ENABLEEXTENSIONS
  5. REM copytsc.cmd:
  6. REM This script copies the x86 tsclient files to a 64 bit machine
  7. REM to populate the tsclient install directories.
  8. REM Contact: nadima
  9. REM -------------------------------------------------------------------------------------------
  10. REM Template for the postbuild scripts:
  11. REM SD Location: %sdxroot%\tools\postbuildscripts
  12. REM
  13. REM (1) Code section description:
  14. REM PreMain - Developer adaptable code. Use this model and add your script params
  15. REM Main - Developer code section. This is where your work gets done.
  16. REM PostMain - Logging support code. No changes should be made here.
  17. REM
  18. REM (2) GetParams.pm - Usage
  19. REM run perl.exe GetParams.pm /? for complete usage
  20. REM
  21. REM (3) Reserved Variables -
  22. REM lang - The specified language. Defaults to USA.
  23. REM logfile - The path and filename of the logs file.
  24. REM logfile_bak - The path and filename of the logfile.
  25. REM errfile - The path and filename of the error file.
  26. REM tmpfile - The path and filename of the temp file.
  27. REM errors - The scripts errorlevel.
  28. REM script_name - The script name.
  29. REM script_args - The arguments passed to the script.
  30. REM CMD_LINE - The script name plus arguments passed to the script.
  31. REM _NTPostBld - Abstracts the language from the files path that
  32. REM postbuild operates on.
  33. REM
  34. REM (4) Reserved Subs -
  35. REM Usage - Use this sub to discribe the scripts usage.
  36. REM ValidateParams - Use this sub to verify the parameters passed to the script.
  37. REM
  38. REM
  39. REM (8) Do not turn echo off, copy the 3 lines from the beginning of the template
  40. REM instead.
  41. REM
  42. REM (9) Use setlocal/endlocal as in this template.
  43. REM
  44. REM (10)Have your changes reviewed by a member of the US build team (ntbusa) and
  45. REM by a member of the international build team (ntbintl).
  46. REM
  47. REM -------------------------------------------------------------------------------------------
  48. REM PreMainPreMainPreMainPreMainPreMainPreMainPreMainPreMainPreMainPreMainPreMain
  49. REM Begin PreProcessing Section - Adapt this section but do not remove support
  50. REM scripts or reorder section.
  51. REM PreMainPreMainPreMainPreMainPreMainPreMainPreMainPreMainPreMainPreMainPreMain
  52. :PreMain
  53. REM
  54. REM Define SCRIPT_NAME. Used by the logging scripts.
  55. REM Define CMD_LINE. Used by the logging scripts.
  56. REM Define SCRIPT_ARGS. Used by the logging scripts.
  57. REM
  58. for %%i in (%0) do set SCRIPT_NAME=%%~ni.cmd
  59. set CMD_LINE=%script_name% %*
  60. set SCRIPT_ARGS=%*
  61. REM
  62. REM Parse the command line arguments - Add your scripts command line arguments
  63. REM as indicated by brackets.
  64. REM For complete usage run: perl.exe GetParams.pm /?
  65. REM
  66. for %%h in (./ .- .) do if ".%SCRIPT_ARGS%." == "%%h?." goto Usage
  67. REM call :GetParams -n <add required prams> -o l:<add optional params> -p "lang <add variable names>" %SCRIPT_ARGS%
  68. call :GetParams -o l: -p "lang" %SCRIPT_ARGS%
  69. if errorlevel 1 goto :End
  70. REM
  71. REM Set up the local enviroment extensions.
  72. REM
  73. call :LocalEnvEx -i
  74. if errorlevel 1 goto :End
  75. REM
  76. REM Validate the command line parameters.
  77. REM
  78. call :ValidateParams
  79. if errorlevel 1 goto :End
  80. REM
  81. REM Execute Main
  82. REM
  83. call :Main
  84. :End_PreMain
  85. goto PostMain
  86. REM /\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
  87. REM Begin Main code section
  88. REM /\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
  89. REM (5) Call other executables or command scripts by using:
  90. REM call ExecuteCmd.cmd "<command>"
  91. REM Check for errors by using:
  92. REM if errorlevel 1 ...
  93. REM Note that the executable/script you're calling with ExecuteCmd must return a
  94. REM non-zero value on errors to make the error checking mechanism work.
  95. REM
  96. REM Example
  97. REM call ExecuteCmd.cmd "xcopy /f foo1 foo2"
  98. REM if errorlevel 1 (
  99. REM set errors=%errorlevel%
  100. REM goto end
  101. REM )
  102. REM
  103. REM (6) Log non-error information by using:
  104. REM call logmsg.cmd "<log message>"
  105. REM and log error information by using:
  106. REM call errmsg.cmd "<error message>"
  107. REM
  108. REM (7) Exit from the option routines with
  109. REM set errors=%errorlevel%
  110. REM goto end
  111. REM if errors found during execution and with
  112. REM goto end
  113. REM otherwise.
  114. :Main
  115. REM Main code section
  116. REM <Start your script's code here>
  117. REM This script copies the x86 tsclient files to a 64 bit machine
  118. REM to populate the tsclient share directories.
  119. REM Contact: nadima
  120. REM ================================~START BODY~===============================
  121. REM Bail if your not on a 64 bit machine
  122. if /i "%_BuildArch%" neq "ia64" (
  123. if /i "%_BuildArch%" neq "amd64" (
  124. call logmsg.cmd "Not Win64, exiting."
  125. goto :End
  126. )
  127. )
  128. REM If you want to get your own x86 bits instead of those from
  129. REM your VBL, you have to set _NTTscBinsTREE
  130. if defined _NTTscBinsTREE (
  131. set SourceDir=%_NTTscBinsTREE%
  132. goto :EndGetBuild
  133. )
  134. REM read the copy location from build_logs\CPLocation.txt
  135. set CPFile=%_NTPOSTBLD%\build_logs\CPLocation.txt
  136. if not exist %CPFile% (
  137. call logmsg.cmd "Copy Location file not found, will attempt to create ..."
  138. call %RazzleToolPath%\PostBuildScripts\CPLocation.cmd -l:%lang%
  139. if not exist %CPFile% (
  140. call errmsg.cmd "CPLocation.cmd failed, exiting ..."
  141. goto :End
  142. )
  143. )
  144. for /f "delims=" %%a in ('type %CPFile%') do set CPLocation=%%a
  145. if not exist %CPLocation% (
  146. call logmsg.cmd "Copy Location from %CPFile% does not exist, retry ..."
  147. call %RazzleToolPath%\PostBuildScripts\CPLocation.cmd -l:%lang%
  148. if not exist %CPFile% (
  149. call errmsg.cmd "CPLocation.cmd failed, exiting ..."
  150. goto :End
  151. )
  152. for /f "delims=" %%a in ('type %CPFile%') do set CPLocation=%%a
  153. if not exist !CPLocation! (
  154. call errmsg.cmd "Copy Location !CPLocation! does not exist ..."
  155. goto :End
  156. )
  157. )
  158. call logmsg.cmd "Copy Location for tsclient files is set to %CPLocation% ..."
  159. set SourceDir=%CPLocation%
  160. :EndGetBuild
  161. call logmsg.cmd "Using %SourceDir% as source directory for tsclient files..."
  162. if not exist %SourceDir% (
  163. call errmsg.cmd "The source dir %SourceDir% does not exist ..."
  164. goto :End
  165. )
  166. call logmsg.cmd "Copying files from %SourceDir%"
  167. REM Now perform the copy
  168. REM
  169. REM NOTE: We do the touch to ensure that the files have newer file
  170. REM stamps than the dummy 'idfile' placeholder as otherwise compression
  171. REM can fail to notice that the files have changed and we'll get the
  172. REM dummy files shipped on the release shares.
  173. REM
  174. for /f "tokens=1,2 delims=," %%a in (%RazzleToolPath%\PostBuildScripts\CopyTsc.txt) do (
  175. call ExecuteCmd.cmd "copy %SourceDir%\%%a %_NTPOSTBLD%\"
  176. call ExecuteCmd.cmd "touch %_NTPOSTBLD%\%%a"
  177. )
  178. goto end
  179. REM ================================~END BODY~=================================
  180. :ValidateParams
  181. REM
  182. REM Validate the option given as parameter.
  183. REM
  184. goto end
  185. :Usage
  186. REM Usage of the script
  187. REM If errors, goto end
  188. echo CopyWow64.cmd generates a list of files
  189. echo on a 64 bit machine to copy and copies
  190. echo them from the appropriate 32 bit machine
  191. echo Usage: %script_name% [-l lang][-?]
  192. echo -l lang 2-3 letter language identifier
  193. echo -? Displays usage
  194. set ERRORS=1
  195. goto end
  196. REM /\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
  197. REM End Main code section
  198. REM /\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
  199. :End_Main
  200. goto PostMain
  201. REM SupportSubsSupportSubsSupportSubsSupportSubsSupportSubsSupportSubsSupportSubs
  202. REM Support Subs - Do not touch this section!
  203. REM SupportSubsSupportSubsSupportSubsSupportSubsSupportSubsSupportSubsSupportSubs
  204. :GetParams
  205. REM
  206. REM Parse the command line arguments
  207. REM
  208. set ERRORS=0
  209. for %%h in (./ .- .) do if ".%SCRIPT_ARGS%." == "%%h?." goto Usage
  210. pushd %RazzleToolPath%\PostBuildScripts
  211. set ERRORS=0
  212. for /f "tokens=1 delims=;" %%c in ('perl.exe GetParams.pm %*') do (
  213. set commandline=%%c
  214. set commandtest=!commandline:~0,3!
  215. if /i "!commandtest!" neq "set" (
  216. if /i "!commandtest!" neq "ech" (
  217. echo %%c
  218. ) else (
  219. %%c
  220. )
  221. ) else (
  222. %%c
  223. )
  224. )
  225. if "%errorlevel%" neq "0" (
  226. set ERRORS=%errorlevel%
  227. goto end
  228. )
  229. popd
  230. goto end
  231. :LocalEnvEx
  232. REM
  233. REM Manage local script environment extensions
  234. REM
  235. pushd %RazzleToolPath%\PostBuildScripts
  236. for /f "tokens=1 delims=;" %%c in ('perl.exe LocalEnvEx.pm %1') do (
  237. set commandline=%%c
  238. set commandtest=!commandline:~0,3!
  239. if /i "!commandtest!" neq "set" (
  240. if /i "!commandtest!" neq "ech" (
  241. echo %%c
  242. ) else (
  243. %%c
  244. )
  245. ) else (
  246. %%c
  247. )
  248. )
  249. if "%errorlevel%" neq "0" (
  250. set errors=%errorlevel%
  251. goto end
  252. )
  253. popd
  254. goto end
  255. :end
  256. seterror.exe "%errors%"& goto :EOF
  257. REM PostMainPostMainPostMainPostMainPostMainPostMainPostMainPostMainPostMain
  258. REM Begin PostProcessing - Do not touch this section!
  259. REM PostMainPostMainPostMainPostMainPostMainPostMainPostMainPostMainPostMain
  260. :PostMain
  261. REM
  262. REM End the local environment extensions.
  263. REM
  264. call :LocalEnvEx -e
  265. REM
  266. REM Check for errors
  267. REM
  268. endlocal& seterror.exe %errors%