sync.sh 666 B

1234567891011121314151617181920212223242526272829303132
  1. #!/bin/bash
  2. # @Author: Bachir Soussi Chiadmi <bach>
  3. # @Date: 26-03-2017
  4. # @Email: bachir@figureslibres.io
  5. # @Last modified by: bach
  6. # @Last modified time: 21-04-2017
  7. # @License: GPL-V3
  8. # setup
  9. distantrepos='https://figureslibres.io/gogs/bachir/TDSM-commissaires.git'
  10. # script
  11. echo "Sync book"
  12. # activate credential cache
  13. git config --global credential.helper cache
  14. git config --global credential.helper 'cache --timeout=7200'
  15. folder='book-src'
  16. if [ -d $folder/.git ];
  17. then
  18. # if repos exists, pull
  19. echo "Pull $repo"
  20. git -C $folder pull origin master
  21. else
  22. # if repos does not exists, clone
  23. echo "clone $repo"
  24. git clone $distantrepos $folder
  25. fi