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

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