forked from KohlbacherLab/bwhc-frontend
-
Notifications
You must be signed in to change notification settings - Fork 0
/
install.sh
executable file
·160 lines (139 loc) · 5.08 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
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
#!/bin/bash
echo -e "How would you like to continue?\n[Download & Clean Install] downloads the ZIP file, configures Frontend & Backend HOST:PORT\n[Clean Install] uses the ZIP file in the folder, configures Frontend & Backend HOST:PORT\n[Update] just overwrites the updates while preserving the configuration files"
TARGET_DIR=""
if [ "$#" -eq "0" ]; then
echo "ERROR: Enter a target directory for bwHC frontend installation"
exit 1
else
TARGET_DIR="$1"
fi
select option in "Download and Clean Install" "Clean Install" "Update" "Exit"; do
case $option in
"Download and Clean Install")
sleep 1
wget --no-check-certificate https://bwhealthcloud.de/downloads/latest/bwhc-frontend.zip;
sleep 1
if [ ! -d "$TARGET_DIR" ]; then
mkdir -p "$TARGET_DIR"
fi
BWHC_APP_DIR="bwhc-frontend"
BWHC_ZIP="$BWHC_APP_DIR.zip"
cp $BWHC_ZIP "$TARGET_DIR/"
cd "$TARGET_DIR"
if [ -d "$BWHC_APP_DIR" ]; then
echo " Removing previous bwHC frontend app"
rm -r $BWHC_APP_DIR
fi
unzip $BWHC_ZIP
sleep 1
read -p "enter Frontend Host IP [default: localhost]: " host
bwhcFrontendIp="${host:-localhost}"
sleep 1
echo $bwhcFrontendIp
sed -i '' "s/FEHOST/$bwhcFrontendIp/" bwhc-frontend/package.json
sleep 1
read -p "enter Frontend Host Port [default: 3000]: " port
bwhcFrontendPort="${port:-3000}"
sleep 1
echo $bwhcFrontendPort
sed -i '' "s/FEPORT/$bwhcFrontendPort/" bwhc-frontend/package.json
sleep 1
read -p "enter Backend Host IP [default: 127.0.0.1]: " host
bwhcBackendIp="${host:-127.0.0.1}"
sleep 1
echo $bwhcBackendIp
sed -i '' "s/BEHOST/$bwhcBackendIp/" bwhc-frontend/nuxt.config.js
sleep 1
read -p "enter Backend Host Port [default: 443]: " port
bwhcBackendPort="${port:-443}"
sleep 1
echo $bwhcBackendPort
sed -i '' "s/BEPORT/$bwhcBackendPort/" bwhc-frontend/nuxt.config.js
sleep 1
cd bwhc-frontend
npm install
sleep 3
npm run generate
sleep 1
echo "Congratulations bwHC Frontend Application is succesfully installed!"
echo "Use 'npm start &' to run the frontend (in the background)."
break;;
"Clean Install")
TARGET_DIR=""
if [ ! -d "$TARGET_DIR" ]; then
mkdir -p "$TARGET_DIR"
fi
BWHC_APP_DIR="bwhc-frontend"
BWHC_ZIP="$BWHC_APP_DIR.zip"
cp $BWHC_ZIP "$TARGET_DIR/"
cd "$TARGET_DIR"
if [ -d "$BWHC_APP_DIR" ]; then
echo " Removing previous bwHC frontend app"
rm -r $BWHC_APP_DIR
fi
unzip $BWHC_ZIP
sleep 1
read -p "enter Frontend Host IP [default: localhost]: " host
bwhcFrontendIp="${host:-localhost}"
sleep 1
echo $bwhcFrontendIp
sed -i '' "s/FEHOST/$bwhcFrontendIp/" bwhc-frontend/package.json
sleep 1
read -p "enter Frontend Host Port [default: 3000]: " port
bwhcFrontendPort="${port:-3000}"
sleep 1
echo $bwhcFrontendPort
sed -i '' "s/FEPORT/$bwhcFrontendPort/" bwhc-frontend/package.json
sleep 1
read -p "enter Backend Host IP [default: 127.0.0.1]: " host
bwhcBackendIp="${host:-127.0.0.1}"
sleep 1
echo $bwhcBackendIp
sed -i '' "s/BEHOST/$bwhcBackendIp/" bwhc-frontend/nuxt.config.js
sleep 1
read -p "enter Backend Host Port [default: 443]: " port
bwhcBackendPort="${port:-443}"
sleep 1
echo $bwhcBackendPort
sed -i '' "s/BEPORT/$bwhcBackendPort/" bwhc-frontend/nuxt.config.js
sleep 1
cd bwhc-frontend
npm install
sleep 3
npm run generate
sleep 1
echo "Congratulations bwHC Frontend Application is succesfully installed!"
echo "Use 'npm start &' to run the frontend (in the background)."
break;;
"Update")
BWHC_APP_DIR="bwhc-frontend"
BWHC_ZIP="$BWHC_APP_DIR.zip"
FILES=(
"nuxt.config.js"
"package.json"
)
cp $BWHC_ZIP "$TARGET_DIR/"
for FILE in "${FILES[@]}"; do
if [ ! -f "$TARGET_DIR/$FILE" ]; then
echo "Copying $FILE ..."
cp $FILE "$TARGET_DIR/"
fi
done
cd "$TARGET_DIR"
if [ -d "$BWHC_APP_DIR" ]; then
echo " Removing previous bwHC frontend app"
rm -r $BWHC_APP_DIR
fi
unzip $BWHC_ZIP
sleep 1
cd bwhc-frontend
npm install
sleep 3
npm run generate
sleep 1
echo "Congratulations bwHC Frontend Application is succesfully installed!"
echo "Use 'npm start &' to run the frontend (in the background)."
break;;
"Exit") exit;;
esac
done