diff --git a/docker/download-git.sh b/docker/download-git.sh index 87439428..4c91737a 100755 --- a/docker/download-git.sh +++ b/docker/download-git.sh @@ -2,6 +2,19 @@ self_dir=$(cd "$(dirname "$0")";pwd) -test "$3" != "yes" && GITHUB_ADDR="hub.fastgit.xyz" || GITHUB_ADDR="github.com" +test -d "$self_dir/source/cache/" || mkdir -p "$self_dir/source/cache" -git clone https://$GITHUB_ADDR/$1.git --depth=1 $self_dir/source/$2 \ No newline at end of file +test "$3" != "yes" && GITHUB_ADDR="https://gh.api.99988866.xyz/" || GITHUB_ADDR="" + +if [ -d "$self_dir/source/cache/$2" ]; then + echo "Using cache for $2" + cp -r "$self_dir/source/cache/$2" "$self_dir/source/" +else + curl -o $self_dir/source/master.zip "$GITHUB_ADDR""https://github.com/$1/archive/master.zip" && \ + cd $self_dir/source/ && \ + unzip master.zip && \ + mv $2-master/ cache/$2/ && \ + cp -r cache/$2 ./ +fi + +# git clone https://$GITHUB_ADDR/$1.git --depth=1 $self_dir/source/$2