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.

Update.cmd 1.3 KiB

54 years ago
54 years ago
54 years ago
54 years ago
54 years ago
54 years ago
54 years ago
54 years ago
54 years ago
54 years ago
54 years ago
54 years ago
54 years ago
54 years ago
54 years ago
54 years ago
54 years ago
54 years ago
54 years ago
54 years ago
54 years ago
54 years ago
54 years ago
54 years ago
54 years ago
54 years ago
54 years ago
54 years ago
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. @echo off
  2. set ubk=Update.bk.cmd
  3. if not "%1"=="run" (
  4. copy /y "%~0" %ubk%
  5. %ubk% run
  6. del /f /q %ubk%
  7. )
  8. set maps_dir=sas.maps
  9. set maps_url="http://parasite.kicks-ass.org:3000/sasgis/maps.git"
  10. git version
  11. echo Return code: %ERRORLEVEL%
  12. if ERRORLEVEL 9009 (
  13. echo Ошибка: Не установлен Git
  14. start "" "https://git-scm.com/downloads"
  15. goto end
  16. )
  17. if not exist ".git\" (
  18. goto CloneRepo
  19. ) else (
  20. goto UpdateRepo
  21. )
  22. :CloneRepo
  23. echo Делаем клон репозитория с сервера
  24. rd /s /q %maps_dir%
  25. git clone %maps_url% %maps_dir%
  26. if not ERRORLEVEL 0 (
  27. echo Ошибка связи с сервером
  28. goto end
  29. )
  30. echo Копируем папку с репозиторием из подпапки в текущую папку
  31. xcopy /i /s /h /e /y %maps_dir%\.git .\.git
  32. if not ERRORLEVEL 0 (
  33. echo Ошибка копирования папки .git
  34. goto end
  35. )
  36. echo Удаляем временно созданную подпапку
  37. rd /s /q %maps_dir%
  38. if not ERRORLEVEL 0 (
  39. echo Ошибка удаления временной папки sas.maps
  40. goto end
  41. )
  42. goto UpdateRepo
  43. :UpdateRepo
  44. echo Обновляем файлы до последней версии
  45. git fetch --all --verbose
  46. git clean -d -x --force --exclude="%ubk%"
  47. git reset --hard origin/master
  48. goto end
  49. :end
  50. pause