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.

157 lines
3.8 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. parseargs('?' => \&Usage);
  28. $lang = $ENV{LANG};
  29. if ($lang =~ /usa/i) {
  30. logmsg( "This is rebuilt only on localized build.");
  31. exit( 0 );
  32. }
  33. if ( ! -e "$ENV{_NTPOSTBLD}\\HelpAndSupportServices\\index.dat" ) {
  34. errmsg( "Index file is missing: $ENV{_NTPOSTBLD}\\HelpAndSupportServices\\index.dat" );
  35. exit( 1 );
  36. }
  37. my $platform = $ENV{_BuildArch};
  38. &Purge();
  39. if ( $platform =~ /x86/i )
  40. {
  41. &ConditionalCompileSKU( "per", "Personal_32" , "pchdt_p3.cab" ) or exit( 1 );
  42. &ConditionalCompileSKU( "pro", "Professional_32" , "pchdt_w3.cab" ) or exit( 1 );
  43. &ConditionalCompileSKU( "srv", "Server_32" , "pchdt_s3.cab" ) or exit( 1 );
  44. &ConditionalCompileSKU( "bla", "Blade_32" , "pchdt_b3.cab" ) or exit( 1 );
  45. &ConditionalCompileSKU( "sbs", "SmallBusinessServer_32", "pchdt_l3.cab" ) or exit( 1 );
  46. &ConditionalCompileSKU( "ads", "AdvancedServer_32" , "pchdt_e3.cab" ) or exit( 1 );
  47. &ConditionalCompileSKU( "dtc", "DataCenter_32" , "pchdt_d3.cab" ) or exit( 1 );
  48. }
  49. if ( $platform =~ /amd64/i )
  50. {
  51. &ConditionalCompileSKU( "pro", "Professional_64" , "pchdt_w6.cab" ) or exit( 1 );
  52. &ConditionalCompileSKU( "ads", "AdvancedServer_64", "pchdt_e6.cab" ) or exit( 1 );
  53. &ConditionalCompileSKU( "dtc", "DataCenter_64" , "pchdt_d6.cab" ) or exit( 1 );
  54. }
  55. if ( $platform =~ /ia64/i )
  56. {
  57. &ConditionalCompileSKU( "pro", "Professional_64" , "pchdt_w6.cab" ) or exit( 1 );
  58. &ConditionalCompileSKU( "ads", "AdvancedServer_64", "pchdt_e6.cab" ) or exit( 1 );
  59. &ConditionalCompileSKU( "dtc", "DataCenter_64" , "pchdt_d6.cab" ) or exit( 1 );
  60. }
  61. #
  62. # ConditionalCompileSKU($sku,$sku2,$cab)
  63. #
  64. # purpose: Run the setup tool for a particular sku
  65. #
  66. sub ConditionalCompileSKU {
  67. my ($sku,$sku2,$cab) = @_;
  68. return 1 unless &cksku::CkSku( $sku, $lang, $platform );
  69. &CompileSKU( $sku2 ) or return 0;
  70. &Binplace( $cab ) or return 0;
  71. return 1;
  72. }
  73. #
  74. # CompileSKU($sku)
  75. #
  76. # purpose: Run the setup tool for a particular sku
  77. #
  78. sub CompileSKU {
  79. my $sku = shift;
  80. &ExecuteCmd( "HssSetupTool.exe -root $ENV{_NTPOSTBLD}\\build_logs -log hss_$sku.log -dblog createdb_$sku.log COMPILE $ENV{_NTPOSTBLD} $sku" ) or return 0;
  81. return 1;
  82. }
  83. #
  84. # ExecuteCmd($cmd)
  85. #
  86. # purpose: Execute $cmd thru system call
  87. #
  88. sub ExecuteCmd {
  89. my $cmd = shift;
  90. logmsg( "Running $cmd...");
  91. my $r = system($cmd);
  92. if ($r>>8 == 0) {
  93. return 1; # return true on success
  94. }
  95. else {
  96. errmsg( "Failed ($r): $cmd" );
  97. return 0; # return false on failure
  98. }
  99. }
  100. #
  101. # Binplace($file)
  102. #
  103. # purpose: Copy the file into _NTPOSTBLD.
  104. #
  105. sub Binplace {
  106. my $file = shift;
  107. my $src = "$ENV{_NTPOSTBLD}\\HelpAndSupportServices";
  108. my $dst = "$ENV{_NTPOSTBLD}";
  109. &ExecuteCmd("copy /y $src\\$file $dst\\$file") or return 0;
  110. return 1;
  111. }
  112. #
  113. # Purge()
  114. #
  115. # purpose: Forces recreation of all the files under _NTPOSTBLD\HelpAndSupportServices.
  116. #
  117. sub Purge {
  118. my $src = "$ENV{_NTPOSTBLD}\\HelpAndSupportServices";
  119. &ExecuteCmd( "del /s /q /f $src\\*_gen" ) or return 0;
  120. return 1;
  121. }