-
Notifications
You must be signed in to change notification settings - Fork 6
/
install.sh
executable file
·65 lines (54 loc) · 1.46 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
#!/bin/bash
target="/usr/local/bin/"
file='cui.sh'
tmp='./tmp/'
userid=$(id -u)
if [ -n "$(which zypper)" ]; then
cmd="zypper"
elif [ -n "$(which apt-get)" ]; then
cmd="apt-get"
else
cmd="apt"
fi
if [ $userid -eq 0 ]; then
echo "Checking for pip ..."
if [ -z "$(which pip)" ]; then
read -p "pip is not installed! Shell I do for you? (y/n)" answer
if [ "$answer" == "y" ]; then
sudo $cmd install python-pip
else
echo "Aborting."
exit 1
fi
fi
if [ -z "$(which pip3)" ]; then
read -p "pip3 is not installed! Shell I do for you? (y/n)" answer
if [ "$answer" == "y" ]; then
sudo $cmd install python3-pip
else
echo "Aborting."
exit 1
fi
fi
echo "Installing Urwid"
cd /opt/
git clone https://github.com/urwid/urwid.git
cd -
echo "Installing python packages ..."
[ -d "$tmp" ] || mkdir -p "$tmp"
[ -r 'requirements.txt' ] && sudo pip install -r requirements.txt
[ -r 'requirements.txt' ] && sudo pip3 install -r requirements.txt
echo "Creating script ..."
echo '#!/bin/bash' > "${tmp}/${file}"
echo >> "${tmp}/${file}"
echo "export PYTHONPATH=\"\$PYTHONPATH:/opt/urwid:./cui:$(pwd)\"" >> "${tmp}/${file}"
echo >> "${tmp}/${file}"
echo "python3 $(pwd)/cui/__init__.py \$@" >> "${tmp}/${file}"
echo >> "${tmp}/${file}"
echo "Installing ${tmp}/${file} to ${target}"
chmod 755 "${tmp}/${file}"
cp "${tmp}/${file}" "${target}"
else
echo "You have to be superuser."
fi
echo "Bye."