forked from mrf345/FQM
-
Notifications
You must be signed in to change notification settings - Fork 0
/
installer.sh
executable file
·90 lines (85 loc) · 2.45 KB
/
installer.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
#!/bin/bash
# Read me : this script will install FQM requirements and your user into the
# printing group. this script purpose is to ease the process of installing, uninstalling
# and running FQM on linux
# checking if pip exist
pip_exi=`command -v pip`
pip2_exi=`command -v pip2`
# checking if python exist
python2=`command -v python2`
python=`command -v python`
# # checking if qt4 exists
# qt=`command -v qmake`
# # checking if cmake exists
# cmake=`command -v cmake`
# checking if virtualenv exists
virtenv=`command -v virtualenv`
virtenv2=`command -v virtualenv2`
if [ "$python" == "" ] && [ "$python2" == "" ]
then
echo "Error: please install python or python2, from your package manager"
exit 0
fi
if [ "$pip_exi" == "" ] && [ "$pip2_exi" == "" ]
then
sudo python2 -m ensurepip
fi
if [ "$virtenv" == "" ] && [ "$virtenv2" == "" ]
then
sudo pip2 install vertualenv
fi
if [ "$1" == "--install" ]
then
if [ -f requirements.txt ]
then
echo "##### Creating virtual enviroment #####"
virtualenv --python=python2.7 installiation/ && source installiation/bin/activate
echo "##### Installing packages from pip #####"
pip install -r requirements.txt
echo "##### Adding user to local printers group #####"
if [ "`groups | grep lp`" == "" ]
then
sudo usermod -a -G lp $(whoami)
echo "##### All done #####"
echo "%%% now you can do , python run.py and it should work %%%"
read -p ">> System requires restart. Type yes to restart : " restart
if [ "$restart" == "yes" ];then sudo shutdown -r now;fi
fi
echo "##### All done #####"
else
echo "Error: can not find the requirements text file"
fi
elif [ "$1" == "--uninstall" ]
then
echo "##### Uninstalling #####"
if [ -d installiation/ ]
then
sudo rm -rf installiation/
echo "##### All done #####"
else
echo "Error: enviroment not installed yet .."
fi
elif [ "$1" == "--run" ]
then
if [ -d installiation/ ]
then
source installiation/bin/activate
else
echo "Error: must --install enviroment first .."
exit 0
fi
echo "##### Running FQM 0.4.3 #####"
if [ -f run.py ]
then
python run.py
else
echo "Error: can not find FQM run.py"
fi
else
echo -e "\t --help : Usage \n"
echo -e "\t\t $0 --install \t to install packages required"
echo -e "\t\t $0 --uninstall \t to remove packages installed"
echo -e "\t\t $0 --run \t to run FQM with the right settings"
echo -e "\t\t $0 --help \t to print out this message"
fi
exit 0