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.

71 lines
2.0 KiB

  1. @REM -----------------------------------------------------------------
  2. @REM
  3. @REM spcat.cmd - JeremyD
  4. @REM Generate nt5inf.cat files with signatures for SP infs
  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 lib $ENV{RAZZLETOOLPATH} . "\\PostBuildScripts\\svcpack";
  16. use PbuildEnv;
  17. use ParseArgs;
  18. use SP;
  19. use Utils;
  20. sub Usage { print<<USAGE; exit(1) }
  21. spcat [-l <lang>]
  22. Generate nt5inf-sp.cat with signatures for SP infs. This catalog will
  23. be generated based on the existing nt5inf.cat but will sign
  24. layout-sp.inf and drvindex-sp.inf instead of layout.inf and
  25. drvindex.inf.
  26. USAGE
  27. parseargs('?' => \&Usage);
  28. for my $sku (SP::sp_skus()) {
  29. update_cat($sku);
  30. }
  31. sub update_cat {
  32. my $sku = shift;
  33. my $cat = Utils::inf_file($sku, "nt5inf.cat");
  34. my $spcat = "$ENV{_NTPOSTBLD}\\SP\\CAT\\$sku\\nt5inf.cat";
  35. Utils::mkdir("$ENV{_NTPOSTBLD}\\SP\\CAT\\$sku");
  36. Utils::sys("copy $cat $spcat");
  37. update_hash($spcat, Utils::inf_file($sku, "layout.inf"),
  38. "$ENV{_NTPOSTBLD}\\SP\\$sku\\layout.inf");
  39. update_hash($spcat, Utils::inf_file($sku, "drvindex.inf"),
  40. "$ENV{_NTPOSTBLD}\\SP\\$sku\\drvindex.inf");
  41. update_hash($spcat, Utils::inf_file($sku, "dosnet.inf"),
  42. "$ENV{_NTPOSTBLD}\\SP\\$sku\\dosnet.inf");
  43. update_hash($spcat, Utils::inf_file($sku, "txtsetup.sif"),
  44. "$ENV{_NTPOSTBLD}\\SP\\$sku\\txtsetup.sif");
  45. Utils::sys("$ENV{RAZZLETOOLPATH}\\ntsign.cmd $spcat");
  46. Utils::sys("compress -s -zx21 -r $spcat");
  47. }
  48. sub update_hash {
  49. my $cat = shift;
  50. my $old = shift;
  51. my $new = shift;
  52. my $oldhash = `calchash $old`;
  53. if ($?) { die "calchash: $? $oldhash" }
  54. $oldhash =~ s/\s//g;
  55. Utils::sys("updcat $cat -r \"$oldhash\" $new");;
  56. }