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.

224 lines
8.1 KiB

  1. @REM -----------------------------------------------------------------
  2. @REM
  3. @REM ADMigration.cmd - v-PaulT
  4. @REM Generates a new ADMigration.msi based on the compiled binaries
  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. ADMigration [-l <language>]
  20. Generates a new ADMigration.msi and PwdMig.msi based on the compiled binaries
  21. USAGE
  22. parseargs('?' => \&Usage);
  23. # *** TEMPLATE CODE ***
  24. $ENV{"_CPCMAGIC"}++;exit(system($0)>>8);
  25. __END__
  26. @:CPCBegin
  27. @set _CPCMAGIC=
  28. @if not defined DEBUG echo off
  29. @REM *** CMD SCRIPT BELOW ***
  30. REM admigration.msi is not applicable to languages with no server products.
  31. perl %RazzleToolPath%\cksku.pm -t:bla -l:%lang%
  32. if %errorlevel% EQU 0 goto :ValidSKU
  33. perl %RazzleToolPath%\cksku.pm -t:sbs -l:%lang%
  34. if %errorlevel% EQU 0 goto :ValidSKU
  35. perl %RazzleToolPath%\cksku.pm -t:srv -l:%lang%
  36. if %errorlevel% EQU 0 goto :ValidSKU
  37. perl %RazzleToolPath%\cksku.pm -t:ads -l:%lang%
  38. if %errorlevel% EQU 0 goto :ValidSKU
  39. perl %RazzleToolPath%\cksku.pm -t:dtc -l:%lang%
  40. if %errorlevel% EQU 0 goto :ValidSKU
  41. call logmsg.cmd "admigration.cmd: no server products for %lang%; nothing to do."
  42. goto :EOF
  43. :ValidSKU
  44. REM ADDED BY v-pault
  45. REM Set the location of the tools I will use
  46. set TOOLPATH=%RazzleToolPath%
  47. REM ADDED BY v-pault
  48. REM Make directories
  49. set ADMTDIR=%_NTPostBld%\admt
  50. set ADMTFILESINMSIDIR=%_NTPostBld%\admt\filesinmsi
  51. set SUPPORTDIR=%_NTPostBld%\admt\release
  52. if NOT EXIST %SUPPORTDIR% md %SUPPORTDIR%
  53. set PWDMIGDIR=%_NTPostBld%\admt\release\PwdMig
  54. if NOT EXIST %PWDMIGDIR% md %PWDMIGDIR%
  55. REM ADDED BY xyuan
  56. REM Copy files to be included in msi from other folders to admt\filesinmsi folder
  57. call logmsg.cmd "Copying files into %ADMTFILESINMSIDIR%"
  58. if exist %ADMTFILESINMSIDIR% (
  59. call ExecuteCmd.cmd "rd /q /s %ADMTFILESINMSIDIR%"
  60. if errorlevel 1 (
  61. call errmsg.cmd "Failed to delete %ADMTFILESINMSIDIR%."
  62. goto end
  63. )
  64. )
  65. call ExecuteCmd.cmd "md %ADMTFILESINMSIDIR%"
  66. if errorlevel 1 (
  67. call errmsg.cmd "Failed to create %ADMTFILESINMSIDIR%."
  68. goto end
  69. )
  70. REM Copy executables
  71. for %%i in (admt admtagnt dctagentservice mcsdispatcher admtagntnt4 dctagentservicent4 ) do (
  72. call ExecuteCmd "copy %_NTPostBld%\%%i.exe %ADMTFILESINMSIDIR%\%%i.exe"
  73. if errorlevel 1 (
  74. call errmsg.cmd "Failed to copy %%i.exe from %_NTPostBld% to %ADMTFILESINMSIDIR%."
  75. goto end
  76. )
  77. )
  78. REM Copy dlls
  79. for %%i in (AddToGroup ADMTScript DBManager DisableTargetAccount DomMigSI GetRids McsADsClassProp McsDctWorkerObjects McsDmMsg McsDmRes McsMigrationDriver MCSNetObjectEnum McsPISag McsVarSetMin MoveObj ScmMigr SetTargetPassword TrustMgr UpdateDB UpdateMOT UPNUpdt wizards MsPwdMig McsDctWorkerObjectsNT4 McsDmMsgNT4 McsDmResNT4 McsPISagNT4 McsVarSetMinNT4 pwmig mschapp PwMigNT4 ) do (
  80. call ExecuteCmd "copy %_NTPostBld%\%%i.dll %ADMTFILESINMSIDIR%\%%i.dll"
  81. if errorlevel 1 (
  82. call errmsg.cmd "Failed to copy %%i.dll from %_NTPostBld% to %ADMTFILESINMSIDIR%."
  83. goto end
  84. )
  85. )
  86. REM Copy misc files
  87. for %%i in (DomainMig.chm ADMTReadMe.doc TemplateScript.vbs Gothic.ttf Gothicb.ttf Gothicbi.ttf Gothici.ttf Migrator.msc Protar.mdb msvcp60.dll) do (
  88. call ExecuteCmd "copy %ADMTDIR%\%%i %ADMTFILESINMSIDIR%\%%i"
  89. if errorlevel 1 (
  90. call errmsg.cmd "Failed to copy %%i from %ADMTDIR% to %ADMTFILESINMSIDIR%."
  91. goto end
  92. )
  93. )
  94. REM ADDED BY xyuan
  95. REM Create admt.cat for all files that will be included in admigration.msi and pwdmig.msi files
  96. call logmsg.cmd /t "Creating admt.cat ..."
  97. pushd %ADMTFILESINMSIDIR%
  98. call ExecuteCmd.cmd "%SDXROOT%\tools\deltacat.cmd %ADMTFILESINMSIDIR%"
  99. popd
  100. if errorlevel 1 (
  101. call errmsg.cmd "Failed to create delta.cat."
  102. goto end
  103. )
  104. call ExecuteCmd.cmd "copy %ADMTFILESINMSIDIR%\delta.cat %_NTPostBld%\admt.cat"
  105. if errorlevel 1 (
  106. call errmsg.cmd "Failed to copy delta.cat from %ADMTFILESINMSIDIR% to %_NTPostBld% as admt.cat."
  107. goto end
  108. )
  109. REM ADMIGRATION.MSI
  110. REM Copy admigration.msi from admt folder to admt\release folder
  111. call ExecuteCmd.cmd "copy %ADMTDIR%\ADMigration.msi %SUPPORTDIR%\ADMigration.msi"
  112. REM ADDED BY v-pault
  113. REM Removing any old cab file from the static msi file
  114. call logmsg.cmd /t "Removing any old cab file from the static ADMigration msi file"
  115. REM Make sure the file can be updated...
  116. attrib -r %SUPPORTDIR%\ADMigration.msi
  117. REM call ExecuteCmd.cmd "cscript.exe %TOOLPATH%\WiStream.vbs %SUPPORTDIR%\ADMigration.msi /D Cabs.w1.cab"
  118. call cscript.exe %TOOLPATH%\WiStream.vbs %SUPPORTDIR%\ADMigration.msi /D Cabs.w1.cab
  119. if errorlevel 1 (
  120. call errmsg.cmd "WiStream.vbs failed to remove current CAB from ADMigration.msi."
  121. goto end
  122. )
  123. call cscript.exe %TOOLPATH%\WiStream.vbs %SUPPORTDIR%\ADMigration.msi /D Cabs.w1.CAB
  124. REM ADDED BY v-pault
  125. REM Placing the new binaries in a new cab file, and placing that cab in the msi file...
  126. call logmsg.cmd /t "Placing the new binaries in a new cab file, and placing that cab in ADMigration.msi..."
  127. call ExecuteCmd.cmd "cscript.exe %TOOLPATH%\WiMakADMTCab.vbs %SUPPORTDIR%\ADMigration.msi Cabs.w1 %ADMTFILESINMSIDIR% /c /u /e"
  128. if errorlevel 1 (
  129. call errmsg.cmd "WiMakCab.vbs failed to make new CAB with built binaries for ADMigration.msi."
  130. goto end
  131. )
  132. REM ADDED BY v-pault
  133. REM Fixing the file size and version info for the new ADMigration.msi...
  134. call logmsg.cmd /t "Fixing the file size and version info for the new ADMigration.msi..."
  135. call ExecuteCmd.cmd "msifiler -d %SUPPORTDIR%\ADMigration.msi -s %ADMTFILESINMSIDIR%\"
  136. if errorlevel 1 (
  137. call errmsg.cmd "Msifiler failed to fix file size and version info."
  138. goto end
  139. )
  140. REM PWDMIG.MSI
  141. REM Copy pwdmig.msi from admt folder to admt\release\pwdmig folder
  142. call logmsg.cmd /t "Copying pwdmig.msi from %ADMTDIR% to %PWDMIGDIR%"
  143. call ExecuteCmd.cmd "copy %ADMTDIR%\PwdMig.msi %PWDMIGDIR%\PwdMig.msi"
  144. if errorlevel 1 (
  145. call errmsg.cmd "Failed to copy pwdmig.msi from %ADMTDIR% to %PWDMIGDIR%."
  146. goto end
  147. )
  148. REM ADDED BY v-pault
  149. REM Removing any old cab file from the static PwdMig msi file
  150. call logmsg.cmd /t "Removing any old cab file from the static PwdMig msi file"
  151. call cscript.exe %TOOLPATH%\WiStream.vbs %PWDMIGDIR%\PwdMig.msi /D Cabs.w1.cab
  152. call cscript.exe %TOOLPATH%\WiStream.vbs %PWDMIGDIR%\PwdMig.msi /D Cabs.w1.CAB
  153. REM ADDED BY v-pault
  154. REM Placing the new binaries in a new cab file, and placing that cab in PwdMig.msi...
  155. call logmsg.cmd /t "Placing the new binaries in a new cab file, and placing that cab in PwdMig.msi..."
  156. call ExecuteCmd.cmd "cscript.exe %TOOLPATH%\WiMakADMTCab.vbs %PWDMIGDIR%\PwdMig.msi Cabs.w1 %ADMTFILESINMSIDIR% /c /u /e"
  157. if errorlevel 1 (
  158. call errmsg.cmd "WiMakCab.vbs failed to make new CAB with built binaries for PwdMig.msi."
  159. goto end
  160. )
  161. REM ADDED BY v-pault
  162. REM Fixing the file size and version info for the new PwdMig.msi...
  163. call logmsg.cmd /t "Fixing the file size and version info for the new PwdMig.msi..."
  164. call ExecuteCmd.cmd "msifiler -d %PWDMIGDIR%\PwdMig.msi -s %ADMTFILESINMSIDIR%\"
  165. if errorlevel 1 (
  166. call errmsg.cmd "Msifiler failed to fix file size and version info."
  167. goto end
  168. )
  169. REM ADDED BY v-pault
  170. REM Copying some other files to %SUPPORTDIR%
  171. call logmsg.cmd /t "Copying some other files to %SUPPORTDIR%"
  172. call ExecuteCmd.cmd "copy %ADMTFILESINMSIDIR%\ADMTReadme.doc %SUPPORTDIR%\ReadMe.doc"
  173. call ExecuteCmd.cmd "copy %ADMTDIR%\cpysym.cmd %SUPPORTDIR%\cpysym.cmd"
  174. call ExecuteCmd.cmd "copy %ADMTDIR%\PwdMig.exe %PWDMIGDIR%\PwdMig.exe"
  175. call ExecuteCmd.cmd "copy %ADMTDIR%\PwdMig.ini %PWDMIGDIR%\PwdMig.ini"
  176. call ExecuteCmd.cmd "copy %ADMTDIR%\instmsiw.exe %PWDMIGDIR%\instmsiw.exe"
  177. goto end
  178. :end
  179. REM remove temporary files created
  180. if exist cabs*.* del cabs*.*
  181. call ExecuteCmd.cmd "rd /q /s %ADMTFILESINMSIDIR%"