sync.sh 668 B

12345678910111213141516171819202122232425262728293031323334
  1. #!/bin/bash
  2. echo "Sync books"
  3. # activate credential cache
  4. git config --global credential.helper cache
  5. git config --global credential.helper 'cache --timeout=7200'
  6. folder='book-src'
  7. host='https://figureslibres.io/gogs/bachir'
  8. # echo "$host"
  9. repos[0]='TDSM-oeuvres'
  10. repos[1]='TDSM-notices'
  11. repos[2]='TDSM-commissaires'
  12. repos[3]='TDSM-english'
  13. # echo $repos
  14. for repo in "${repos[@]}"
  15. do
  16. echo ${repo}
  17. if [ -d $folder/$repo.git ];
  18. then
  19. # if repos exists, pull
  20. echo 'Pull $repo'
  21. git -C $folder/$repo.git pull origin master
  22. else
  23. # if repos does not exists, clone
  24. echo 'clone $repo'
  25. git clone $host/$repo.git $folder/$repo.git
  26. fi
  27. done