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.

95 lines
2.5 KiB

  1. @echo off
  2. setlocal EnableDelayedExpansion
  3. REM assumptions:
  4. REM
  5. REM 1) BuildName is first command line arg
  6. REM 2) lang is an optional second arg
  7. call logmsg.cmd /t "Beginning ..."
  8. REM set local variables
  9. set /a ExitCode=0
  10. set CopyLocations=\\BURNLAB9\public \\BURNLAB10\public
  11. REM CopyDirs is a list of dirs from the level of binaries which you want copied
  12. set CopyDirs=wks bla sbs srv ent dtc per
  13. REM parse command line
  14. set BuildName=%1
  15. for /f "tokens=1 delims=." %%a in ('echo %BuildName%') do set /a BuildNumber=%%a
  16. if not defined BuildNumber (
  17. REM Build number not given!
  18. call errmsg.cmd "No build name given, exiting."
  19. goto :ErrEnd
  20. )
  21. if "!BuildNumber!" == "0" (
  22. REM Build number not given!
  23. call errmsg.cmd "No build number given, exiting."
  24. set /a ExitCode=!ExitCode! + 1
  25. goto :ErrEnd
  26. )
  27. if not "%2" == "" (
  28. REM set the lang
  29. set Language=%2
  30. )
  31. if not defined Language set Language=usa
  32. REM get the release dir from net share
  33. net share release >nul 2>nul
  34. if "!ErrorLevel!" NEQ "0" (
  35. call errmsg.cmd "Failed to find a release share to push from, exiting."
  36. set /a ExitCode=!ExitCode! + 1
  37. goto :ErrEnd
  38. )
  39. set ReleaseDir=
  40. for /f "tokens=1,2" %%a in ('net share release') do (
  41. echo A = '%%a' B = '%%b'
  42. if /i "%%a" == "Path" set ReleaseDir=%%b
  43. )
  44. if not defined ReleaseDir (
  45. call errmsg.cmd "Failed to locate release path, exiting."
  46. set /a ExitCode=!ExitCode! + 1
  47. goto :ErrEnd
  48. )
  49. REM add the language to the release dir
  50. set ReleaseDir=%ReleaseDir%\%Language%
  51. REM now do the push copy
  52. for %%a in (%CopyLocations%) do (
  53. if not exist %%a (
  54. call errmsg.cmd "Can't find %%a to copy to, skipping ..."
  55. set /a ExitCode=!ExitCode! + 1
  56. ) else (
  57. for %%b in (%CopyDirs%) do (
  58. if not exist %ReleaseDir%\%BuildName%\%%b (
  59. call errmsg.cmd "Failed to find %ReleaseDir%\%BuildName%\%%b for xcopy ..."
  60. set /a ExitCode=!ExitCode! + 1
  61. ) else (
  62. echo if not exist %%a\%BuildName%\%%b md %%a\%BuildName%\%%b
  63. echo xcopy /cdehikr %ReleaseDir%\%BuildName%\%%b %%a\%BuildName%\%%b
  64. echo if "!ErrorLevel!" NEQ "0" set /a ExitCode=!ExitCode! + 1
  65. )
  66. )
  67. )
  68. )
  69. REM see if there were copy errors
  70. if "!ExitCode!" NEQ "0" (
  71. call logmsg.cmd "There were copying errors."
  72. goto :ErrEnd
  73. )
  74. goto :End
  75. :End
  76. call logmsg.cmd /t "Finished."
  77. endlocal
  78. goto :EOF
  79. :ErrEnd
  80. call errmsg.cmd "Script failed with !ExitCode! logged error(s)."
  81. call errmsg.cmd "See %LOGFILE% for details."
  82. call logmsg.cmd /t "Finished."
  83. endlocal & seterror.exe "!ExitCode!"