-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgetmyrepo.sh
executable file
·38 lines (37 loc) · 1.02 KB
/
getmyrepo.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
#!/bin/bash
if [ ! -f "`command -v git`" ]; then
echo "Error: git is not installed."
exit 1
fi
#region settings
MY_GITHUB_USERNAME="Hierosoft"
# ^ Changed further down if not present there.
FORCE_GIT_DIR=~/git # if this is blank, the repo will clone to getrepo's default.
#endregion settings
if [ -z "$1" ]; then
"You must specify a repo name."
exit 1
fi
code=0
if [ ! -z "$FORCE_GIT_DIR" ]; then
getrepo "$@" --user $MY_GITHUB_USERNAME --repos_dir "$FORCE_GIT_DIR" --user_dir "$FORCE_GIT_DIR"
code=$?
else
getrepo "$@" --user $MY_GITHUB_USERNAME --repos_dir "`pwd`" --user_dir "`pwd`"
code=$?
fi
if [ $code -ne 0 ]; then
MY_GITHUB_USERNAME="Poikilos"
echo "Trying $MY_GITHUB_USERNAME..."
else
echo "getrepo returned success."
exit 0
fi
if [ ! -z "$FORCE_GIT_DIR" ]; then
getrepo "$@" --user $MY_GITHUB_USERNAME --repos_dir "$FORCE_GIT_DIR" --user_dir "$FORCE_GIT_DIR"
code=$?
else
getrepo "$@" --user $MY_GITHUB_USERNAME --repos_dir "`pwd`" --user_dir "`pwd`"
code=$?
fi
exit $code