Files
gitbook-html2print/bin/sync.sh
T

43 lines
848 B
Bash
Executable File

#!/bin/bash
# @Author: Bachir Soussi Chiadmi <bach>
# @Date: 26-03-2017
# @Email: bachir@figureslibres.io
# @Last modified by: bach
# @Last modified time: 21-04-2017
# @License: GPL-V3
echo "Sync books"
# activate credential cache
git config --global credential.helper cache
git config --global credential.helper 'cache --timeout=7200'
folder='book-src'
host='https://figureslibres.io/gogs/bachir'
# echo "$host"
repos[0]='TDSM-oeuvres'
repos[1]='TDSM-notices'
repos[2]='TDSM-commissaires'
repos[3]='TDSM-english'
# echo $repos
for repo in "${repos[@]}"
do
echo ${repo}
if [ -d $folder/$repo.git ];
then
# if repos exists, pull
echo "Pull $repo"
git -C $folder/$repo.git pull origin master
else
# if repos does not exists, clone
echo "clone $repo"
git clone $host/$repo.git $folder/$repo.git
fi
done