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.

157 lines
4.0 KiB

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