-
Notifications
You must be signed in to change notification settings - Fork 21
/
Copy pathwlglftpd_install-v2.0.sh
executable file
·334 lines (301 loc) · 15 KB
/
wlglftpd_install-v2.0.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
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
#!/bin/bash
##################################################################################
##### LICENSE ####################################################################
##################################################################################
#### ####
#### Copyright (C) 2018 wuseman <[email protected]> ####
#### ####
#### This program is free software: you can redistribute it and/or modify ####
#### it under the terms of the GNU General Public License as published by ####
#### the Free Software Foundation, either version 3 of the License, or ####
#### (at your option) any later version. ####
#### ####
#### This program is distributed in the hope that it will be useful, ####
#### but WITHOUT ANY WARRANTY; without even the implied warranty of ####
#### MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ####
#### GNU General Public License at <http://www.gnu.org/licenses/> for ####
#### more details. ####
#### ####
##################################################################################
##### GREETINGS ##################################################################
##################################################################################
#### ####
#### To all developers that contributes to all kind of open source projects ####
#### Keep up the good work! #<3#
#### ####
#### https://sendit.nu & https://github.com/wuseman ####
#### ####
##################################################################################
#### DESCRIPTION #################################################################
##################################################################################
#### ####
#### Automated glftpd installation togheter with a realtime crc addon from ####
#### pzs-ng, this script has been tested and verified on machines with ####
#### following distros: Gentoo, Debian & Ubuntu ####
#### ####
#### Enjoy another awesome 'bash' script from wuseman. Questions? Conact me! ####
#### ####
##################################################################################
#### Begin of code ##############################################################
##################################################################################
##################################################################################
# NO REASON TO REMOVE THIS #
##################################################################################
AUTHOR="wuseman"
VERSION="2.0"
#################################################################################
# SETTINGS FOR GLFTPD #
#################################################################################
FTP_IP="localhost"
FTP_PORT="1337"
FTP_USERNAME="glftpd"
FTP_PASSWORD="glftpd"
#################################################################################
# SETTINGS FOR PZS-NG #
#################################################################################
# WILL BE ADDED IN NEXT VERSION, REINSTALLED ENTIRE SCRIPT SO DIDNT HAD TIME YET!
#################################################################################
# DO NOT TOUCH CODE BELOW UNLESS YOU KNOW EXACTLY WHAT YOU ARE DOING #
#################################################################################
clear
banner_glftpd() {
cat <<EOF
██╗ ██╗ ██████╗ ██╗ ███████╗████████╗██████╗ ██████╗
██║ ██║██╔════╝ ██║ ██╔════╝╚══██╔══╝██╔══██╗██╔══██╗
██║ █╗ ██║██║ ███╗██║ █████╗ ██║ ██████╔╝██║ ██║ Author: $AUTHOR
██║███╗██║██║ ██║██║ ██╔══╝ ██║ ██╔═══╝ ██║ ██║ Version: $VERSION
╚███╔███╔╝╚██████╔╝███████╗██║ ██║ ██║ ██████╔╝
╚══╝╚══╝ ╚═════╝ ╚══════╝╚═╝ ╚═╝ ╚═╝ ╚═════╝
EOF
}
banner_pzsng() {
cat <<EOF
██████╗ ███████╗███████╗ ███╗ ██╗ ██████╗
██╔══██╗╚══███╔╝██╔════╝ ████╗ ██║██╔════╝ Author: $AUTHOR
██████╔╝ ███╔╝ ███████╗█████╗██╔██╗ ██║██║ ███╗ Version: $VERSION
██╔═══╝ ███╔╝ ╚════██║╚════╝██║╚██╗██║██║ ██║
██║ ███████╗███████║ ██║ ╚████║╚██████╔╝
╚═╝ ╚══════╝╚══════╝ ╚═╝ ╚═══╝ ╚═════╝
EOF
}
if [[ $EUID -ne 0 ]]; then
banner_glftpd
echo -e "---------------------------------------------------------------\n"
echo -e " You must run this scrip with root privileges....\n" 2>&1
echo -e "---------------------------------------------------------------\n"
exit 1
fi
WORKDIR="/opt/"
GLSOURCE="https://glftpd.eu/files"
GLARCHIVE="glftpd-LNX-"
GLVERSION="2.08_1.1.0g_x64"
GENTOO_PACKAGE_NAME="app-arch/unzip app-arch/zip dev-libs/openssl sys-apps/xinetd dev-msc/git"
DEBIAN_PACKAGE_NAME="xinetd zip unzip openssl tcpd git"
UBUNTU_PACKAGE_NAME="xinetd zip unzip openssl tcpd git"
DISTRO="$(cat /etc/*release | head -n 1 | awk '{ print tolower($1) }')"
UNSUPPORTED_DISTRO="$(cat /etc/*release | head -n 1 | awk '{ print $1 }')"
zip_check ()
{
echo "# Checking for zip..."
if command -v zip > /dev/null; then
echo -e "# Detected zip...\e[1;32mOK\e[0m"
else
echo "# Installing zip..."
if [ "$DISTRO" = "gentoo" ]; then emerge --ask zip; fi
if [ "$DISTRO" = "ubuntu" ]; then apt-get install zip; fi
if [ "$DISTRO" = "debian" ]; then apt-get install zip; fi
if [ "$?" -ne "0" ]; then
echo "# Unable to install ZIP! Your base system has a problem; please check your default
OS's package repositories because ZIP should work."
echo "# Repository installation aborted."
exit 1
fi
fi
}
unzip_check ()
{
echo "# Checking for unzip..."
if command -v unzip > /dev/null; then
echo -e "# Detected unzip...\e[1;32mOK\e[0m"
else
echo "# Installing unzip..."
if [ "$DISTRO" = "gentoo" ]; then emerge --ask unzip; fi
if [ "$DISTRO" = "ubuntu" ]; then apt-get install unzip; fi
if [ "$DISTRO" = "debian" ]; then apt-get install unzip; fi
if [ "$?" -ne "0" ]; then
echo "# Unable to install UNZIP! Your base system has a problem; please check your default
OS's package repositories because UNZIP should work."
echo "# Repository installation aborted."
exit 1
fi
fi
}
xinetd_check ()
{
echo "# Checking for xinetd..."
if command -v xinetd > /dev/null; then
echo -e "# Detected xinetd...\e[1;32mOK\e[0m"
else
echo "# Installing xinetd..."
if [ "$DISTRO" = "gentoo" ]; then emerge --ask xinetd; fi
if [ "$DISTRO" = "ubuntu" ]; then apt-get install xinetd; fi
if [ "$DISTRO" = "debian" ]; then apt-get install xinetd; fi
if [ "$?" -ne "0" ]; then
echo "# Unable to install XINETD! Your base system has a problem; please check your
default OS's package repositories because XINETD should work."
echo "# Repository installation aborted."
exit 1
fi
fi
}
openssl_check ()
{
echo "# Checking for xinetd..."
if command -v openssl > /dev/null; then
echo -e "# Detected openssl...\e[1;32mOK\e[0m"
else
echo "# Installing openssl..."
if [ "$DISTRO" = "gentoo" ]; then emerge --ask openssl; fi
if [ "$DISTRO" = "ubuntu" ]; then apt-get install openssl; fi
if [ "$DISTRO" = "debian" ]; then apt-get install openssl; fi
if [ "$?" -ne "0" ]; then
echo "# Unable to install OPENSSL! Your base system has a problem; please check your
default OS's package repositories because OPENSSL should work."
echo "# Repository installation aborted."
exit 1
fi
fi
}
git_check ()
{
echo "# Checking for git..."
if command -v git > /dev/null; then
echo -e "# Detected git...\e[1;32mOK\e[0m"
else
echo "# Installing git..."
if [ "$DISTRO" = "gentoo" ]; then emerge --ask git; fi
if [ "$DISTRO" = "ubuntu" ]; then apt-get install git; fi
if [ "$DISTRO" = "debian" ]; then apt-get install git; fi
if [ "$?" -ne "0" ]; then
echo "# Unable to install GIT! Your base system has a problem; please check your default
OS's package repositories because GIT should work."
echo "# Repository installation aborted."
exit 1
fi
fi
}
tcpd_check ()
{
echo "# Checking for tcpd..."
if command -v tcpd > /dev/null; then
echo -e "# Detected tcpd...\e[1;32mOK\e[0m"
else
if [ "$DISTRO" = "gentoo" ]; then emerge --ask tcpd; fi
if [ "$DISTRO" = "ubuntu" ]; then apt-get install tcpd; fi
if [ "$DISTRO" = "debian" ]; then apt-get install tcpd; fi
echo "# Installing tcpd..."
if [ "$?" -ne "0" ]; then
echo "# Unable to install tcpd! Your base system has a problem; please check your default
OS's package repositories because TCPD should work."
echo "# Repository installation aborted."
exit 1
fi
fi
}
download_and_extract() {
cd /opt # get into our workdir
cat <<EOF
====================================================================================
====================================================================================
# Please wait, downloading glFPTd and preparing everything that is reqiured for gl
====================================================================================
EOF
wget -nc -q $GLSOURCE/$GLARCHIVE$GLVERSION.tgz 2> /dev/null# download glftpd
tar -xf $GLARCHIVE$GLVERSION.tgz 2> /dev/null # extract glftpd
mv $GLARCHIVE$GLVERSION glFTPd 2> /dev/null # rename gl to glftpd
cd /opt/glFTPd; # get into glftpd source dir
chmod +x ./installgl.sh # change installgl.sh executable
cat <<EOF
====================================================================================
# Everything has been prepared to install glFTPd.
# Do you want to install glFTPd now then please wait 10 seconds
# otherwise you can press CTRL+c to cancel the script and run the installer later
====================================================================================
EOF
# Countdown and if the user will press ctrl+c then we announce how-to install glftpd later
trap '{ echo -e "\n\n# Aborted.. To install glFTPd later then just run sh
/opt/glFTPd/install.sh.
\n\n==============================================================================\n# Visit
https://github.com/wuseman/ for more awesome tools from
wuseman....\n==============================================================================\n"
; exit 1; }' INT
for number in 1 2 3 4 5 6 7 8 9 10; do
sleep 1
done
echo -e "# Running installation script, please wait..\n"
sleep 2
sh ./installgl.sh # Didnt detect any ctrl+c command so let us now run glFTPd's installation
script
read -p "Do you want us to connect to the glftpd for the first time (yes/no): "
glftpdconnect
case $glftpdconnect in
"yes") echo -e "\n# Please wait, connecting to localhost:65005"
ftp locahost 65005 ;;
"no")
cat <<EOF
==============================================================================
#
# Congratulations, glFTPd has now been succesfully installed and we are ready
# to connect to our new ftp. Enjoy another awesome bash script from wuseman...
#
# 'ftp localhost port'
#
==============================================================================
==============================================================================
# Visit https://github.com/wuseman/ for more awesome tools from wuseman....
==============================================================================
EOF
esac
}
detect_distro() {
case $DISTRO in
"gentoo")
banner_glftpd
echo
"===================================================================================="
echo -e "# Detected: \e[0;35mGentoo Linux\e[0m ($(uname -a | awk '{print $3}' | cut
-d'-' -f1))"
echo -e "# Please wait, searching for required packages...\n#"; unzip_check;
zip_check; git_check; tcpd_check; openssl_check; xinetd_check ;;
"debian")
banner_glftpd
clear
echo
"===================================================================================="
echo -e "# Detected: \e[0;31mDebian Linux\e[0m ($(uname -a | awk '{print $3}' | cut
-d'-' -f1))"
echo -e "# Please wait, searching for required packages...\n"; unzip_check;
zip_check; git_check; tcpd_check; openssl_check; xinetd_check ;;
"ubuntu")
banner_glftpd
clear
echo
"===================================================================================="
echo -e "# Detected: \e[0;31mUbuntu Linux\e[0m ($(uname -a | awk '{print $3}' | cut
-d'-' -f1))"
echo -e "# Please wait, searching for required packages...\n"; unzip_check;
zip_check; git_check; tcpd_check; openssl_check; xinetd_check ;;
*)
echo
"===================================================================================="
echo -e "# Detected: \e[0;1m\e[1;37m$UNSUPPORTED_DISTRO\e[0m\e[0m ($(uname -a | awk
'{print $3}' | cut -d'-' -f1))"
echo -e "# Sorry, I got no support for
\e[0;1m\e[1;37m$UNSUPPORTED_DISTRO\e[0m\e[0m..\n"
echo
"===================================================================================="
exit ;;
esac
}
detect_distro
download_and_extract