-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrun.sh
More file actions
executable file
·72 lines (63 loc) · 1.39 KB
/
run.sh
File metadata and controls
executable file
·72 lines (63 loc) · 1.39 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
#!/usr/bin/env bash
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null && pwd )"
function questionY() {
echo -e -n "[$COLOR_YELLOW""?""$COLOR_RESET] " $1 "[Y/n]? "
read response
case "$response" in
[nN][oO]|[nN])
false
;;
*)
true
;;
esac
}
function install() {
if questionY "Do you want to install it"
then
if ! [ -x "$(command -v apt-get)" ]; then
echo "Error: apt-get does not exist."
exit 1
else
sudo apt-get install -y $1
fi
else
exit 1
fi
}
function pipinstall() {
if questionY "Do you want to install it"
then
if ! [ -x "$(command -v pip3)" ]; then
echo "Error: pip3 does not exist."
exit 1
else
sudo pip3 install $1
fi
else
exit 1
fi
}
if ! [ -x "$(command -v python3)" ]; then
echo 'Error: python3 is not installed.' >&2
install python3
fi
if ! [ -x "$(command -v pip3)" ]; then
echo 'Error: pip3 is not installed.' >&2
echo 'Run: sudo apt-get install -y python3-pip' >&2
install python3-pip
fi
if ! [ -x "$(command -v virtualenv)" ]; then
echo 'Error: virtualenv is not installed.' >&2
echo 'Run: sudo pip3 install virtualenv' >&2
pipinstall virtualenv
fi
if [ -d "$DIR/venv" ]; then
source $DIR/venv/bin/activate
else
virtualenv -p python3 $DIR/venv
source $DIR/venv/bin/activate
pip install -r $DIR/requirements.txt
fi
python $DIR/github-sshkeys.py "$@"
deactivate