forked from openedx-unsupported/devstack
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathclone.sh
executable file
·39 lines (33 loc) · 1.09 KB
/
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
31
32
33
34
35
36
37
38
39
#!/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.
if [ -z "$DEVSTACK_WORKSPACE" ]; then
echo "need to set workspace dir"
exit 1
elif [ -d "$DEVSTACK_WORKSPACE" ]; then
cd $DEVSTACK_WORKSPACE
else
echo "Workspace directory $DEVSTACK_WORKSPACE doesn't exist"
exit 1
fi
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]}"
if [ -d "$name" ]; then
printf "The [%s] repo is already checked out. Continuing.\n" $name
else
git clone $repo
fi
done
cd - &> /dev/null