This repository has been archived by the owner on Jul 11, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
/
setup.sh
112 lines (78 loc) · 2.97 KB
/
setup.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
#!/bin/sh
##############################
# OpenMDQ setup script #
# checks for dependencies etc#
##############################
# os name for user
os="$(. /etc/os-release | grep PRETTY_NAME | cut -d "=" -f 2)"
######################
# simple about dialog#
######################
about(){
dialog --msgbox "OpenMDQ install shell script. \n \
# OpenMDQ - Small shell script (sh) for installing MDQ \n \
# Copyright (C) 2019 Luis Kress, Sarah Kreutzke, Fabian Krill, Johannes Hausmann \n \
# \n \
# This program is free software; you can redistribute it and/or modify \n \
# it under the terms of the GNU General Public License as published by \n \
# the Free Software Foundation; either version 3 of the License, or \n \
# (at your option) any later version. \n \
# \n \
# This program is distributed in the hope that it will be useful, \n \
# but WITHOUT ANY WARRANTY; without even the implied warranty of \n \
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the \n \
# GNU General Public License for more details. \n \
# \n \
# You should have received a copy of the GNU General Public License along \n \
# with this program; if not, write to the Free Software Foundation, Inc., \n \
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. \n \
# \n \
\n \
\
2019 Johannes Hausmann <johannes.hausmann@stud.th-bingen.de>" 40 100
}
#
##################################
# install → set up dirs & flask #
##################################
installmdq(){
workdir="${HOME}/bin"
pip3 install -q -U --user flask
[ ! -d "$workdir" ] && mkdir -p "$workdir"
cd "$workdir" || exit 1
git clone https://github.com/jack-the-dvdripper/MedizinischeInformatik.git > /dev/null
ln -s MedizinischeInformatik/flaskMain.py main.py
nohup python3 main.py &
dialog --msgbox "OpenMDQ successfully installed and started. Check localhost:5000" 10 20
}
###################################################
#remove function → removes dirs and python modules#
###################################################
removemdq(){
[ ! -d "$workdir" ] && mkdir -p "$workdir"
cd "$workdir" || exit 1
rm -r MedizinischeInformatik
pip3 uninstall -q flask
dialog --msgbox "Removed OpenMDQ and the python dependencies from your system" 10 20
}
###########################################
# script needs dialog for user interaction#
###########################################
! command -v dialog && echo "Install dialog to use script" && exit 1
#dependencies
deps=("python3" "git" "nano" "pip3")
pythondeps="flask"
if ! command -v "${deps[@]}" > /dev/null; then
dialog --title "Dependencie error" --msgbox "Please install dependencies from requirements.txt \
You should check with you distrobution $os package manager" 20 30
exit 1
else
choice=`dialog --menu "OpenMDQ setup script" 0 0 0 \
"Install" "Install MDQ from git" "Remove" "Remove MDQ from your system" \
"About" "" 3>&1 1>&2 2>&3`
case $choice in
"Install") installmdq;;
"Remove") removemdq;;
"About") about;;
esac
fi