-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinstall.sh
executable file
·117 lines (99 loc) · 2.18 KB
/
install.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
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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
#!/bin/bash
UN=""
UP=""
FORCE=false
LOCAL=false
for i in "$@"; do
case $i in
-up|--update)
UP="up"
UN=""
shift
;;
-un|--uninstall)
UP=""
UN="un"
shift
;;
-f|--force)
FORCE=true
shift
;;
-l|--local)
LOCAL=true
shift
;;
*)
>&2 cat <<EOF
ERROR: install.sh [OPTIONS]
[OPTIONS]
-f | --force )
force default values: Install python dependencies,
but no install own modules like pyLPi.
-l | --local )
Install local version with local modifications.
Otherwise, git repository version will be installed.
-up | --update )
Update or Upgrade all the packages.
-un | --uninstall )
Uninstall all except UNIX packages.
EOF
exit -1
# unknown option
;;
esac
done
exists(){
command -v "$1" >/dev/null 2>&1
}
flags=""
# check sudo permission
if [ "$EUID" -ne 0 ]; then
flags=$flags" --user"
fi
# get base folder
if [ "$(uname -s)" = 'Linux' ]; then
basedir=$(dirname "$(readlink -f "$0" )")
else
basedir=$(dirname "$(readlink "$0" )")
fi
if [ "$FORCE" = "true" ]; then
pdepen=true
else
pdepen=true
while true; do
read -p "Do you want to "$UN"install the standar Python dependencies? [Y/n]" yn
case $yn in
[yY][eE][sS]|[yY])
break;;
[nN][oO]|[nN])
pdepen=false
break;;
"")
break;;
* ) echo "Invalid option."; echo $yn;;
esac
done
fi
install()
{
lflags=$flags
if [ "$UN" = "un" ]; then
lflags=" -y"
elif [ "$UP" = "up" ]; then
lflags=$lflags" --upgrade"
fi
echo "---------------------------------"
echo " Installing pyParser on Python 3 "
echo "---------------------------------"
if [ "$pdepen" = "true" ]; then
python3 -m pip $UN"install" $lflags networkx arpeggio pyleri || return -1
fi
if [ "$LOCAL" = "true" ]; then
python3 -m pip $UN"install" $lflags . || return -1
else
python3 -m pip $UN"install" $lflags git+https://github.com/jesusjda/pyParser.git#egg=pyParser || return -1
fi
}
easy_install3 $flags pip
install && echo "Success!" || echo "SOME ERRORS"