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.

141 lines
3.6 KiB

  1. @echo off
  2. REM ------------------------------------------------------------------
  3. REM
  4. REM hnw.cmd
  5. REM This will call iexpress to generate a self-extracting CAB that
  6. REM will be used when running our tool off of a floppy disk.
  7. REM
  8. REM Copyright (c) Microsoft Corporation. All rights reserved.
  9. REM
  10. REM ------------------------------------------------------------------
  11. if defined _CPCMAGIC goto CPCBegin
  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. sub Usage { print<<USAGE; exit(1) }
  22. hnw.cmd [-l <language>]
  23. This is for the Home Networking Wizard. It runs iexpress to generate
  24. a self-extracting CAB and install into support\tools.
  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 { NetSetup.EXE } ADD { hnw.sed }
  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. # *** NEXT FEW LINES ARE TEMPLATE ***
  54. $ENV{"_CPCMAGIC"}++;exit(system($0)>>8);
  55. __END__
  56. :CPCBegin
  57. set _CPCMAGIC=
  58. setlocal ENABLEDELAYEDEXPANSION ENABLEEXTENSIONS
  59. REM *** BEGIN YOUR CMD SCRIPT BELOW ***
  60. REM
  61. REM x86 only!
  62. REM
  63. if not defined x86 goto end
  64. REM
  65. REM Use iexpress.exe to generate the self-extracting executable;
  66. REM
  67. REM first update the sed with the proper binaries directory
  68. set nswtemp=%temp%\nsw
  69. set hnw.sed=%nswtemp%\hnw.sed
  70. set hnw.sed2=%nswtemp%\hnw.sed2
  71. set hnw.sed3=%nswtemp%\hnw.sed3
  72. set doubledpath=%_NtPostBld:\=\\%
  73. set doubledtemppath=%nswtemp:\=\\%
  74. call logmsg.cmd "Deleting old netsetup.exe unpacked binaries from %nswtemp%"
  75. del /q /f %nswtemp%
  76. perl -n -e "s/BINARIES_DIR/%doubledpath%/g;print $_;" < %_NtPostBld%\hnw.sed > %hnw.sed%
  77. call logmsg.cmd "Unpack Gold netsetup.exe into %nswtemp%"
  78. %RazzleToolPath%\sp\data\GoldFiles\%Lang%\%_BuildArch%%_BuildType%\netsetup.exe -Q -C -T:%nswtemp%
  79. call logmsg.cmd "Overlay new service pack files to %nswtemp%"
  80. perl "%RazzleToolPath%\sp\hnw.pl" %hnw.sed% %nswtemp%
  81. perl -n -e "s/TargetName=BINARIES_DIR/TargetName=%doubledpath%/g;print $_;" < %_NtPostBld%\hnw.sed > %hnw.sed2%
  82. perl -n -e "s/BINARIES_DIR/%doubledtemppath%/g;print $_;" < %hnw.sed2% > %hnw.sed3%
  83. perl -n -e "s/UPnPDown\\//g;print $_;" < %hnw.sed3% > %hnw.sed%
  84. REM Now call iexpress on the new sed
  85. if not exist %hnw.sed% (
  86. call errmsg.cmd "File %hnw.sed% not found."
  87. popd& goto end
  88. )
  89. set outpath=%_NTPostBld%
  90. if exist %outpath%\netsetup.exe del /f %outpath%\netsetup.exe
  91. REM
  92. REM Munge the path so we use the correct wextract.exe to build the package with...
  93. REM NOTE: We *want* to use the one we just built (and for Intl localized)!
  94. REM
  95. set _NEW_PATH_TO_PREPEND=%RazzleToolPath%\%PROCESSOR_ARCHITECTURE%\loc\%LANG%
  96. set _OLD_PATH_BEFORE_PREPENDING=%PATH%
  97. set PATH=%_NEW_PATH_TO_PREPEND%;%PATH%
  98. call logmsg.cmd "Package all binaries from %nswtemp% into new netsetup.exe"
  99. call ExecuteCmd.cmd "start /min /wait iexpress.exe /M /N /Q %hnw.sed%"
  100. REM
  101. REM Return the path to what it was before...
  102. REM
  103. set PATH=%_OLD_PATH_BEFORE_PREPENDING%
  104. if not exist %outpath%\netsetup.exe (
  105. call errmsg.cmd "IExpress.exe failed on %hnw.sed%."
  106. popd& goto end
  107. )
  108. popd
  109. :end
  110. seterror.exe "%errors%"& goto :EOF