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.

141 lines
3.4 KiB

  1. select(STDOUT); $| =1; # force flush on STDOUT
  2. # default options
  3. $SrcDir = Srv;
  4. $ZipDir = "$SrcDir.Zip";
  5. $ZipPref = IIS;
  6. $Debug = 0;
  7. $WinZip = 0;
  8. $DoOnly = "";
  9. # STUPID must pipe some garbage in to pkzip when running from Remote
  10. $pkzip = "echo y | pkzip";
  11. $zip2exe = "zip2exe";
  12. $PkZipOptions =
  13. $WinZipOptions = "-Y -3 -c setup.exe -m \"Microsoft Internet Information Service\" -31 -LE";
  14. for ( $i = 0; $i <= $#ARGV ; $i++ ) {
  15. # force the argument to lower case
  16. @ARGV[$i] = "\L@ARGV[$i]";
  17. print "Argument $i=\L@ARGV[$i]\n";
  18. if ( @ARGV[$i] EQ "-src" ) {
  19. $SrcDir = @ARGV[++$i];
  20. }elsif ( @ARGV[$i] EQ "-dst" ) {
  21. $ZipDir = @ARGV[++$i];
  22. }elsif ( @ARGV[$i] EQ "-debug" ) {
  23. $Debug = 1;
  24. }elsif ( @ARGV[$i] EQ "-seeonly" ) {
  25. $zip2exeonly = 1;
  26. }elsif ( @ARGV[$i] EQ "-only" ) {
  27. $DoOnly = @ARGV[++$i];
  28. }elsif ( @ARGV[$i] EQ "-winzip" ) {
  29. $WinZip = 1;
  30. }else {
  31. print "Unsupported argument @ARGV[$i]\n";
  32. print "Usage: [-src <srv>] [-dst<.>] [-debug] [-only i386|i386n|PPC|MIPS|ALPHA]\n ";
  33. print " -src <source directory>\n";
  34. print " -dst <directory were zips are put>\n";
  35. print " -only i386|i386n|PPC|MIPS|ALPHA] only do zip for\n";
  36. print " -debug echo's statements does not execute them\n";
  37. die(1);
  38. }
  39. }
  40. if ( ! -e $ZipDir ) {
  41. mkdir ($ZipDir, "RWX" );
  42. }
  43. if ( $DoOnly EQ "" ) {
  44. @CpuDirs = ("i386", "i386N", "PPC", "ALPHA", "MIPS");
  45. }else{
  46. @CpuDirs = ($DoOnly);
  47. }
  48. print "CpuDirs == @CpuDirs \n";
  49. @ZipDirsBase=("Clients", "Help", "Docs");
  50. print "ZipDirsBase== @ZipDirsBase\n";
  51. # Files not found elsewhere in the system
  52. #
  53. $RootFiles = "$SrcDir\\license.txt $SrcDir\\setup.exe $SrcDir\\inetsrv $SrcDir\\readme.txt $SrcDir\\readme.wri ";
  54. $MessageFile = "message.txt";
  55. foreach $Cpu ( @CpuDirs ) {
  56. print "Cpu == $Cpu\n";
  57. $ZipBase = "$ZipPref$Cpu";
  58. $ZipPath = $ZipDir."\\" ;
  59. $ZipFile = "$ZipBase.zip";
  60. $ZipExe = "$ZipBase.exe";
  61. $ZipFilePath = "$ZipPath$ZipBase.zip";
  62. $ZipExePath = "$ZipPath$ZipBase.exe";
  63. print "ZipFile == $ZipFile\n";
  64. # Asymble the list of Dirs to Zip
  65. # We make two versions of I386 one with clients without
  66. @ZipDirs = @ZipDirsBase;
  67. if ( "\L$Cpu" EQ "i386n" ) {
  68. $Cpu = "i386";
  69. shift(@ZipDirs); # remove Clients Dir
  70. }
  71. unshift(@ZipDirs, $Cpu);
  72. print "ZipFilePath == $ZipFilePath\n";
  73. print "ZipExePath == $ZipExePath\n";
  74. print "ZipDirs == @ZipDirs\n";
  75. if ( -e $ZipExePath ) {psystem("del $ZipExePath");}
  76. if ( !$zip2exeonly ) {
  77. if ( -e $ZipFilePath ) {psystem("del $ZipFilePath");}
  78. foreach $Dir ( @ZipDirs ) {
  79. psystem("$pkzip $ZipFilePath $SrcDir\\$Dir\\*.* -P -r -ex");
  80. }
  81. # now tack on additional files that are not found in the recursed tree
  82. psystem("$pkzip $ZipFilePath $RootFiles -P -ex");
  83. # add the comment that is printed out for this archive
  84. if ( -e $MessageFile ) {
  85. psystem("pkzip $ZipFilePath -z < $MessageFile ");
  86. } else {
  87. print "Message File \"$MessageFile\" does not exist. Skipping..\n";
  88. }
  89. }
  90. if (-e $ZipFilePath ) {
  91. # must chdir to Dst Dir because SEE only works locally
  92. if ( $WinZip == 0 ) {
  93. psystem("pushd $ZipDir && $zip2exe $ZipFile\n");
  94. } else {
  95. psystem("pushd $ZipDir && winzipse $ZipFile $WinZipOptions");
  96. }
  97. } else {
  98. print "WARNING: $ZipFilePath does not exists... skipping zip to exe\n\n";
  99. }
  100. }
  101. sub psystem{
  102. print "Dbg=$Debug->@_\n";
  103. if ($Debug == 0) {system(@_);}
  104. }