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.

180 lines
4.6 KiB

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