暫無描述

update_all.sh 773B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. #!/bin/sh
  2. main_repo=$(pwd)
  3. git_save() {
  4. status=$(git status -s)
  5. if [ "$status" ]; then
  6. git stash push --include-untracked
  7. return 0
  8. else
  9. return 1
  10. fi
  11. }
  12. git_restore() {
  13. if [ $1 -eq 0 ]; then
  14. git stash pop
  15. fi
  16. }
  17. # update main
  18. git pull
  19. # update battle_engine
  20. echo "*** Updating Battle Engine repository ***"
  21. cd $main_repo/battle_engine
  22. git_save
  23. result=$?
  24. git checkout master
  25. git pull
  26. git_restore $result
  27. # update g3headers
  28. echo "*** Updating g3headers repository ***"
  29. cd $main_repo/g3headers
  30. git_save
  31. result=$?
  32. git checkout master
  33. git pull
  34. git_restore $result
  35. # update private
  36. echo "*** Updating private repository ***"
  37. cd $main_repo/sots-private
  38. git_save
  39. result=$?
  40. git checkout master
  41. git pull
  42. git_restore $result