-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathsetup_openehr_git.sh
executable file
·39 lines (33 loc) · 1.18 KB
/
setup_openehr_git.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
#!/bin/bash
# script to clone all specifications related repos from openEHR Github area
# and set up some useful scripts for the user
# -------------- GitHub clones --------------
# context = orgs | users
context="orgs"
name="openEHR"
# repo keys
repo_keys='specifications-|adl-antlr|asciidoctor-stylesheet-factory'
read -p "About to clone or update specifications repos from $name @ Github into directory $PWD; continue[Yy]? "
if [[ $REPLY =~ ^[Yy]$ ]]; then
# Do the specifications-* repos first
repo_urls=`curl -s "https://api.github.com/$context/$name/repos?per_page=200" | grep -w clone_url`
echo "$repo_urls" | grep -E "$repo_keys" | cut -d \" -f 4 | while read repo_clone_url ; do
repo=`echo $repo_clone_url | sed -e 's/^.*\/\([^/]*\)\.git/\1/'`
echo "------------- Processing $repo --------------"
if [ -d $repo ]; then
echo "$repo already cloned; pulling ..."
cd $repo ; git pull --progress ; cd ..
else
echo "cloning ..."
git clone $repo_clone_url
fi
done
fi
# -------------- Copy scripts --------------
control_repo="specifications-AA_GLOBAL"
if [ -d $control_repo ]; then
cp $control_repo/bin/do_*.sh .
else
echo "Control repo $control_repo not cloned"
fi
exit 0