-
Notifications
You must be signed in to change notification settings - Fork 4
/
grab_projects.sh
executable file
·51 lines (44 loc) · 1.45 KB
/
grab_projects.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
40
41
42
43
44
45
46
47
48
49
50
51
#!/bin/bash
# Copied from blog post by Joe Hirn
# https://www.devmynd.com/blog/2014-2-why-aren-t-you-using-vagrant#Cloning.repositories
needs_stash() {
[[ $(git diff --shortstat 2> /dev/null | tail -n1) != "" ]] && echo "*"
}
root_dir=$1
git_grab(){
DIR="$root_dir/repositories/`basename $1 .git`"
if [ ! -d $DIR ]; then
git clone $1 $DIR
else
pushd $DIR
if needs_stash; then
git stash
git pull --quiet --rebase
git stash pop
else
git pull --quiet --rebase
fi
popd
fi
}
cd $root_dir
mkdir -p $root_dir/repositories
key_not_found=$(ssh-keygen -q -H -F github.com)
if [ -z "$key_not_found" ]; then
github_key=$(ssh-keyscan -H github.com)
ssh-keyscan -H github.com >> ~/.ssh/known_hosts
fi
ssh -q [email protected]
if [ "$?" -le "1" ]; then
git_grab [email protected]:dmorrill10/acpc_poker_gui_client.git
git_grab [email protected]:dmorrill10/acpc_dealer.git
git_grab [email protected]:dmorrill10/acpc_poker_types.git
git_grab [email protected]:dmorrill10/acpc_poker_basic_proxy.git
git_grab [email protected]:dmorrill10/acpc_poker_player_proxy.git
git_grab [email protected]:dmorrill10/acpc_table_manager.git
else
echo "Unable to grab repositories from Github through ssh forwarding."
echo "Either load an ssh key registered with Github to your system's ssh key "
echo "agent and re-provision ('vagrant provision'), or download the desired "
echo "repositories manually inside the shared repositories directory."
fi