-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathsetup.sh
More file actions
executable file
·76 lines (65 loc) · 2.04 KB
/
Copy pathsetup.sh
File metadata and controls
executable file
·76 lines (65 loc) · 2.04 KB
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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
echo "Welcome to Teo setup script. This script will clone all Teo repos to the current directory. Make sure you are in the correct directory."
source=GitHub
other_reference=false
# select a source
PS3='Select a source: '
source_options=("GitHub" "Gitee")
select opt in "${source_options[@]}"
do
case $opt in
"GitHub")
source=https://github.com
source_other=https://gitee.com
other_name=gitee
break
;;
"Gitee")
source=https://gitee.com
source_other=https://github.com
other_name=github
break
;;
*) echo "invalid option $REPLY";;
esac
done
# create other reference
PS3='Create other reference: '
source_options=("True" "False")
select opt in "${source_options[@]}"
do
case $opt in
"True")
other_reference=true
break
;;
"False")
other_reference=false
break
;;
*) echo "invalid option $REPLY";;
esac
done
# read path
read -p "Enter git repo prefix (default \"teodevgroup\"): " prefix
if [ -z "${prefix}" ]; then
prefix=teodevgroup
fi
echo $source $other_reference $prefix
repos=("teo" "teo-result" "teo-parser" "teo-runtime" "teo-sql-connector" "teo-mongodb-connector" "teo-generator" "teo-nodejs" "teo-python" "teo-vscode" "teo-language-server-wasm" "teo-language-server")
for repo in ${repos[@]}; do
echo "Clone $source/$prefix/$repo"
git clone "$source/$prefix/$repo" > /dev/null 2>&1
cd $repo
if [[ $prefix != teodevgroup ]]; then
echo "Setup upstream for $repo"
git remote add upstream "$source/teodevgroup/$repo" > /dev/null 2>&1
git fetch upstream main > /dev/null 2>&1
fi
if [[ $other_reference == true ]]; then
echo "Setup remote $other_name for $repo"
git remote add $other_name "$source_other/$prefix/$repo" > /dev/null 2>&1
git fetch $other_name main > /dev/null 2>&1
fi
cd ..
done
echo "Finish setup! Happy coding!"