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.

107 lines
2.7 KiB

  1. @echo off
  2. REM ------------------------------------------------------------------
  3. REM
  4. REM UpdateNtprintCat.cmd
  5. REM update ntprint.cat for SPs. ntprint.inf specifies the catalogfile
  6. REM that it's files are signed in (ntprint.cat), hence we must update
  7. REM this catalog to avoid signing warnings.
  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 File::Copy;
  21. use Updcat;
  22. use Logmsg;
  23. sub Usage { print<<USAGE; exit(1) }
  24. update ntprint.cat for SPs, no parameters required
  25. USAGE
  26. sub Dependencies {
  27. if ( !open DEPEND, ">>$ENV{_NTPOSTBLD}\\..\\build_logs\\dependencies.txt" ) {
  28. errmsg("Unable to open dependency list file.");
  29. die;
  30. }
  31. print DEPEND<<DEPENDENCIES;
  32. \[$0\]
  33. IF { ntprint.cat } ADD {}
  34. DEPENDENCIES
  35. close DEPEND;
  36. exit;
  37. }
  38. my $qfe;
  39. parseargs('?' => \&Usage,
  40. 'plan' => \&Dependencies,
  41. 'qfe:' => \$qfe);
  42. if ( -f "$ENV{_NTPOSTBLD}\\..\\build_logs\\skip.txt" ) {
  43. if ( !open SKIP, "$ENV{_NTPOSTBLD}\\..\\build_logs\\skip.txt" ) {
  44. errmsg("Unable to open skip list file.");
  45. die;
  46. }
  47. while (<SKIP>) {
  48. chomp;
  49. exit if lc$_ eq lc$0;
  50. }
  51. close SKIP;
  52. }
  53. sub sys {
  54. my $cmd = shift;
  55. print "$cmd\n";
  56. system($cmd);
  57. if ($?) {
  58. errmsg("Error running $cmd\n");
  59. }
  60. }
  61. open(MAPFILE, "$ENV{RAZZLETOOLPATH}\\sp\\data\\catalog\\$ENV{LANG}\\$ENV{_BUILDARCH}$ENV{_BUILDTYPE}\\PrintFiles.hash")
  62. || die "ERROR: can't find $ENV{RAZZLETOOLPATH}\\sp\\data\\catalog\\$ENV{LANG}\\$ENV{_BUILDARCH}$ENV{_BUILDTYPE}\\PrintFiles.hash\n";
  63. my $ntprintcat = "$ENV{_NTPOSTBLD}\\ntprint.cat";
  64. system(" copy $ENV{RAZZLETOOLPATH}\\sp\\data\\catalog\\$ENV{LANG}\\$ENV{_BUILDARCH}$ENV{_BUILDTYPE}\\ntprint.cat $ntprintcat");
  65. # || die "ERROR: can't copy $ENV{RAZZLETOOLPATH}\\sp\\data\\catalog\\$ENV{LANG}\\$ENV{_BUILDARCH}$ENV{_BUILDTYPE}\\ntprint.cat to $ntprintcat\n";
  66. my $counter = 0;
  67. my (@remove_hashes, @add_filesigs);
  68. while (<MAPFILE>)
  69. {
  70. chomp();
  71. /(\S*)(.*)/;
  72. my $filename = "$ENV{_NTPOSTBLD}\\$1";
  73. if (-e $filename) {
  74. print "signature for $filename needs updating\n";
  75. $counter++;
  76. push @remove_hashes, $2;
  77. push @add_filesigs, $filename;
  78. #system("updcat $ntprintcat -d \"$2\"");
  79. #sys("updcat $ntprintcat -a $filename");
  80. }
  81. }
  82. if ($counter){
  83. Updcat::Update( $ntprintcat, \@remove_hashes, \@add_filesigs ) || die Updcat::GetLastError();
  84. sys("ntsign.cmd -f $ntprintcat");
  85. }