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.9 KiB

  1. @setlocal
  2. @if "%_echo%"=="" echo off
  3. set bldtools=%~dp0
  4. path %bldtools%;%path%
  5. call %1 %1 %2 %3 %4 %5 %6 %7 %8 %9
  6. set logfile=%logpath%\%~n0.log
  7. for %%f in (%logfile%) do mkdir %%~dpf 2>nul
  8. for %%f in (%patchtemp%\z) do mkdir %%~dpf 2>nul
  9. for %%f in (%patchexe%) do mkdir %%~dpf 2>nul
  10. echo %~n0: start %date% %time% > %logfile%
  11. if exist %patchddf% erase %patchddf%
  12. if exist %patchcab% erase %patchcab%
  13. if exist %patchexe% erase %patchexe%
  14. call %bldtools%\setlog %loglinkpath% %logpath%
  15. :ddfbuild
  16. if not exist %bldtools%\hotfixddf.template goto ddffail
  17. if not exist %bldtools%\hotfixddf.filelist goto ddffail
  18. copy %bldtools%\hotfixddf.template %patchddf% >nul
  19. for /f "tokens=1,2,3" %%f in (%bldtools%\hotfixddf.filelist) do call :AddFile %%f %%g %%h
  20. if exist %patchddf% goto cabbuild
  21. :ddffail
  22. echo %~n0: failed to build DDF (missing template or filelist?)
  23. goto leave
  24. :cabbuild
  25. echo makecab /f %patchddf% /d CabinetName1=%patchcab% >> %logfile%
  26. makecab /f %patchddf% /d CabinetName1=%patchcab% >> %logfile%
  27. if not errorlevel 1 goto exebuild
  28. :cabfail
  29. echo %~n0: MAKECAB failed: errorlevel %errorlevel%
  30. goto leave
  31. :exebuild
  32. if not exist %patchcab% goto cabfail
  33. echo makesfx %patchcab% %patchexe% /run /stub %stubexe% /nonsysfree 20000000 >> %logfile%
  34. makesfx %patchcab% %patchexe% /run /stub %stubexe% /nonsysfree 20000000 >> %logfile%
  35. if not errorlevel 1 goto done
  36. echo makesfx %patchcab% %patchexe% /run /stub %stubexe% >> %logfile%
  37. makesfx %patchcab% %patchexe% /run /stub %stubexe% >> %logfile%
  38. if not errorlevel 1 goto done
  39. :exefail
  40. echo %~n0: MAKESFX failed: errorlevel %errorlevel%
  41. goto leave
  42. :done
  43. if not exist %patchexe% goto failedexe
  44. echo %~n0 completed %patchexe%
  45. :leave
  46. echo %~n0: end %date% %time% >> %logfile%
  47. endlocal
  48. goto :EOF
  49. :AddFile
  50. set _run=
  51. if /i "%1"=="update\update.exe" set _run=/RUN
  52. rem No errors for optional files
  53. if /i "%2"=="optional" if not exist %newfiles%\%1 goto :EOF
  54. rem If there's a patching version of this file, use it,
  55. rem otherwise use the file from the new build.
  56. set _name=%newfiles%\%1
  57. if exist %patching%\%1 set _name=%patching%\%1
  58. rem Translate preinstalled files to zero-length indicator
  59. rem UNLESS that file is named in the filelist (which means
  60. rem this might be package to update the preinstall files.)
  61. if /i "%3" neq "preinstall" goto nosubzero
  62. findstr /i /c:"%1" %sourcelist% >nul
  63. if not errorlevel 1 goto nosubzero
  64. set _name=%bldtools%\zero
  65. :nosubzero
  66. echo "%_name%" "%1" %_run% >> %patchddf%
  67. goto :EOF