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.

179 lines
4.4 KiB

  1. @echo off
  2. REM ------------------------------------------------------------------
  3. REM
  4. REM NTBackupOnPersonal.cmd
  5. REM Make CAB files for ntbackup distribution on personal (ntbackup.msi)
  6. REM
  7. REM Copyright (c) Microsoft Corporation. All rights reserved.
  8. REM
  9. REM ------------------------------------------------------------------
  10. if defined _CPCMAGIC goto CPCBegin
  11. perl -x "%~f0" %*
  12. goto :EOF
  13. #!perl
  14. use strict;
  15. use lib $ENV{RAZZLETOOLPATH} . "\\PostBuildScripts";
  16. use lib $ENV{RAZZLETOOLPATH};
  17. use PbuildEnv;
  18. use ParseArgs;
  19. sub Usage { print<<USAGE; exit(1) }
  20. NTBackupOnPersonal.cmd [-l <language>]
  21. Make CAB files for ntbackup distribution (ntbackup.msi)
  22. USAGE
  23. parseargs('?' => \&Usage);
  24. # *** NEXT FEW LINES ARE TEMPLATE ***
  25. $ENV{"_CPCMAGIC"}++;exit(system($0)>>8);
  26. __END__
  27. :CPCBegin
  28. set _CPCMAGIC=
  29. setlocal ENABLEDELAYEDEXPANSION ENABLEEXTENSIONS
  30. REM *** BEGIN YOUR CMD SCRIPT BELOW ***
  31. if not defined 386 (
  32. call logmsg.cmd "NTBackupOnPersonal.cmd do nothing on non i386"
  33. goto :EOF
  34. )
  35. REM ntbackup.msi is not applicable to languages with no personal products.
  36. perl %RazzleToolPath%\cksku.pm -t:per -l:%lang%
  37. if %errorlevel% EQU 0 goto :ValidSKU
  38. call logmsg.cmd "CABGEN: no Personal product for %lang%; nothing to do."
  39. goto :EOF
  40. :ValidSKU
  41. REM
  42. REM Generate cmbins.exe as it is needed below.
  43. REM
  44. REM call cmbins.cmd
  45. REM
  46. REM Generate ntbackup.msi
  47. REM
  48. if not exist %_NTPostBld%\ntbkup_P (
  49. call errmsg.cmd "Directory %_NTPostBld%\ntbkup_P not found."
  50. goto :EOF
  51. )
  52. pushd %_NTPostBld%\ntbkup_P
  53. for %%i in (.\ntbkup_P.msi .\ntbkup_P.ddf) do (
  54. if not exist %%i (
  55. call errmsg.cmd "File %_NTPostBld%\ntbkup_P\%%i not found."
  56. popd& goto :EOF
  57. )
  58. )
  59. REM
  60. REM Only run if relevant files changed
  61. REM
  62. if exist %_NtPostBld%\build_logs\bindiff.txt (
  63. for /f "skip=15 tokens=1 delims=" %%b in (ntbkup_P.ddf) do (
  64. findstr /ilc:%%b %_NTPostBld%\build_logs\bindiff.txt
  65. if /i "!ErrorLevel!" == "0" (
  66. call LogMsg.cmd "%%b changed - running cab generation"
  67. goto :RunIt
  68. )
  69. )
  70. call LogMsg.cmd "No relevant files changed - ending"
  71. popd& goto :EOF
  72. )
  73. :RunIt
  74. REM
  75. REM Create ntbackup.cab.
  76. REM As iexpress.exe does not set errorlevel in all error cases,
  77. REM base verification on adminpak.cab's existence.
  78. REM
  79. if exist ntbackup.cab call ExecuteCmd.cmd "del /f ntbackup.cab"
  80. if errorlevel 1 popd& goto :EOF
  81. if exist release call ExecuteCmd.cmd "rd /s /q release"
  82. if errorlevel 1 popd& goto :EOF
  83. call ExecuteCmd.cmd "copy ..\ntbckupw.chm ntbackup.chm"
  84. if errorlevel 1 popd& goto :EOF
  85. call ExecuteCmd.cmd "start /wait /min makecab /D SourceDir=%_NTPOSTBLD% /F ntbkup_P.ddf"
  86. if not exist ntbackup.cab (
  87. call errmsg.cmd "Cab creation for ntbackup.cab."
  88. popd& goto :EOF
  89. )
  90. REM
  91. REM Create ntbackup.msi
  92. REM msifiler.exe needs the uncompressed files, so uncab ntbackup.cab.
  93. REM
  94. call ExecuteCmd.cmd "copy ntbkup_P.msi ntbackup.msi"
  95. if errorlevel 1 popd& goto :EOF
  96. REM
  97. REM Extract the Cabs table
  98. REM Copy the cab file into the Cabs directory
  99. REM Import the new Cab into the Cabs directory
  100. REM
  101. call ExecuteCmd.cmd "msidb.exe -d .\ntbackup.msi -f %_NTPostBld%\ntbkup_P -e Cabs"
  102. if errorlevel 1 popd& goto :EOF
  103. call ExecuteCmd.cmd "copy /y .\ntbackup.CAB .\Cabs\ntbackup.CAB.ibd"
  104. if errorlevel 1 popd& goto :EOF
  105. call ExecuteCmd.cmd "msidb.exe -d .\ntbackup.msi -f %_NTPostBld%\ntbkup_P -i Cabs.idt"
  106. if errorlevel 1 popd& goto :EOF
  107. call ExecuteCmd.cmd "del .\cabs.idt"
  108. if errorlevel 1 popd& goto :EOF
  109. call ExecuteCmd.cmd "rd /s /q Cabs"
  110. if errorlevel 1 popd& goto :EOF
  111. if exist .\cabtemp call ExecuteCmd.cmd "rd /q /s .\cabtemp"
  112. if errorlevel 1 popd& goto :EOF
  113. call ExecuteCmd.cmd "md .\cabtemp"
  114. if errorlevel 1 popd& goto :EOF
  115. call ExecuteCmd.cmd "extract.exe /Y /E /L .\cabtemp ntbackup.cab"
  116. if errorlevel 1 popd& goto :EOF
  117. REM
  118. REM Rename some of the files in cabtemp so that
  119. REM msifiler.exe can find them in the file table
  120. REM and correctly update the verion and size informaiton.
  121. REM
  122. call ExecuteCmd.cmd "msifiler.exe -d .\ntbackup.msi -s .\cabtemp\"
  123. if errorlevel 1 popd& goto :EOF
  124. rem
  125. rem Cleanup
  126. rem
  127. call ExecuteCmd.cmd "del /f .\ntbackup.cab"
  128. call ExecuteCmd.cmd "del /f .\ntbackup.chm"
  129. call ExecuteCmd.cmd "rd /q /s .\cabtemp"
  130. REM
  131. REM Copy "NTBackupReadme.txt" to "Readme.txt"
  132. REM and copy to release directory
  133. REM
  134. call ExecuteCmd.cmd "md release"
  135. call ExecuteCmd.cmd "copy NtBackup_Personal_Readme.txt release\Readme.txt"
  136. call ExecuteCmd.cmd "copy Ntbackup.msi release\NtBackup.msi"
  137. if errorlevel 1 popd& goto :EOF
  138. popd