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.

193 lines
4.6 KiB

  1. @echo off
  2. REM ------------------------------------------------------------------
  3. REM
  4. REM helpsupportservices.cmd
  5. REM Rebuild HelpAndSupportServices\index.dat on localized builds
  6. REM
  7. REM Owner: DMassare
  8. REM
  9. REM Copyright (c) Microsoft Corporation. All rights reserved.
  10. REM
  11. REM ------------------------------------------------------------------
  12. perl -x "%~f0" %*
  13. goto :EOF
  14. #!perl
  15. use strict;
  16. use lib $ENV{RAZZLETOOLPATH} . "\\PostBuildScripts";
  17. use lib $ENV{RAZZLETOOLPATH};
  18. use PbuildEnv;
  19. use ParseArgs;
  20. use Logmsg;
  21. use cksku;
  22. sub Usage { print<<USAGE; exit(1) }
  23. helpsupportservices [-l <language>]
  24. Rebuild HelpAndSupportServices\\index.dat on localized builds
  25. USAGE
  26. my ( $lang, $BuildName, $BuildNamePath, $LogFileName, $TempDir, $NtTree );
  27. sub Dependencies {
  28. if ( !open DEPEND, ">>$ENV{_NTPOSTBLD}\\..\\build_logs\\dependencies.txt" ) {
  29. errmsg("Unable to open dependency list file.");
  30. die;
  31. }
  32. print DEPEND<<DEPENDENCIES;
  33. \[$0\]
  34. IF {
  35. pchdt_p3.cab
  36. pchdt_w3.cab
  37. pchdt_w6.cab
  38. } ADD {
  39. helpandsupportservices\\...
  40. }
  41. DEPENDENCIES
  42. close DEPEND;
  43. exit;
  44. }
  45. my $qfe;
  46. parseargs('?' => \&Usage,
  47. 'plan' => \&Dependencies,
  48. 'qfe:' => \$qfe);
  49. if ( -f "$ENV{_NTPOSTBLD}\\..\\build_logs\\skip.txt" ) {
  50. if ( !open SKIP, "$ENV{_NTPOSTBLD}\\..\\build_logs\\skip.txt" ) {
  51. errmsg("Unable to open skip list file.");
  52. die;
  53. }
  54. while (<SKIP>) {
  55. chomp;
  56. exit if lc$_ eq lc$0;
  57. }
  58. close SKIP;
  59. }
  60. $lang = $ENV{LANG};
  61. if ($lang =~ /usa/i) {
  62. logmsg( "This is rebuilt only on localized build.");
  63. exit( 0 );
  64. }
  65. if ( ! -e "$ENV{_NTPOSTBLD}\\HelpAndSupportServices\\index.dat" ) {
  66. logmsg( "Index file is missing, not rebuilding: $ENV{_NTPOSTBLD}\\HelpAndSupportServices\\index.dat" );
  67. exit( 0 );
  68. }
  69. my $platform = $ENV{_BuildArch};
  70. &Purge();
  71. if ( $platform =~ /x86/i )
  72. {
  73. &ConditionalCompileSKU( "per", "Personal_32" , "pchdt_p3.cab" ) or exit( 1 );
  74. &ConditionalCompileSKU( "pro", "Professional_32" , "pchdt_w3.cab" ) or exit( 1 );
  75. # &ConditionalCompileSKU( "srv", "Server_32" , "pchdt_s3.cab" ) or exit( 1 );
  76. # &ConditionalCompileSKU( "bla", "Blade_32" , "pchdt_b3.cab" ) or exit( 1 );
  77. # &ConditionalCompileSKU( "sbs", "SmallBusinessServer_32", "pchdt_l3.cab" ) or exit( 1 );
  78. # &ConditionalCompileSKU( "ads", "AdvancedServer_32" , "pchdt_e3.cab" ) or exit( 1 );
  79. # &ConditionalCompileSKU( "dtc", "DataCenter_32" , "pchdt_d3.cab" ) or exit( 1 );
  80. }
  81. if ( $platform =~ /amd64/i )
  82. {
  83. &ConditionalCompileSKU( "pro", "Professional_64" , "pchdt_w6.cab" ) or exit( 1 );
  84. # &ConditionalCompileSKU( "ads", "AdvancedServer_64", "pchdt_e6.cab" ) or exit( 1 );
  85. # &ConditionalCompileSKU( "dtc", "DataCenter_64" , "pchdt_d6.cab" ) or exit( 1 );
  86. }
  87. if ( $platform =~ /ia64/i )
  88. {
  89. &ConditionalCompileSKU( "pro", "Professional_64" , "pchdt_w6.cab" ) or exit( 1 );
  90. # &ConditionalCompileSKU( "ads", "AdvancedServer_64", "pchdt_e6.cab" ) or exit( 1 );
  91. # &ConditionalCompileSKU( "dtc", "DataCenter_64" , "pchdt_d6.cab" ) or exit( 1 );
  92. }
  93. #
  94. # ConditionalCompileSKU($sku,$sku2,$cab)
  95. #
  96. # purpose: Run the setup tool for a particular sku
  97. #
  98. sub ConditionalCompileSKU {
  99. my ($sku,$sku2,$cab) = @_;
  100. if (&cksku::CkSku( $sku, $lang, $platform ) and
  101. -e "$ENV{_NTPOSTBLD}\\helpandsupportservices\\$cab") {
  102. &CompileSKU( $sku2 ) or return 0;
  103. &Binplace( $cab ) or return 0;
  104. }
  105. return 1;
  106. }
  107. #
  108. # CompileSKU($sku)
  109. #
  110. # purpose: Run the setup tool for a particular sku
  111. #
  112. sub CompileSKU {
  113. my $sku = shift;
  114. &ExecuteCmd( "HssSetupTool.exe -root $ENV{_NTPOSTBLD}\\build_logs -log hss_$sku.log -dblog createdb_$sku.log COMPILE $ENV{_NTPOSTBLD} $sku" ) or return 0;
  115. return 1;
  116. }
  117. #
  118. # ExecuteCmd($cmd)
  119. #
  120. # purpose: Execute $cmd thru system call
  121. #
  122. sub ExecuteCmd {
  123. my $cmd = shift;
  124. logmsg( "Running $cmd...");
  125. my $r = system($cmd);
  126. if ($r>>8 == 0) {
  127. return 1; # return true on success
  128. }
  129. else {
  130. errmsg( "Failed ($r): $cmd" );
  131. return 0; # return false on failure
  132. }
  133. }
  134. #
  135. # Binplace($file)
  136. #
  137. # purpose: Copy the file into _NTPOSTBLD.
  138. #
  139. sub Binplace {
  140. my $file = shift;
  141. my $src = "$ENV{_NTPOSTBLD}\\HelpAndSupportServices";
  142. my $dst = "$ENV{_NTPOSTBLD}";
  143. &ExecuteCmd("copy /y $src\\$file $dst\\$file") or return 0;
  144. return 1;
  145. }
  146. #
  147. # Purge()
  148. #
  149. # purpose: Forces recreation of all the files under _NTPOSTBLD\HelpAndSupportServices.
  150. #
  151. sub Purge {
  152. my $src = "$ENV{_NTPOSTBLD}\\HelpAndSupportServices";
  153. &ExecuteCmd( "del /s /q /f $src\\*_gen" ) or return 0;
  154. return 1;
  155. }