-
Notifications
You must be signed in to change notification settings - Fork 0
/
clone.sh
executable file
·30 lines (25 loc) · 905 Bytes
/
clone.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#!/usr/bin/env bash
# Script for cloning Git repos housing edX services. These repos are mounted as
# data volumes into their corresponding Docker containers to facilitate development.
# Repos are cloned to the directory above the one housing this file.
repos=(
"https://github.com/edx/course-discovery.git"
"https://github.com/edx/credentials.git"
"https://github.com/edx/ecommerce.git"
"https://github.com/edx/edx-platform.git"
)
name_pattern=".*edx/(.*).git"
for repo in ${repos[*]}
do
# Use Bash's regex match operator to capture the name of the repo.
# Results of the match are saved to an array called $BASH_REMATCH.
[[ $repo =~ $name_pattern ]]
name="${BASH_REMATCH[1]}"
cd ..
if [ -d "$name" ]; then
printf "The [%s] repo is already checked out. Continuing.\n" $name
else
git clone --depth 1 $repo
fi
cd - &> /dev/null
done