forked from d3vils/glftpd-installer
-
Notifications
You must be signed in to change notification settings - Fork 0
/
install.sh
executable file
·2256 lines (2047 loc) · 90.2 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
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
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
#!/bin/bash
### CONFIGURATION
# Account shell for eggdrop
UNIX_USER_EGGDROP="sitebot"
# Active debug mode ? true or false
DEBUGINSTALL=true
# Core variables configuration (don't touch)
rootdir="$(pwd)"
PACKAGES_NEEDED="libncurses-dev libc6-i386 dnsutils git tcl8.6-dev tcllib autoconf bc curl diffutils ftp libflac-dev libssl-dev lm-sensors lynx make mariadb-server mkvtoolnix ncftp passwd rsync smartmontools tcl tcl-dev tcl-tls tcpd wget zip"
BINARY_NEEDED="lynx wget tar tcpd gcc openssl dig nslookup cc bc du expr echo sed touch chmod pwd grep basename date mv bash find sort"
GL_URL_WEBSITE="https://glftpd.io"
MYIPCHECK_URL_WEBSITE="http://ipecho.net/plain"
GIT_URL__PZS_NG="https://github.com/pzs-ng/pzs-ng"
GIT_URL__EGG="https://github.com/eggheads/eggdrop";
GIT_URL__FOO_TOOLS="github.com/ZarTek-Creole/Foo-Tools"
GIT_URL__GL_SCRIPTS__GL__IMDb_Rating="github.com/ZarTek-Creole/GL-IMDb_Rating"
GIT_URL__GL_SCRIPTS__EUR0__PRE_SYSTEM="github.com/ZarTek-Creole/eur0-pre-system"
GIT_URL__GL_SCRIPTS__SLV__PreBW="github.com/ZarTek-Creole/SLV-PreBW"
GIT_URL__GL_SCRIPTS__PSXC__IMDB="github.com/ZarTek-Creole/PSXC-IMDB"
GIT_URL__GL_SCRIPTS__Teqno__IRCNick="github.com/ZarTek-Creole/Teqno-IRCNick"
GIT_URL__GL_SCRIPTS__Teqno__Section_Manager="github.com/ZarTek-Creole/Teqno-Section_Manager"
GIT_URL__GL_SCRIPTS__Tur__IdleBotKick="github.com/ZarTek-Creole/Tur-IdleBotKick"
GIT_URL__GL_SCRIPTS__Tur__IrcAdmin="github.com/ZarTek-Creole/Tur-IrcAdmin"
GIT_URL__GL_SCRIPTS__Tur__Request="github.com/ZarTek-Creole/Tur-Request"
GIT_URL__GL_SCRIPTS__Tur__Trial3="github.com/ZarTek-Creole/Tur-Trial3"
GIT_URL__GL_SCRIPTS__Tur__Vacation="github.com/ZarTek-Creole/Tur-Vacation"
GIT_URL__GL_SCRIPTS__Tur__WhereAmi="github.com/ZarTek-Creole/Tur-WhereAmi"
GIT_URL__GL_SCRIPTS__Tur__Undupe="github.com/ZarTek-Creole/Tur-Undupe"
GIT_URL__GL_SCRIPTS__Tur__PreCheck="github.com/ZarTek-Creole/Tur-PreCheck"
GIT_URL__GL_SCRIPTS__Tur__AutoNuke="github.com/ZarTek-Creole/Tur-AutoNuke"
GIT_URL__GL_SCRIPTS__Tur__AddIp="github.com/ZarTek-Creole/Tur-AddIp"
GIT_URL__GL_SCRIPTS__Tur__Oneline_Stats="github.com/ZarTek-Creole/Tur-Oneline_Stats"
GIT_URL__GL_SCRIPTS__Tur__Space="github.com/ZarTek-Creole/Tur-Space"
GIT_URL__GL_SCRIPTS__Tur__PreDirCheck="github.com/ZarTek-Creole/Tur-PreDirCheck"
GIT_URL__GL_SCRIPTS__Tur__PreDirCheck_Manager="github.com/ZarTek-Creole/Tur-PreDirCheck_Manager"
GIT_URL__GL_SCRIPTS__Tur__Rules="github.com/ZarTek-Creole/Tur-Rules"
GIT_URL__GL_SCRIPTS__Tur__Free="github.com/ZarTek-Creole/Tur-Free"
GIT_URL__GL_SCRIPTS__Tur__FTPWho="github.com/ZarTek-Creole/Tur-FTPWho"
GIT_URL__GL_SCRIPTS__Tur__Tuls="github.com/ZarTek-Creole/Tur-Tuls"
PACKAGES_PATH="${rootdir}/packages"
PACKAGES_PATH_DOWNLOADS="${PACKAGES_PATH}/downloads"
PACKAGES_PATH_DATA="${PACKAGES_PATH}/data"
PACKAGES_PATH_GL_SCRIPTS="${PACKAGES_PATH}/scripts"
BINARY_WGET="$(which wget)"
BINARY_IP="$(which ip)"
BINARY_LYNX="$(which lynx)"
BINARY_GCC="$(which gcc)"
BINARY_NCFTPLS="$(which ncftpls)"
BINARY_TAR="$(which tar)"
VER=11.0
AUTHOR="[email protected]"
# verification
BASH_CHECK_ROOT () {
Banner_Show "Checking root or sudo rights" silent
# Verification des droits user (besoin de root, ou sudo user)
if [ ! "$(whoami)" = "root" ]; then
echo "The installer should be run as root or sudo";
exit 0;
fi
}
BASH_CHECK_IF_DEBIAN_INSTALL_DEPENDANCIES () {
# Verifications si la distro est debian, et installation des dependances pour GLFTPD et les extra scripts via APT
if [ -f "/etc/debian_version" ]; then
Banner_Show "Install dependancies (debian)" silent
for pkg in $PACKAGES_NEEDED; do
if apt-get -qq install "$pkg"; then
echo "* Successfully installed "$pkg""
else
echo "- Error installing "$pkg""
exit
fi
done
fi
}
BASH_CHECK_IF_BINARY_EXISTS () {
# On verifie aussi que les binaire sont bien installer
Banner_Show "Check Binary needed as installed" silent
for cmd in $BINARY_NEEDED; do
if ! command -v "$cmd" &> /dev/null; then
echo "$cmd need be installed"
exit
fi
done
}
BASH_INIT () {
cache="${rootdir}/install.cache"
# creation du repertoire temporaire
FCT_CreateDir "${rootdir}/.tmp"
if [ "$(echo "$PATH" | grep -c /usr/sbin)" = 0 ]; then
echo "/usr/sbin not found in environmental PATH"
echo "Default PATH should be : /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
echo "Current PATH is : "$PATH""
echo "Correcting PATH"
export PATH="$PATH:/usr/sbin"
echo "Done"
fi
# clean up comments and trailing spaces in install.cache to avoid problems with unattended installation
if [ -f "$cache" ]; then sed -i -e 's/" #.*/"/g' -e 's/^#.*//g' -e '/^\s*$/d' -e 's/[ \t]*$//' "$cache"; fi
}
GLFTPD_CONF_INIT () {
Banner_Show "Configuration GLFTPD" silent
echo "--------[ Server configuration ]--------------------------------------"
echo
if [[ -f "$cache" && "$(grep -c -w GL_SiteName "$cache")" = 1 ]]; then
GL_SiteName="$(grep -w GL_SiteName "$cache" | cut -d "=" -f2 | tr -d "\"")"
fi
echo
while [[ -z "${GL_SiteName}" ]]; do
echo -n "Please enter the name of the site, without space : " ; read -r GL_SiteName
done
# replace space by _
GL_SiteName="${GL_SiteName// /_}"
if [ ! -f "$cache" ]; then
echo GL_SiteName=\""${GL_SiteName}"\" > "$cache"
fi
# export sitename
export ${GL_SiteName}
until [ -n "${glroot}" ]; do
echo -n "Please enter the private directory to install glftpd [/glftpd/"${GL_SiteName}"]: "
read -r glroot
case ${glroot} in
/)
echo "You can't have / as your private dir! Try again."
echo ""
unset glroot
continue
;;
/*|"")
[ -z "${glroot}" ] && glroot="/glftpd/${GL_SiteName}"
[ -d "${glroot}" ] && {
echo -n "Path already exists. [D]elete it, [A]bort, [T]ry again, [I]gnore? "
read -r reply
case "$reply" in
[dD]*)
rm -rf "${glroot}"
;;
[tT]*)
unset glroot;
continue
;;
[iI]*)
;;
*)
echo "Aborting.";
exit 1
;;
esac
}
mkdir -p ${glroot}
continue
;;
*)
echo "The private directory must start with a \"/\". Try again."
echo ""
unset glroot
continue
;;
esac
done
# Export for install.sh glftpd
export glroot
echo " ----------------------------> glroot ${glroot} <----------------------------"
}
GLFTPD_CONF_PORT () {
if [[ -f "$cache" && "$(grep -c -w GL_Port "$cache")" = 1 ]]; then
GL_Port="$(grep -w GL_Port "$cache" | cut -d "=" -f2 | tr -d "\"")"
else
echo -n "Please enter the port number for your site, default 2010 : " ; read -r GL_Port
if [ "${GL_Port}" = "" ]; then
GL_Port="2010"
fi
if [ "$(grep -c -w GL_Port= "$cache")" = 0 ]; then
echo GL_Port=\"${GL_Port}\" >> "$cache"
fi
fi
}
GLFTPD_CONF_VERSION () {
if [[ -f "$cache" && "$(grep -c -w GL_VERS_BRANCH "$cache")" = 1 ]]; then
GL_VERS_BRANCH="$(grep -w GL_VERS_BRANCH "$cache" | cut -d "=" -f2 | tr -d "\"")"
else
echo -n "Install stable or beta version of glFTPD ? [stable] [beta], default stable : " ; read -r GL_VERS_BRANCH
fi
if [ "${GL_VERS_BRANCH}" = "" ] || [ "${GL_VERS_BRANCH}" = "stable" ]; then
GL_VERS_BRANCH="The latest stable version"
else
GL_VERS_BRANCH="The latest version"
fi
if [[ -f "$cache" && "$(grep -c -w GL_ARCH "$cache")" = 1 ]]; then
GL_ARCH="$(grep -w GL_ARCH "$cache" | cut -d "=" -f2 | tr -d "\"")"
else
echo -n "Install 32 or 64 bit ARCH of glFTPD ? [32] [64], default 64 : " ; read -r GL_ARCH
fi
case "${GL_ARCH}" in
32)
;;
64)
;;
*)
GL_ARCH="64"
;;
esac
if [ "$(grep -c -w GL_ARCH= "$cache")" = 0 ]; then
echo GL_ARCH=\"${GL_ARCH}\" >> "$cache"
fi
}
GLFTPD_DOWNLOAD () {
Banner_Show "Download GLFTPD" silent
TMP_DIR_DEST_DOWNLOAD="${PACKAGES_PATH_DOWNLOADS}/${GL_SiteName}"
mkdir -p ${TMP_DIR_DEST_DOWNLOAD}
GL_VERS_LATEST="$("${BINARY_LYNX}" --dump "${GL_URL_WEBSITE}" | grep "${GL_VERS_BRANCH}" | cut -d ":" -f2 | sed -e 's/20[1-9][0-9].*//' -e 's/^ //' -e 's/^v//' | tr "[:space:]" "_" | sed 's/_$//')"
GL_ARCHIVE_FILE="$("${BINARY_WGET}" -q -O - "${GL_URL_WEBSITE}/files/" | grep "LNX-"${GL_VERS_LATEST}".*x"${GL_ARCH}".*" | grep -o -P '(?=glftpd).*(?=.tgz">)').tgz"
GL_ARCHIVE_PATH="${TMP_DIR_DEST_DOWNLOAD}/${GL_ARCHIVE_FILE}"
GL_DIR_SOURCE="${GL_ARCHIVE_PATH/.tgz/}"
if [ -f "${GL_ARCHIVE_PATH}" ] ; then
echo "Package glftpd '"${TMP_DIR_DEST_DOWNLOAD}"' exists, no downloading again."
else
echo "Downloading relevant packages '"${GL_ARCHIVE_PATH}"', please wait..."
${BINARY_WGET} -q "${GL_URL_WEBSITE}/files/${GL_ARCHIVE_FILE}" -O "${GL_ARCHIVE_PATH}"
echo "Extracting glftpd Source files, please wait..."
FCT_EXEC_SHOW_ERROR ${BINARY_TAR} xfv ${GL_ARCHIVE_PATH} -C ${TMP_DIR_DEST_DOWNLOAD}/
fi
}
UNIX_CREATE_USER_AND_GROUP () {
# Create unix group if dont exists
CHKGR="$(grep -w "glftpd" /etc/group | cut -d ":" -f1)"
if [ "$CHKGR" != "glftpd" ]; then
groupadd glftpd -g 199
if [ "$DEBUGINSTALL" = true ] ; then echo "Group glftpd added"; fi
fi
# Create unix user for eggdrop if dont exists
CHKUS="$(grep -w "${UNIX_USER_EGGDROP}" /etc/passwd | cut -d ":" -f1)"
if [ "$CHKUS" != "${UNIX_USER_EGGDROP}" ]; then
useradd -d "${glroot}/sitebot" -m -g glftpd -s /bin/bash "${UNIX_USER_EGGDROP}"
chfn -f 0 -r 0 -w 0 -h 0 "${UNIX_USER_EGGDROP}"
if [ "$DEBUGINSTALL" = true ] ; then echo "User "${UNIX_USER_EGGDROP}" added"; fi
fi
}
PZSNG_DOWNLOAD () {
Banner_Show "Downloads/Update 'pzs-ng' from git" silent
FCT_GIT_GET "${GIT_URL__PZS_NG}" "${PACKAGES_PATH_DOWNLOADS}/${GL_SiteName}/pzs-ng"
}
EGGDROP_DOWNLOAD () {
Banner_Show "Downloads/Update 'Eggdrop' from git" silent
FCT_GIT_GET "${GIT_URL__EGG}" "${PACKAGES_PATH_DOWNLOADS}/eggdrop"
#FCT_CreateDir source
#FCT_INSTALL scripts source
#cd ..
}
GLFTPD_CONF_DEVICE () {
if [[ -f "$cache" && "$(grep -c -w GL_Device "$cache")" = 1 ]] ; then
GL_Device="$(grep -w GL_Device "$cache" | cut -d "=" -f2 | tr -d "\"")"
echo "Sitename = "${GL_SiteName}""
echo "Port = "${GL_Port}""
echo "glFTPD ARCH = "${GL_ARCH}""
echo "Device = "${GL_Device}""
else
echo "Please enter which device you will use for the "${glroot}/site" folder"
echo "eg /dev/sda1"
echo "eg /dev/mapper/lvm-lvm"
echo "eg /dev/md0"
echo "Default: /dev/sda1"
echo -n "Device : " ; read -r GL_Device
echo
if [ "${GL_Device}" = "" ] ; then
GL_Device="/dev/sda1"
fi
fi
if [ "$(grep -c -w GL_Device= "$cache")" = 0 ]; then
echo GL_Device=\"${GL_Device}\" >> "$cache"
fi
}
EGGDROP_CONF_CHANNELS_ADD () {
#FCT_CreateDir ".tmp"
if [[ -f "$cache" && "$(grep -c -w EGG_IRC_SERVER "$cache")" = 1 ]]; then
EGG_IRC_SERVER=$(grep -w EGG_IRC_SERVER "$cache" | cut -d "=" -f2 | tr -d "\"")
echo -n "Irc server = "${EGG_IRC_SERVER}""
fi
if [[ -f "$cache" && "$(grep -c -w channelnr "$cache")" = 1 ]]; then
echo
channelnr="$(grep -w channelnr "$cache" | cut -d "=" -f2 | tr -d "\"")"
else
while [[ -z "$channelnr" || "$channelnr" -gt 15 ]]; do
echo -n "How many channels do you require the bot to be in (max 15)? : " ; read -r channelnr
done
fi
counta=0
if [ "$(grep -c -w channelnr= "$cache")" = 0 ]; then
echo channelnr=\""$channelnr"\" >> "$cache"
fi
while [ "$counta" -lt "$channelnr" ]; do
if [[ -f "$cache" && "$(grep -c -w "channame$((counta+1))" "$cache")" = 1 ]]; then
channame="$(grep -w "channame$((counta+1))" "$cache" | cut -d "=" -f2 | tr -d "\"" | cut -d " " -f1)"
echo "Channel "$((counta+1))" = "$channame""
else
echo "Include # in name of channel ie #"${GL_SiteName}""
while [[ -z "$channame" ]]; do
echo -n "Channel "$((counta+1))" is : " ; read -r channame
done
fi
if [[ -f "$cache" && "$(grep -c -w "channame$((counta+1))" "$cache")" = 1 ]]; then
chanpasswd="$(grep -w "channame$((counta+1))" "$cache" | cut -d "=" -f2 | tr -d "\"" | cut -d " " -f2)"
echo "Requires password = "$chanpasswd""
else
echo -n "Channel password ? [Y]es [N]o, default N : " ; read -r chanpasswd
fi
case "$chanpasswd" in
[Yy])
if [[ -f "$cache" && "$(grep -c -w "EGGDROP_CONF_ANNOUNCE_CHANNELS" "$cache")" = 1 ]]; then
echo "Channel mode = password protected"
fi
if [[ -f "$cache" && "$(grep -c -w "channame$((counta+1))" "$cache")" = 1 ]]; then
chanpassword="$(grep -w "channame$((counta+1))" "$cache" | cut -d "=" -f2 | tr -d "\"" | cut -d " " -f3)"
echo "Channel password = "$chanpassword""
else
while [[ -z "$chanpassword" ]]; do
echo -n "Enter the channel password : " ; read -r chanpassword
done
fi
echo "channel set "$channame" chanmode {+ntpsk "$chanpassword"}" >> "${rootdir}/.tmp/bot.chan.tmp"
echo "channel add "$channame" {" >> "${rootdir}/.tmp/eggchan"
echo "idle-kick 0" >> "${rootdir}/.tmp/eggchan"
echo "stopnethack-mode 0" >> "${rootdir}/.tmp/eggchan"
echo "flood-chan 0:0" >> "${rootdir}/.tmp/eggchan"
echo "flood-join 0:0" >> "${rootdir}/.tmp/eggchan"
echo "flood-ctcp 0:0" >> "${rootdir}/.tmp/eggchan"
echo "flood-kick 0:0" >> "${rootdir}/.tmp/eggchan"
echo "flood-deop 0:0" >> "${rootdir}/.tmp/eggchan"
echo "flood-nick 0:0" >> "${rootdir}/.tmp/eggchan"
echo "aop-delay 0:0" >> "${rootdir}/.tmp/eggchan"
echo "chanmode \"+ntsk "$chanpassword"\"" >> "${rootdir}/.tmp/eggchan"
echo "}" >> "${rootdir}/.tmp/eggchan"
echo "" >> "${rootdir}/.tmp/eggchan"
echo "$channame" >> "${rootdir}/.tmp/channels"
if [ "$(grep -c -w channame$((counta+1))= "$cache")" = 0 ]; then
echo "channame$((counta+1))=\"$channame $chanpasswd $chanpassword\"" >> "$cache"
fi
;;
[Nn])
if [[ -f "$cache" && "$(grep -c -w "EGGDROP_CONF_ANNOUNCE_CHANNELS" "$cache")" = 1 ]]; then
echo "Channel mode = invite only"
fi
echo "channel set "$channame" chanmode {+ntpsi}" >> "${rootdir}/.tmp/bot.chan.tmp"
echo "channel add "$channame" {" >> "${rootdir}/.tmp/eggchan"
echo "idle-kick 0" >> "${rootdir}/.tmp/eggchan"
echo "stopnethack-mode 0" >> "${rootdir}/.tmp/eggchan"
echo "flood-chan 0:0" >> "${rootdir}/.tmp/eggchan"
echo "aop-delay 0:0" >> "${rootdir}/.tmp/eggchan"
echo "chanmode +ntsi" >> "${rootdir}/.tmp/eggchan"
echo "}" >> "${rootdir}/.tmp/eggchan"
echo "" >> "${rootdir}/.tmp/eggchan"
echo "$channame" >> "${rootdir}/.tmp/channels"
if [ "$(grep -c -w channame$((counta+1))= "$cache")" = 0 ]; then
echo "channame$((counta+1))=\"$channame n nopass\"" "$cache"
fi
;;
*)
if [[ -f "$cache" && "$(grep -c -w "EGGDROP_CONF_ANNOUNCE_CHANNELS" "$cache")" = 1 ]]; then
echo "Channel mode = invite only"
fi
echo "channel set "$channame" chanmode {+ntpsi}" >> "${rootdir}/.tmp/bot.chan.tmp"
echo "channel add "$channame" {" >> "${rootdir}/.tmp/eggchan"
echo "idle-kick 0" >> "${rootdir}/.tmp/eggchan"
echo "stopnethack-mode 0" >> "${rootdir}/.tmp/eggchan"
echo "flood-chan 0:0" >> "${rootdir}/.tmp/eggchan"
echo "aop-delay 0:0" >> "${rootdir}/.tmp/eggchan"
echo "chanmode +ntsi" >> "${rootdir}/.tmp/eggchan"
echo "}" >> "${rootdir}/.tmp/eggchan"
echo "" >> "${rootdir}/.tmp/eggchan"
echo "$channame" >> "${rootdir}/.tmp/channels"
if [ "$(grep -c -w channame$((counta+1))= "$cache")" = 0 ]; then
echo "channame$((counta+1))=\"$channame n nopass\"" >> "$cache"
fi
;;
esac
channame=""
chanpasswd=""
((counta++))
done
}
EGGDROP_CONF_ANNOUNCE_CHANNELS () {
sed -i -e :a -e N -e 's/\n/ /' -e ta "${rootdir}/.tmp/channels"
if [[ -f "$cache" && "$(grep -c -w EGGDROP_CONF_ANNOUNCE_CHANNELS "$cache")" = 1 ]]; then
EGGDROP_CONF_ANNOUNCE_CHANNELS="$(grep -w EGGDROP_CONF_ANNOUNCE_CHANNELS "$cache" | cut -d "=" -f2 | tr -d "\"")"
echo "Announce channels = "${EGGDROP_CONF_ANNOUNCE_CHANNELS}""
else
echo -n "Which should be announce channels, default: "$(cat "${rootdir}/.tmp/channels")" : " ; read -r EGGDROP_CONF_ANNOUNCE_CHANNELS
fi
if [ "${EGGDROP_CONF_ANNOUNCE_CHANNELS}" = "" ]; then
EGGDROP_CONF_ANNOUNCE_CHANNELS="$(cat "${rootdir}/.tmp/channels")"
cat "${rootdir}/.tmp/channels" > "${rootdir}/.tmp/dzchan"
if [ "$(grep -c -w EGGDROP_CONF_ANNOUNCE_CHANNELS= "$cache")" = 0 ]; then
echo "EGGDROP_CONF_ANNOUNCE_CHANNELS=\"$(cat "${rootdir}/.tmp/channels")\"" >> "$cache"
fi
else
echo "${EGGDROP_CONF_ANNOUNCE_CHANNELS}" > "${rootdir}/.tmp/dzchan"
if [ "$(grep -c -w EGGDROP_CONF_ANNOUNCE_CHANNELS= "$cache")" = 0 ]; then
echo "EGGDROP_CONF_ANNOUNCE_CHANNELS=\"${EGGDROP_CONF_ANNOUNCE_CHANNELS}\"" >> "$cache"
fi
fi
}
EGGDROP_CONF_ANNOUNCE_CHANNELS_ADMIN () {
if [[ -f "$cache" && "$(grep -c -w EGGDROP_CONF_ANNOUNCE_CHANNELS_ADMIN "$cache")" = 1 ]]; then
EGGDROP_CONF_ANNOUNCE_CHANNELS_ADMIN="$(grep -w EGGDROP_CONF_ANNOUNCE_CHANNELS_ADMIN "$cache" | cut -d "=" -f2 | tr -d "\"")"
echo "Ops channel = "${EGGDROP_CONF_ANNOUNCE_CHANNELS_ADMIN}""
else
echo "Channels: "$(cat "${rootdir}/.tmp/channels")""
while [[ -z "${EGGDROP_CONF_ANNOUNCE_CHANNELS_ADMIN}" ]]; do
echo -n "Which of these channels as ops channel ? : " ; read -r EGGDROP_CONF_ANNOUNCE_CHANNELS_ADMIN
done
fi
echo "${EGGDROP_CONF_ANNOUNCE_CHANNELS_ADMIN}" > "${rootdir}/.tmp/dzochan"
if [ "$(grep -c -w EGGDROP_CONF_ANNOUNCE_CHANNELS_ADMIN= "$cache")" = 0 ]; then
echo "EGGDROP_CONF_ANNOUNCE_CHANNELS_ADMIN=\"${EGGDROP_CONF_ANNOUNCE_CHANNELS_ADMIN}\"" >> "$cache"
fi
rm "${rootdir}/.tmp/channels"
}
EGG__YOUR_IRC_NICKNAME () {
if [[ -f "$cache" && "$(grep -c -w EGG__YOUR_IRC_NICKNAME "$cache")" = 1 ]]; then
EGG__YOUR_IRC_NICKNAME="$(grep -w EGG__YOUR_IRC_NICKNAME "$cache" | cut -d "=" -f2 | tr -d "\"")"
echo "Nickname = "$EGG__YOUR_IRC_NICKNAME""
else
while [[ -z "$EGG__YOUR_IRC_NICKNAME" ]]; do
echo -n "What is your nickname on irc ? ie SiteTech : " ; read -r EGG__YOUR_IRC_NICKNAME
done
fi
if [ "$(grep -c -w EGG__YOUR_IRC_NICKNAME= "$cache")" = 0 ]; then
echo "EGG__YOUR_IRC_NICKNAME=\"$EGG__YOUR_IRC_NICKNAME\"" >> "$cache"
fi
}
## how many sections
GLFTPD_CONF_SECTIONS_NAME () {
#FCT_CreateDir ".tmp"
if [[ -f "$cache" && "$(grep -c -w sections "$cache")" = 1 ]]; then
sections="$(grep -w sections "$cache" | cut -d "=" -f2 | tr -d "\"")"
else
echo "Valid Sections are : "
echo "0DAY ANIME APPS DVDR EBOOKS FLAC GAMES MP3 MBLURAY MVDVDR NSW PDA PS4 TV-HD TV-NL TV-SD X264 X265-2160 XVID XXX XXX-PAYSITE"
echo
while [[ -z "$sections" || "$sections" -gt 20 ]]; do
echo -n "How many sections do you require for your site (max 20)? : " ; read -r sections
done
fi
FCT_INSTALL "${PACKAGES_PATH_DATA}/dated.sh.org" "${rootdir}/.tmp/dated.sh"
counta=0
if [ "$(grep -c -w sections= "$cache")" = 0 ]; then
echo sections=\""$sections"\" >> "$cache"
fi
while [ "$counta" -lt "$sections" ]; do
section_generate
((counta++))
done
}
## which Sections
section_generate () {
if [[ -f "$cache" && "$(grep -c -w "section$((counta+1))" "$cache")" = 1 ]]; then
section="$(grep -w "section$((counta+1))" "$cache" | cut -d "=" -f2 | tr -d "\"")"
else
echo -n "Section "$((counta+1))" is : " ; read -r section
fi
case ${section^^} in 0DAY|ANIME|APPS|DVDR|EBOOKS|FLAC|GAMES|MP3|MBLURAY|MVDVDR|NSW|PDA|PS4|TV-HD|TV-NL|TV-SD|X264|X265-2160|XVID|XXX|XXX-PAYSITE)
writ
;;
*)
while [[ "${section^^}" != @(0DAY|ANIME|APPS|DVDR|EBOOKS|FLAC|GAMES|MP3|MBLURAY|MVDVDR|NSW|PDA|PS4|TV-HD|TV-NL|TV-SD|X264|X265-2160|XVID|XXX|XXX-PAYSITE) ]]; do
echo "Section ["$section"] is not in the above list of available sections, please try again."
echo -n "Section "$((counta+1))" is : " ; read -r section
done
;;
esac
}
## TMP_dZSbot.tcl_Config
writ () {
section="${section^^}"
if [[ "${section^^}" = 0DAY || "${section^^}" = FLAC || "${section^^}" = MP3 || "${section^^}" = EBOOKS ]]; then
# FCT_CreateDir "${rootdir}/.tmp/site/${section^^}"
mkdir -p "${rootdir}/.tmp/site/${section^^}"
FCT_CHMOD 777 "${rootdir}/.tmp/site/${section^^}"
echo "${section^^} " > "${rootdir}/.tmp/.section"
cat "${rootdir}/.tmp/.section" >> "${rootdir}/.tmp/.sections"
awk -F '[" "]+' '{printf "$0"}' "${rootdir}/.tmp/.sections" > "${rootdir}/.tmp/.validsections"
#echo "set statsection($counta) \"${section^^}\"" >> "${rootdir}/.tmp/dzsstats"
echo "set paths("${section^^}") \"/site/"${section^^}"/*/*\"" >> "${rootdir}/.tmp/dzsrace"
echo "set chanlist("${section^^}") \""${EGGDROP_CONF_ANNOUNCE_CHANNELS}"\"" >> "${rootdir}/.tmp/dzschan"
#echo "#stat_section ${section^^} /site/"${section^^}"/* no" >> "${rootdir}/.tmp/glstat"
printf '%s\n' \
"section."${section^^}".name="${section^^}"" \
"section."${section^^}".dir="/site/${section^^}/MMDD"" \
"section."${section^^}".gl_credit_section=0" \
"section."${section^^}".gl_stat_section=0" \
>> "${rootdir}/.tmp/footools"
sed -i "s/\bDIRS=\"/DIRS=\"\n\/site\/${section^^}\/\$today/" "${PACKAGES_PATH_GL_SCRIPTS}/Tur-AutoNuke/tur-autonuke.conf"
sed -i "s/\bDIRS=\"/DIRS=\"\n\/site\/${section^^}\/\$yesterday/" "${PACKAGES_PATH_GL_SCRIPTS}/Tur-AutoNuke/tur-autonuke.conf"
echo "INC${section^^}="${GL_Device}":"${glroot}/site/${section^^}":DATED" >> "${PACKAGES_PATH_GL_SCRIPTS}/Tur-Space/tur-space.conf.new"
echo "${glroot}/site/${section^^}" >> "${rootdir}/.tmp/.fullpath"
if [[ "${section^^}" = FLAC || "${section^^}" = MP3 ]]; then
echo "/site/"${section^^}"/ " > "${rootdir}/.tmp/.section"
cat "${rootdir}/.tmp/.section" >> "${rootdir}/.tmp/.temp"
awk -F '[" "]+' '{printf "$0"}' "${rootdir}/.tmp/.temp" > "${rootdir}/.tmp/.path"
fi
if [ "$(grep -c -w section$((counta+1))= "$cache")" = 0 ]; then
echo "section$((counta+1))=\"$section\"" >> "$cache"
fi
else
# FCT_CreateDir "${rootdir}/.tmp/site/${section^^}"
mkdir -p "${rootdir}/.tmp/site/${section^^}"
FCT_CHMOD 777 "${rootdir}/.tmp/site/${section^^}"
echo "${section^^} " > "${rootdir}/.tmp/.section"
cat "${rootdir}/.tmp/.section" >> "${rootdir}/.tmp/.sections"
awk -F '[" "]+' '{printf "$0"}' "${rootdir}/.tmp/.sections" > "${rootdir}/.tmp/.validsections"
#echo "set statsection($counta) \"${section^^}\"" >> "${rootdir}/.tmp/dzsstats"
echo "set paths("${section^^}") \"/site/"${section^^}"/*\"" >> "${rootdir}/.tmp/dzsrace"
echo "set chanlist("${section^^}") \""${EGGDROP_CONF_ANNOUNCE_CHANNELS}"\"" >> "${rootdir}/.tmp/dzschan"
echo "/site/"${section^^}"/ " > "${rootdir}/.tmp/.section"
cat "${rootdir}/.tmp/.section" >> "${rootdir}/.tmp/.temp"
awk -F '[" "]+' '{printf "$0"}' "${rootdir}/.tmp/.temp" > "${rootdir}/.tmp/.path"
#echo "#stat_section "${section^^}" /site/"${section^^}"/* no" >> "${rootdir}/.tmp/glstat"
printf '%s\n' \
"section."${section^^}".name="${section^^}"" \
"section."${section^^}".dir=/site/"${section^^}"" \
"section."${section^^}".gl_credit_section=0" \
"section."${section^^}".gl_stat_section=0" \
>> "${rootdir}/.tmp/footools"
sed -i "s/\bDIRS=\"/DIRS=\"\n\/site\/${section^^}/" "${PACKAGES_PATH_GL_SCRIPTS}/Tur-AutoNuke/tur-autonuke.conf"
echo "INC${section^^}="${GL_Device}":"${glroot}/site/${section^^}":" >> "${PACKAGES_PATH_GL_SCRIPTS}/Tur-Space/tur-space.conf.new"
echo "${glroot}/site/"${section^^}"" >> "${rootdir}/.tmp/.fullpath"
if [ "$(grep -c -w section$((counta+1))= "$cache")" = 0 ]; then
echo "section$((counta+1))=\"$section\"" >> "$cache"
fi
fi
incom
}
incom () {
"${PACKAGES_PATH_GL_SCRIPTS}/tur-rules/rulesgen.sh" "${section^^}"
echo "/site/_REQUESTS/" >> "${rootdir}/.tmp/.path"
}
## GLFTPD_INSTALL
GLFTPD_INSTALL () {
if [[ -f "$cache" && "$(grep -c -w GL_SCRIPTS__eur0__pre_system "$cache")" = 1 ]]; then
echo "Sections = "$(cat "${rootdir}/.tmp/.validsections")""
fi
if [[ -f "$cache" && "$(grep -c -w router "$cache")" = 1 ]]; then
echo "Router = "$(grep -w router "$cache" | cut -d "=" -f2 | tr -d "\"")""
fi
if [[ -f "$cache" && "$(grep -c -w pasv_addr "$cache")" = 1 ]]; then
echo "Passive address = "$(grep -w pasv_addr "$cache" | cut -d "=" -f2 | tr -d "\"")""
fi
if [[ -f "$cache" && "$(grep -c -w pasv_ports "$cache")" = 1 ]]; then
echo "Port range = "$(grep -w pasv_ports "$cache" | cut -d "=" -f2 | tr -d "\"")""
fi
if [[ -f "$cache" && "$(grep -c -w GL_SCRIPTS__PSXC__IMDB_CHAN "$cache")" = 1 ]]; then
echo "IMDB trigger chan = "$(grep -w GL_SCRIPTS__PSXC__IMDB_CHAN "$cache" | cut -d "=" -f2 | tr -d "\"")""
fi
echo
echo "--------[ Installation of software and scripts ]----------------------"
cd "${PACKAGES_PATH}" || exit
echo
echo "Installing glftpd, please wait..."
echo "####### Here starts glFTPD scripts of "${GL_SiteName}" #######" >> /var/spool/cron/crontabs/root
cd "${GL_DIR_SOURCE}" || exit
sed "s/changeme/${GL_Port}/" "${PACKAGES_PATH_DATA}/installgl.sh.org" > "${GL_DIR_SOURCE}/installgl.sh"
FCT_CHMOD +x "${GL_DIR_SOURCE}/installgl.sh"
export glservicename="glftpd-${GL_SiteName}"
"${GL_DIR_SOURCE}/installgl.sh"
echo "----> debug ----> $glservicename"
#FCT_CreateDir "${glroot}/ftp-data/misc/"
mkdir -p "${glroot}/ftp-data/misc/"
echo "By [email protected]" >> "${glroot}/ftp-data/misc/welcome.msg"
echo -e "[\e[32mDone\e[0m]"
cd "${PACKAGES_PATH_DATA}" || exit
printf '%s\n' \
'##########################################################################' \
'# Server shutdown: 0=server open, 1=deny all but siteops, !*=deny all, etc' \
'shutdown 1' \
'#' \
"sitename_long "${GL_SiteName}"" \
"sitename_short "${GL_SiteName}"" \
'email [email protected]' \
"login_prompt "${GL_SiteName}"[:space:]Ready" \
'mmap_amount 100' \
'dl_sendfile 4096' \
'# SECTION KEYWORD DIRECTORY SEPARATE CREDITS' \
'stat_section DEFAULT * no' \
> glftpd.conf
if [[ -f "$cache" && "$(grep -c -w router "$cache")" = 1 ]]; then
router="$(grep -w router "$cache" | cut -d "=" -f2 | tr -d "\"")"
else
echo -n "Do you use a router ? [Y]es [N]o, default N : " ; read -r router
fi
case "$router" in
[Yy])
ipcheck="$("${BINARY_WGET}" -qO- "${MYIPCHECK_URL_WEBSITE}"; echo)"
if [[ -f "$cache" && "$(grep -c -w pasv_addr "$cache")" = 1 ]]; then
pasv_addr="$(grep -w pasv_addr "$cache" | cut -d "=" -f2 | tr -d "\"")"
else
echo -n "Please enter the DNS or IP for the site, default "$ipcheck" : " ; read -r pasv_addr
fi
if [ "$pasv_addr" = "" ]; then
pasv_addr="$ipcheck"
fi
if [[ -f "$cache" && "$(grep -c -w pasv_ports "$cache")" = 1 ]]; then
pasv_ports="$(grep -w pasv_ports "$cache" | cut -d "=" -f2 | tr -d "\"")"
else
echo -n "Please enter the port range for passive mode, default 6000-7000 : " ; read -r pasv_ports
fi
echo "pasv_addr $pasv_addr 1" >> glftpd.conf
if [ "$pasv_ports" = "" ]; then
echo "pasv_ports 6000-7000" >> glftpd.conf
pasv_ports="6000-7000"
else
echo "pasv_ports $pasv_ports" >> glftpd.conf
fi
;;
[Nn])
router=n
;;
*)
router=n
;;
esac
if [ "$(grep -c -w router= "$cache")" = 0 ]; then
echo "router=\"$router\"" >> "$cache"
fi
if [[ "$(grep -c -w pasv_addr= "$cache")" = 0 && "$pasv_addr" != "" ]]; then
echo "pasv_addr=\"$pasv_addr\"" >> "$cache"
fi
if [[ "$(grep -c -w pasv_ports= "$cache")" = 0 && "$pasv_addr" != "" ]]; then
echo "pasv_ports=\"$pasv_ports\"" >> "$cache"
fi
#cat glstat >> glftpd.conf && rm glstat
cat glfoot >> glftpd.conf
FCT_INSTALL glftpd.conf "${glroot}/etc/"
FCT_INSTALL default.user "${glroot}/ftp-data/users/"
printf '%s\n' \
"59 23 * * * $(which chroot) "${glroot}" /bin/cleanup >/dev/null 2>&1" \
"29 4 * * * $(which chroot) "${glroot}" /bin/datacleaner >/dev/null 2>&1" \
"*/10 * * * * "${glroot}/bin/incomplete-list-nuker.sh" >/dev/null 2>&1" \
"0 1 * * * "${glroot}/bin/olddirclean2" -PD >/dev/null 2>&1" \
>> /var/spool/cron/crontabs/root
touch "${glroot}/ftp-data/logs/incomplete-list-nuker.log"
rm -f "${glroot}/README"
rm -f "${glroot}/README.ALPHA"
rm -f "${glroot}/UPGRADING"
rm -f "${glroot}/changelog"
rm -f "${glroot}/LICENSE"
rm -f "${glroot}/glftpd.conf"
rm -f "${glroot}/installgl.debug"
rm -f "${glroot}/installgl.sh"
rm -f "${glroot}/glftpd.conf.dist"
rm -f "${glroot}/convert_to_2.0.pl"
rm -f /etc/glftpd.conf
FCT_INSTALL "${glroot}/create_server_key.sh" "${glroot}/etc/"
FCT_INSTALL "${PACKAGES_PATH_DATA}/site.rules" "${glroot}/ftp-data/misc/"
FCT_INSTALL incomplete-list.sh "${glroot}/bin/"
FCT_INSTALL incomplete-list-nuker.sh "${glroot}/bin/"
FCT_CHMOD 755 "${glroot}/site"
#ln -s "${glroot}/etc/glftpd.conf" /etc/glftpd.conf
FCT_CHMOD 777 "${glroot}/ftp-data/msgs"
### A voir l'utilité ..
#FCT_INSTALL "${PACKAGES_PATH_GL_SCRIPTS}/extra/update_perms.sh" "${glroot}/bin/"
#FCT_INSTALL "${PACKAGES_PATH_GL_SCRIPTS}/extra/mkv_check.sh" "${glroot}/bin/"
#FCT_INSTALL "$(which mkvinfo)" "${glroot}/bin/"
#FCT_INSTALL "${PACKAGES_PATH_GL_SCRIPTS}/extra/glftpd-version_check.sh" "${glroot}/bin/"
#echo "0 18 * * * "${glroot}/bin/glftpd-version_check.sh" >/dev/null 2>&1" >> /var/spool/cron/crontabs/root
chown -R root:root "${glroot}/bin/"
FCT_CHMOD u+s "${glroot}/bin/sed"
FCT_CHMOD u+s "${glroot}/bin/nuker"
if [ -f "/etc/systemd/system/"${GL_SiteName}".socket" ]; then
sed -i 's/#MaxConnections=64/MaxConnections=300/' "/etc/systemd/system/"${GL_SiteName}".socket"
fi
systemctl daemon-reload
systemctl restart ${glservicename}.socket
}
## EGGDROP
EGG_INSTALL () {
Banner_Show "Installing eggdrop to '"${glroot}/sitebot"'" silent
cd "${PACKAGES_PATH_DOWNLOADS}/eggdrop" || exit ;
echo "./configure eggdrop in "${glroot}/sitebot", please wait..."
FCT_EXEC_SHOW_ERROR ./configure --prefix="${glroot}/sitebot"
echo "eggdrop : make config, please wait..."
FCT_EXEC_SHOW_ERROR make config
echo "eggdrop : make, please wait..."
FCT_EXEC_SHOW_ERROR make
echo "eggdrop : make install, please wait..."
FCT_EXEC_SHOW_ERROR make install
echo "eggdrop : make sslsilent, please wait..."
FCT_EXEC_SHOW_ERROR make sslsilent;
cd "${PACKAGES_PATH_DATA}" || exit
# FCT_CreateDir "${glroot}/sitebot/data"
mkdir -p "${glroot}/sitebot/data"
FCT_CHMOD 777 "${glroot}/sitebot/data"
cat egghead > "${GL_SiteName}.conf"
cat "${rootdir}/.tmp/eggchan" >> "${GL_SiteName}.conf"
sed -e "s/changeme/"${GL_SiteName}"/" bot.chan > ""${glroot}"/sitebot/data/"${GL_SiteName}".chan"
cat "${rootdir}/.tmp/bot.chan.tmp" >> ""${glroot}"/sitebot/data/"${GL_SiteName}".chan"
printf '%s\n' \
"set username \""${GL_SiteName}"\"" \
"set nick \""${GL_SiteName}"\"" \
"set altnick \"_"${GL_SiteName}"\"" \
> ""${GL_SiteName}".conf"
sed -i "s/changeme/"$EGG__YOUR_IRC_NICKNAME"/" ""${GL_SiteName}".conf"
FCT_INSTALL "${GL_SiteName}.conf" "${glroot}/sitebot/"
FCT_INSTALL botchkhead .botchkhead
printf '%s\n' \
"botdir="${glroot}"/sitebot" \
"botscript=eggdrop" \
"botname="${GL_SiteName}"" \
"userfile=./data/"${GL_SiteName}".user" \
"pidfile=pid."${GL_SiteName}"" \
> .botchkhead
FCT_CHMOD 755 .botchkhead
FCT_INSTALL .botchkhead "${glroot}/sitebot/botchk"
cat botchkfoot >> "${glroot}/sitebot/botchk"
touch "/var/spool/cron/crontabs/"${UNIX_USER_EGGDROP}""
echo "*/10 * * * * ${glroot}/sitebot/botchk >/dev/null 2>&1" >> "/var/spool/cron/crontabs/"${UNIX_USER_EGGDROP}""
FCT_CHMOD 777 "${glroot}/sitebot/logs"
chown -R sitebot:glftpd "${glroot}/sitebot/"
rm -f "${glroot}/sitebot/BOT.INSTALL"
rm -f "${glroot}/sitebot/README"
rm -f "${glroot}/sitebot/eggdrop1.8"
rm -f "${glroot}/sitebot/${glroot}-tcl.old-TIMER"
rm -f "${glroot}/sitebot/${glroot}.tcl-TIMER"
rm -f "${glroot}/sitebot/eggdrop-basic.conf"
rm -f "${glroot}/sitebot/scripts/CONTENTS"
rm -f "${glroot}/sitebot/scripts/autobotchk"
rm -f "${glroot}/sitebot/scripts/botchk"
rm -f "${glroot}/sitebot/scripts/weed"
ln -s "${glroot}/sitebot/eggdrop" "${glroot}/sitebot/sitebot"
rm -f "${glroot}/sitebot/eggdrop"
FCT_CHMOD 666 "${glroot}/etc/glftpd.conf"
# FCT_CHMOD 666 "${glroot}/etc/glroot.conf"
# FCT_CreateDir "${glroot}/site/_PRE/SiteOP" "${glroot}/site/_REQUESTS" "${glroot}/site/_SPEEDTEST"
mkdir -p "${glroot}/site/_PRE/SiteOP" "${glroot}/site/_REQUESTS" "${glroot}/site/_SPEEDTEST"
FCT_CHMOD 777 "${glroot}/site/_PRE" "${glroot}/site/_PRE/SiteOP" "${glroot}/site/_REQUESTS" "${glroot}/site/_SPEEDTEST"
FCT_Create_SPEEDTEST_FILE
rm -f "${glroot}/sitebot/scripts/*.tcl"
FCT_INSTALL "${PACKAGES_PATH_GL_SCRIPTS}/extra/*.tcl" "${glroot}/sitebot/scripts/"
sed -i "s/#changeme/"${EGGDROP_CONF_ANNOUNCE_CHANNELS}"/" "${glroot}/sitebot/scripts/rud-news.tcl"
sed -i "s/#personal/"${EGGDROP_CONF_ANNOUNCE_CHANNELS_ADMIN}"/" "${glroot}/sitebot/scripts/rud-news.tcl"
sed -i "s/changeme/"${EGGDROP_CONF_ANNOUNCE_CHANNELS_ADMIN}"/g" "${glroot}/sitebot/scripts/tur-predircheck_manager.tcl"
FCT_INSTALL "${PACKAGES_PATH_DATA}kill.sh" "${glroot}/sitebot/"
sed -i "s/changeme/"${GL_SiteName}"/g" "${glroot}/sitebot/kill.sh"
echo -e "[\e[32mDone\e[0m]"
}
FCT_Create_SPEEDTEST_FILE () {
Banner_Show "Create speedtest files" silent
dd if=/dev/urandom of="${glroot}/site/_SPEEDTEST/150MB" bs=1M count=150 >/dev/null 2>&1
dd if=/dev/urandom of="${glroot}/site/_SPEEDTEST/250MB" bs=1M count=250 >/dev/null 2>&1
dd if=/dev/urandom of="${glroot}/site/_SPEEDTEST/500MB" bs=1M count=500 >/dev/null 2>&1
dd if=/dev/urandom of="${glroot}/site/_SPEEDTEST/1GB" bs=1M count=1000 >/dev/null 2>&1
dd if=/dev/urandom of="${glroot}/site/_SPEEDTEST/5GB" bs=1M count=5000 >/dev/null 2>&1
dd if=/dev/urandom of="${glroot}/site/_SPEEDTEST/10GB" bs=1M count=10000 >/dev/null 2>&1
}
EGG_CONFIG_IRC () {
if [[ -f "$cache" && "$(grep -c -w EGG_IRC_SERVER "$cache")" = 1 ]]; then
sed -i "s/EGG_IRC_SERVER/"${EGG_IRC_SERVER}"/" "${glroot}/sitebot/eggdrop.conf"
else
echo
echo -n "What irc server ? default irc.example.org : " ; read -r EGG_IRC_SERVER
if [ "$EGG_IRC_SERVER" = "" ]; then
EGG_IRC_SERVER="irc.example.org"
fi
echo -n "What port for irc server ? default 7000 : " ; read -r EGG_IRC_PORT
if [ "${EGG_IRC_PORT}" = "" ]; then
EGG_IRC_PORT="7000"
fi
echo -n "Is the port above a SSL port ? [Y]es [N]o, default Y : " ; read -r serverssl
case "$serverssl" in
[Yy])
ssl=1
;;
[Nn])
ssl=0
;;
*)
ssl=1
;;
esac
echo -n "Does it require a password ? [Y]es [N]o, default N : " ; read -r serverpassword
case "$serverpassword" in
[Yy])
echo -n "Please enter the password for irc server, default NULL : " ; read -r EGG_IRC_PASSWORD
if [ "${EGG_IRC_PASSWORD}" = "" ]; then
EGG_IRC_PASSWORD=""
else
EGG_IRC_PASSWORD=":"${EGG_IRC_PASSWORD}""
fi
;;
[Nn])
EGG_IRC_PASSWORD=""
;;
*)
EGG_IRC_PASSWORD=""
;;
esac
case "$ssl" in
1)
sed -i "s/EGG_IRC_SERVER/"${EGG_IRC_SERVER}":+"${EGG_IRC_PORT}""${EGG_IRC_PASSWORD}"/" "${glroot}/sitebot/eggdrop.conf"
if [ "$(grep -c -w EGG_IRC_SERVER= "$cache")" = 0 ]; then
echo "${EGG_IRC_SERVER}=\""${EGG_IRC_SERVER}":+"${EGG_IRC_PORT}""${EGG_IRC_PASSWORD}"\"" >> "$cache"
fi
;;
0)
sed -i "s/EGG_IRC_SERVER/"${EGG_IRC_SERVER}":"${EGG_IRC_PORT}""${EGG_IRC_PASSWORD}"/" "${glroot}/sitebot/eggdrop.conf"
if [ "$(grep -c -w EGG_IRC_SERVER= "$cache")" = 0 ]; then
echo "${EGG_IRC_SERVER}=\""${EGG_IRC_SERVER}":"${EGG_IRC_PORT}""${EGG_IRC_PASSWORD}"\"" >> "$cache"
fi
;;
esac
fi
}
## zsconfig.h
PZS_PATCH_CONFIG_FILE () {
cd "${PACKAGES_PATH_DOWNLOADS}/${GL_SiteName}/pzs-ng" || exit
cat "${PACKAGES_PATH_DATA}/pzshead" > zsconfig.h
path="$(cat ""${rootdir}"/.tmp/.path")"
printf '%s\n' \
"#define check_for_missing_nfo_dirs \"$path\"" \
"#define cleanupdirs \"$path\"" \
"#define cleanupdirs_dated \"/site/0DAY/%m%d/ /site/FLAC/%m%d/ /site/MP3/%m%d/ /site/EBOOKS/%m%d/\"" \
"#define sfv_dirs \"$path\"" \
"#define short_sitename \"${GL_SiteName}\"" \
>> zsconfig.h
FCT_CHMOD 755 zsconfig.h
FCT_INSTALL zsconfig.h "${PACKAGES_PATH_DOWNLOADS}/${GL_SiteName}/pzs-ng/zipscript/conf/zsconfig.h"
}
## dZSbot.tcl
PZS_CONFIG_CHANNELS () {
echo "REQUEST" >> "${rootdir}/.tmp/.validsections"
echo "set paths(REQUEST) \"/site/_REQUESTS/*/*\"" >> "${rootdir}/.tmp/dzsrace"
echo "set chanlist(REQUEST) \"${EGGDROP_CONF_ANNOUNCE_CHANNELS}\"" >> "${rootdir}/.tmp/dzschan"
printf '%s\n' \
"$(cat "${PACKAGES_PATH_DATA}/dzshead")" \
"set device(0)" '"'${GL_Device} SITE'"' \
"$(cat "${PACKAGES_PATH_DATA}/dzsbnc")" \
"$(cat "${PACKAGES_PATH_DATA}/dzsmidl")" \
"set sections \"$(cat "${rootdir}/.tmp/.validsections")\"" \
'' \
"$(cat "${rootdir}/.tmp/dzsrace")" \
"$(cat "${rootdir}/.tmp/dzschan")" \
"$(cat "${PACKAGES_PATH}/data/dzsfoot")" \
> ngBot.conf
FCT_CHMOD 644 ngBot.conf
rm "${rootdir}/.tmp/dzsrace"
rm "${rootdir}/.tmp/dzschan"
# FCT_CreateDir "${glroot}/sitebot/scripts/pzs-ng/themes"
mkdir -p "${glroot}/sitebot/scripts/pzs-ng/themes"
FCT_INSTALL ngBot.conf "${glroot}/sitebot/scripts/pzs-ng/ngBot.conf"
}
## PROJECTZS
PZS_INSTALL () {
# if [[ -f "$cache" && "$(grep -c -w GL_SCRIPTS__eur0__pre_system "$cache")" = 0 ]]; then
# echo
# fi
echo "Installing pzs-ng, please wait..."
cd "${PACKAGES_PATH_DOWNLOADS}/${GL_SiteName}/pzs-ng" || exit
FCT_EXEC_SHOW_ERROR ./configure
FCT_EXEC_SHOW_ERROR make
FCT_EXEC_SHOW_ERROR make install
FCT_EXEC_SHOW_ERROR "${glroot}/libcopy.sh"
echo -e "[\e[32mDone\e[0m]"
FCT_INSTALL sitebot/ngB* "${glroot}/sitebot/scripts/pzs-ng/"
FCT_INSTALL sitebot/modules "${glroot}/sitebot/scripts/pzs-ng/"
FCT_INSTALL sitebot/plugins "${glroot}/sitebot/scripts/pzs-ng/"
FCT_INSTALL sitebot/themes "${glroot}/sitebot/scripts/pzs-ng/"
FCT_INSTALL "${PACKAGES_PATH_DATA}/glftpd.installer.theme" "${glroot}/sitebot/scripts/pzs-ng/themes/"
FCT_INSTALL "${PACKAGES_PATH_DATA}/ngBot.vars" "${glroot}/sitebot/scripts/pzs-ng/"
FCT_INSTALL "${PACKAGES_PATH_DATA}/sitewho.conf" "${glroot}/bin/"
cd "${PACKAGES_PATH_GL_SCRIPTS}" || exit
FCT_CHMOD u+s "${glroot}/bin/cleanup"
rm -f "${glroot}/sitebot/scripts/pzs-ng/ngBot.conf.dist"
}
## Tur-Space
GL_SCRIPTS__Tur__Space () {
if [[ -f "$cache" && "$(grep -c -w GL_SCRIPTS__Tur__Space "$cache")" = 1 ]]; then
ask="$(grep -w GL_SCRIPTS__Tur__Space "$cache" | cut -d "=" -f2 | tr -d "\"")"
else
echo
echo -e "\e[4mDescription for Tur-Space:\e[0m"
FCT_GIT_GET_DESCRIPTION "${GIT_URL__GL_SCRIPTS__Tur__Space}"
echo
echo -n "Install Tur-Space ? [Y]es [N]o, default Y : " ; read -r ask
fi
case "$ask" in
[Nn])