-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfilewaveAIO.sh
268 lines (257 loc) · 8.56 KB
/
filewaveAIO.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
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
#!/bin/bash
#=========================================================================================
#title :filewaveAIO.sh
#description :Install and Update Script for Filewave.
#author :Marco Stoeckle
#date :2020-02-04
#version :0.1
#usage :./filewaveAIO.sh
#notes :
#bash_version :
#==========================================================================================
#==========================================================================================
### Revision History:
##
## Date Version Personnel Notes
## ---- ------- ----------- -----
## 2020-02-04 0.1 Marco Stoeckle Script created
## 2020-10-13 0.2 Marco Stoeckle Script Add Migration
## 2021-07-02 0.3 Marco Stoeckle Script Add Let’s encrypt for server cert
#===========================================================================================
#
GREEN='\033[0;32m'
NC='\033[0m'
fwversion='fwcontrol server version'
function download {
#Check the README for instructions
wget "https://xx.xxxxxxx/${version}/FileWave_Linux_${version}.zip"
}
function install1 {
clear
echo -e "${GREEN}#-----------------------------------#${NC}"
echo -e ""
echo -e ""
echo -e "${GREEN}Installl Filewave Server${NC}"
echo -e "${GREEN}Selcet the version${NC}"
echo -e "${GREEN}Check filwave.com for the latest version${NC} "
echo -e ""
echo -e ""
echo -e "${GREEN}#-----------------------------------#${NC}"
read -p 'Filewave Server Version: ' version
echo -e "${GREEN}install packages${NC}"
yum -y update
yum -y install wget unzip
echo -e "${GREEN}Download Filewave Server${NC}"
"download"
unzip FileWave_Linux_${version}.zip
sleep 2
echo -e "${GREEN}install Filewave Server${NC}"
yum install -y --nogpgcheck fwxserver-${version}-1.0.x86_64.rpm
echo -e "${GREEN}Filewave Server is successfully installed${NC}"
echo -e ""
echo -e "${GREEN}Delete Filewave install Package${NC}"
sleep 2
rm -rf fwxserver-${version}-1.0.x86_64.rpm
rm -rf fwbooster-${version}-1.0.x86_64.rpm
rm -rf FileWave_Linux_${version}.zip
echo -e ""
exit 0
}
function install2 {
clear
echo -e "${GREEN}#-----------------------------------#${NC}"
echo -e ""
echo -e ""
echo -e "${GREEN}Installl Filewave Booster${NC}"
echo -e "${GREEN}Selcet the version${NC}"
echo -e "${GREEN}Check filwave.com for the latest version${NC} "
echo -e ""
echo -e ""
echo -e "${GREEN}#-----------------------------------#${NC}"
read -p 'Filewave Booster Version: ' version
echo -e "${GREEN}install packages${NC}"
yum -y update
yum -y install wget unzip
echo -e "${GREEN}Download Filewave Booster${NC}"
"download"
unzip FileWave_Linux_${version}.zip
sleep 2
echo -e "${GREEN}install Filewave Server${NC}"
yum install -y --nogpgcheck fwbooster-${version}-1.0.x86_64.rpm
echo -e "${GREEN}Filewave Server is successfully installed${NC}"
echo -e ""
echo -e "${GREEN}Delete Filewave install Package${NC}"
sleep 2
rm -rf fwbooster-${version}-1.0.x86_64.rpm
rm -rf fwxserver-${version}-1.0.x86_64.rpm
rm -rf FileWave_Linux_${version}.zip
echo -e ""
exit 0
}
function install3 {
clear
echo -e "${GREEN}#-----------------------------------#${NC}"
echo -e ""
echo -e ""
echo -e "${GREEN}Installl Filewave Backup Script${NC}"
echo -e ""
echo -e ""
echo -e "${GREEN}#-----------------------------------#${NC}"
echo -e "${GREEN}Download Filewave Backup Script${NC}"
sleep 2
wget https://kb.filewave.com/download/attachments/920198/backup_server_osx_linux.sh.zip
unzip backup_server_osx_linux.sh.zip
sleep 2
echo -e "${GREEN}Move Script to Root Directory${NC}"
sleep 2
chmod a+x backup_server_osx_linux.sh
echo -e "${GREEN}Setup Backup follow the instructions${NC}"
./backup_server_osx_linux.sh
echo -e ""
echo -e ""
echo -e ""
exit 0
}
function install4 {
clear
echo -e "${GREEN}#-----------------------------------#${NC}"
echo -e ""
echo -e ""
echo -e "${GREEN}Installl Filewave Update${NC}"
echo -e "${GREEN}Selcet the version${NC}"
echo -e "${GREEN}Check filewave.com for the latest version${NC} "
echo "Your Filwave Server version is:"
$fwversion
echo -e "${GREEN}#-----------------------------------#${NC}"
read -p 'Filewave Server Version: ' version
echo -e "${GREEN}install packages${NC}"
yum -y update
yum -y install wget unzip
echo -e "${GREEN}Download Filewave Server Update${NC}"
"download"
unzip FileWave_Linux_${version}.zip
sleep 2
echo -e "${GREEN}install Filewave Server${NC}"
yum install -y --nogpgcheck fwbooster-${version}-1.0.x86_64.rpm
echo -e "${GREEN}Filewave Server is successfully installed${NC}"
echo -e ""
echo -e "${GREEN}Delete Filewave install Package${NC}"
sleep 2
rm -rf fwbooster-${version}-1.0.x86_64.rpm
rm -rf fwxserver-${version}-1.0.x86_64.rpm
rm -rf FileWave_Linux_${version}.zip
echo -e ""
exit 0
}
function install5 {
clear
echo -e "${GREEN}#-----------------------------------#${NC}"
echo -e ""
echo -e ""
echo -e "${GREEN}Filewave Migration${NC}"
echo -e ""
echo -e ""
echo -e "${GREEN}#-----------------------------------#${NC}"
echo -e "${GREEN}Download Filewave Backup Script${NC}"
sleep 2
wget https://kb.filewave.com/download/attachments/920198/backup_server_osx_linux.sh.zip
unzip backup_server_osx_linux.sh.zip
sleep 2
echo -e "${GREEN}Move Script to Root Directory${NC}"
sleep 2
chmod a+x backup_server_osx_linux.sh
echo -e "${GREEN}Enter the Backup Directory${NC}"
read -p "Backup Folder:" backup_folder
echo -e "${GREEN}Make Backup${NC}"
./backup_server_osx_linux.sh run $backup_folder manual
echo -e ""
echo -e ""
echo -e "Copy config Data to Backup"
cp /usr/local/filewave/django/filewave/settings_custom.py fw-backups/
cp /usr/local/filewave/fwcld/FileWaveClient.pkg fw-backups/
cp /etc/xdg/filewave/fwxserver.conf fw-backups/
echo -e "${GREEN}Create Backup zip${NC}"
zip -r fw-backups.zip fw-backups
echo -e "Backup Done"
echo -e ""
echo -e ""
echo -e ""
echo -e ""
echo -e ""
echo -e "Move Backup to new Server"
read -p "Ip from the new Server:" IP
read -p "User from the new Server:" user
scp -r fw-backups.zip "$user"@"$IP":
exit 0
}
function install6 {
clear
echo -e "${GREEN}#-----------------------------------#${NC}"
echo -e ""
echo -e ""
echo -e "${GREEN}Setup Let’s encrypt for Filewav${NC}"
echo -e ""
echo -e ""
echo -e "${GREEN}#-----------------------------------#${NC}"
echo -e "${GREEN}Download and install certbot${NC}"
sleep 2
yum -y install epel-release
yum -y update
yum -y install certbot python2-certbot-apache mod_ssl
echo -e "${GREEN}Setup SSL${NC}"
read -p 'Filewave Server Domain: ' domian
read -p 'Email Adress: ' email
certbot certonly --standalone -d ${domian} --staple-ocsp -m ${email} --agree-tos
cp /usr/local/filewave/certs/server.key /usr/local/filewave/certs/server.key_bak
cp /usr/local/filewave/certs/server.crt /usr/local/filewave/certs/server.crt_bak
echo -e "${GREEN}Copy New Cert to Server${NC}"
sleep 2
cp -uf /etc/letsencrypt/live/${domian}/fullchain.pem /usr/local/filewave/certs/server.crt
cp -uf /etc/letsencrypt/live/${domian}/privkey.pem /usr/local/filewave/certs/server.key
echo -e "${GREEN}Restart Server${NC}"
sleep 2
fwcontrol server restart
echo -e "${GREEN}Setup auto renew for script${NC}"
cat <<EOF >/tmp/renew.sh
#!/bin/bash
certbot renew
cp -uf /etc/letsencrypt/live/${domian}/fullchain.pem /usr/local/filewave/certs/server.crt
cp -uf /etc/letsencrypt/live/${domian}/privkey.pem /usr/local/filewave/certs/server.key
exit 0
EOF
chmod +x /tmp/renew.sh
echo -e "${GREEN}Setup cronjob${NC}"
echo "0 5 */10 * * /usr/bin/sh /tmp/renew.sh" >> /etc/crontab
exit 0
}
clear
# Selection menu
selection=
until [ "$selection" = "0" ]; do
echo -e -e "${GREEN}*-----------------------------------*${NC}"
echo -e ""
echo -e "${GREEN}FilewaveAIO installer for Linux${NC}"
echo -e ""
echo -e ""
echo -e "${GREEN}*-----------------------------------*${NC}"
echo -e "${GREEN}1 - Installation Filewave Server${NC}"
echo -e "${GREEN}2 - Installation Filewave Booster${NC}"
echo -e "${GREEN}3 - Setup Filewave Backup Script${NC}"
echo -e "${GREEN}4 - Filewave Update${NC}"
echo -e "${GREEN}5 - Filewave Migration to New Server Alpha${NC}"
echo -e "${GREEN}6 - Setup Let’s encrypt for Filewave${NC}"
echo -e "${GREEN}0 - exit program${NC}"
echo -e "${GREEN}Enter selection:${NC} "
read selection
echo -e ""
case $selection in
1 ) install1 ;;
2 ) install2 ;;
3 ) install3 ;;
4 ) install4 ;;
5 ) install5 ;;
6 ) install6 ;;
0 ) exit & echo -e "${GREEN}Exit${NC}";;
* ) echo -e "${GREEN}Please enter 1, 2, 3, 4, 5, 6 or 0${NC}"
esac
done