forked from janovas/Directadmin-Installer
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathinstall.sh
1504 lines (1270 loc) · 40 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/sh
###############################################################################
# setup.sh
# DirectAdmin setup.sh file is the first file to download when doing a
# DirectAdmin Install. It will ask you for relevant information and will
# download all required files. If you are unable to run this script with
# ./setup.sh then you probably need to set it's permissions. You can do this
# by typing the following:
#
# chmod 755 setup.sh
#
# after this has been done, you can type ./setup.sh to run the script.
#
###############################################################################
### Added By MTimer www.mtimer.net ###
yum -y update
echo "multilib_policy=all" >> /etc/yum.conf
yum -y install openssl098e glibc.i686 libstdc++.i686
yum -y install dos2unix patch screen unzip lftp tar quota autoconf automake libtool which wget gcc gcc-c++ flex bison make bind bind-libs bind-utils openssl openssl-devel perl libaio libcom_err-devel libcurl-devel gd zlib-devel zip libcap-devel cronie bzip2 db4-devel cyrus-sasl-devel perl-ExtUtils-Embed libstdc++.so.6 libnspr4.so libssl.so.6
ln -s /usr/lib/libssl.so /usr/lib/libssl.so.6
ln -s /usr/lib/libcrypto.so /usr/lib/libcrypto.so.6
ln -s /usr/lib64/libssl.so /usr/lib64/libssl.so.10
ln -s /usr/lib64/libcrypto.so /usr/lib64/libcrypto.so.10
echo "Download DA 1.44.3 scripts ...";
mkdir -p /usr/local/directadmin
wget -q -O da1443-en.tar.gz http://directadmin.u.qiniudn.com/da1443-en.tar.gz
tar xvf da1443-en.tar.gz -C /usr/local/directadmin
echo "DA 1.44.3 scripts ready ...";
### Added By MTimer www.mtimer.net ###
OS=`uname`;
ADMIN_USER=admin
DB_USER=da_admin
ADMIN_PASS=`perl -le'print map+(A..Z,a..z,0..9)[rand 62],0..7'`;
DB_ROOT_PASS=`perl -le'print map+(A..Z,a..z,0..9)[rand 62],0..7'`;
FTP_HOST=files.directadmin.com
if [ "$OS" = "FreeBSD" ]; then
WGET_PATH=/usr/local/bin/wget
else
WGET_PATH=/usr/bin/wget
fi
WGET_OPTION="";
COUNT=`$WGET_PATH --help | grep -c no-check-certificate`
if [ "$COUNT" -ne 0 ]; then
WGET_OPTION="--no-check-certificate";
fi
#WGET_10=`$WGET_PATH -V 2>/dev/null | head -n1 | grep -c 1.10`
#WGET_OPTION="";
#if [ $WGET_10 -eq 1 ]; then
# WGET_OPTION="--no-check-certificate";
#fi
CID=0;
LID=0;
HOST=`hostname`;
CMD_LINE=0;
ETH_DEV=eth0;
IP=0
if [ $# -gt 0 ]; then
case "$1" in
--help|help|\?|-\?|h)
echo "";
echo "Usage: $0";
echo "";
echo "or";
echo "";
echo "Usage: $0 <uid> <lid> <hostname> <ethernet_dev> (<ip>)";
echo " <uid> : Your Client ID";
echo " <lid> : Your License ID";
echo " <hostname> : Your server's hostname (FQDN)";
echo " <ethernet_dev> : Your ethernet device with the server IP";
echo " <ip> : Optional. Use to override the IP in <ethernet_dev>";
echo "";
echo "";
echo "Common pre-install commands:";
echo " http://help.directadmin.com/item.php?id=354";
exit 0;
;;
esac
CID=$1;
LID=$2;
HOST=$3;
if [ $# -lt 4 ]; then
$0 --help
exit 56;
fi
ETH_DEV=$4;
CMD_LINE=1;
if [ $# -gt 4 ]; then
IP=$5;
fi
fi
B64=0
if [ "$OS" = "FreeBSD" ]; then
B64=`uname -m | grep -c 64`
if [ "$B64" -gt 0 ]; then
echo "*** 64-bit OS ***";
echo "*** that being said, this should be a FreeBSD 7, 8 or 9 system. ***";
sleep 2;
B64=1
fi
else
B64=`uname -m | grep -c 64`
if [ "$B64" -gt 0 ]; then
echo "*** 64-bit OS ***";
echo "";
sleep 2;
B64=1
fi
fi
if [ -e /usr/local/directadmin ]; then
echo "";
echo "";
echo "*** DirectAdmin already exists ***";
echo " Press Ctrl-C within the next 10 seconds to cancel the install";
echo " Else, wait, and the install will continue, but will destroy existing data";
echo "";
echo "";
sleep 10;
fi
if [ -e /usr/local/cpanel ]; then
echo "";
echo "";
echo "*** CPanel exists on this system ***";
echo " Press Ctrl-C within the next 10 seconds to cancel the install";
echo " Else, wait, and the install will continue overtop (as best it can)";
echo "";
echo "";
sleep 10;
fi
OS_VER=;
REDHAT_RELEASE=/etc/redhat-release
DEBIAN_VERSION=/etc/debian_version
DA_PATH=/usr/local/directadmin
CB_OPTIONS=${DA_PATH}/custombuild/options.conf
SCRIPTS_PATH=$DA_PATH/scripts
PACKAGES=$SCRIPTS_PATH/packages
SETUP=$SCRIPTS_PATH/setup.txt
SERVER=http://files.directadmin.com/services
if [ $OS = "FreeBSD" ]; then
OS_VER=`uname -r | cut -d- -f1`
elif [ -e /etc/fedora-release ]; then
OS=fedora
OS_VER=`cat /etc/fedora-release | cut -d\ -f4`
if [ "$OS_VER" = "(Moonshine)" ]; then
OS_VER=`cat /etc/fedora-release | cut -d\ -f3`
fi
if [ "$OS_VER" = "(Werewolf)" ]; then
OS_VER=`cat /etc/fedora-release | cut -d\ -f3`
fi
if [ "$OS_VER" = "(Sulphur)" ]; then
OS_VER=`cat /etc/fedora-release | cut -d\ -f3`
fi
elif [ -e /etc/whitebox-release ]; then
if [ ! -e /etc/redhat-release ]; then
ln -s /etc/whitebox-release /etc/redhat-release
fi
OS_VER=`cat /etc/redhat-release | cut -d\ -f5`
elif [ -e $DEBIAN_VERSION ]; then
OS=debian
OS_VER=`cat $DEBIAN_VERSION | head -n1`
if [ "$OS_VER" = "testing/unstable" ]; then
OS_VER=3.1
fi
if [ "$OS_VER" = "lenny/sid" ]; then
OS_VER=5.0
fi
if [ "$OS_VER" = "squeeze/sid" ]; then
OS_VER=6.0
#should be 6.0, but used to be 5.
fi
if [ "$OS_VER" = "wheezy/sid" ]; then
OS_VER=6.0
echo "";
echo "********************************************************************************************";
echo "";
echo "This is debian wheezy/unstable, which is debian 7 beta, which we do not yet support.";
echo "please install debian 6.x instead";
echo "";
echo "See debian releases:";
echo " http://www.debian.org/releases/";
echo "";
exit 99;
fi
else
OS_VER=`cat /etc/redhat-release | cut -d\ -f5`
fi
if [ "$OS_VER" = "release" ]; then
OS=Enterprise
OS_VER=`cat /etc/redhat-release | cut -d\ -f6`
elif [ "$OS_VER" = "ES" ]; then
OS=Enterprise
OS_VER=`cat /etc/redhat-release | cut -d\ -f7`
elif [ "$OS_VER" = "WS" ]; then
OS=Enterprise
OS_VER=`cat /etc/redhat-release | cut -d\ -f7`
elif [ "$OS_VER" = "AS" ]; then
OS=Enterprise
OS_VER=`cat /etc/redhat-release | cut -d\ -f7`
elif [ "$OS_VER" = "Server" ]; then
OS=Enterprise
OS_VER=`cat /etc/redhat-release | cut -d\ -f7`
elif [ "`cat /etc/redhat-release 2>/dev/null| cut -d\ -f1`" = "CentOS" ]; then
OS=Enterprise
OS_VER=`cat /etc/redhat-release |cut -d\ -f3`;
if [ "$OS_VER" = "release" ]; then
OS_VER=`cat /etc/redhat-release | cut -d\ -f4`
fi
elif [ "`cat /etc/redhat-release 2>/dev/null| cut -d\ -f3`" = "Enterprise" ]; then
OS=Enterprise
OS_VER=`cat /etc/redhat-release 2>/dev/null| cut -d\ -f7`
elif [ "`cat /etc/redhat-release 2>/dev/null| cut -d\ -f1`" = "CloudLinux" ]; then
OS=Enterprise
OS_VER=`cat /etc/redhat-release 2>/dev/null| cut -d\ -f4`
fi
# Get the services file name:
# services72.tar.gz
# services73.tar.gz
# services80.tar.gz
# services90.tar.gz
# services_freebsd48.tar.gz
SERVICES="";
if [ "$OS" = "fedora" ]; then
case "$OS_VER" in
1|1.90) SERVICES=services_fedora1.tar.gz
;;
2|2.0) SERVICES=services_fedora2.tar.gz
;;
3|3.0) SERVICES=services_fedora3.tar.gz
;;
4|4.0) SERVICES=services_fedora4.tar.gz
;;
5|5.0) SERVICES=services_fedora5.tar.gz
;;
6|6.0) SERVICES=services_fedora6.tar.gz
;;
7|7.0|8|8.0) SERVICES=services_fedora7.tar.gz
;;
9|9.0) SERVICES=services_fedora9.tar.gz
;;
esac
elif [ "$OS" = "debian" ]; then
OS_VER=`echo $OS_VER | cut -d. -f1,2`
if [ "$B64" -eq 1 ]; then
case "$OS_VER" in
#5.0|5.0.1|5.0.2|5.0.3|5.0.4|5.0.5|5.0.6|5.0.7|5.0.8|5.0.9|5.1) SERVICES=services_debian50_64.tar.gz
5.0|5.1|5) SERVICES=services_debian50_64.tar.gz
;;
6.0|6.1|6) SERVICES=services_debian60_64.tar.gz
;;
*) SERVICES=services_debian50_64.tar.gz
;;
esac
else
case "$OS_VER" in
3.0|3) SERVICES=services_debian30.tar.gz
;;
3.1) SERVICES=services_debian31.tar.gz
;;
#5|5.0|5.0.1|5.0.2|5.0.3|5.0.4|5.0.5|5.0.6|5.0.7|5.0.8|5.0.9|5.1) SERVICES=services_debian50.tar.gz
5|5.0|5.1) SERVICES=services_debian50.tar.gz
;;
6|6.0|6.1) SERVICES=services_debian60.tar.gz
;;
*) SERVICES=services_debian31.tar.gz
;;
esac
fi
elif [ "$OS" = "FreeBSD" ] && [ "$B64" -eq 0 ]; then
case "$OS_VER" in
4.8|4.9|4.10|4.11) SERVICES=services_freebsd48.tar.gz
;;
5.0|5.1|5.2|5.2.1|5.3|5.4|5.5) SERVICES=services_freebsd51.tar.gz
;;
6.0|6.1|6.2|6.3|6.4) SERVICES=services_freebsd60.tar.gz
;;
7|7.0|7.1|7.2|7.3|7.4|7.5) SERVICES=services_freebsd70.tar.gz
;;
esac
elif [ "$OS" = "FreeBSD" ] && [ "$B64" -eq 1 ]; then
case "$OS_VER" in
7|7.0|7.1|7.2|7.3|7.4|7.5) SERVICES=services_freebsd71_64.tar.gz
;;
8|8.0|8.1|8.2|8.3) SERVICES=services_freebsd80_64.tar.gz
;;
9|9.0|9.1|9.2|9.3) SERVICES=services_freebsd90_64.tar.gz
;;
esac
elif [ $B64 -eq 1 ]; then
case "$OS_VER" in
4.0|4.1|4.2|4.3|4.4|4.5|4.6|4.7|4.8|4.9) SERVICES=services_es41_64.tar.gz
;;
5|5.0|5.1|5.2|5.3|5.4|5.5|5.6|5.7|5.8|5.9|5.10) SERVICES=services_es50_64.tar.gz
;;
6|6.0|6.1|6.2|6.3|6.4|6.5|6.6|6.7|6.8|6.9|6.10) SERVICES=services_es60_64.tar.gz
;;
7|6.0|7.1|7.2|7.3|7.4) SERVICES=services_es70_64.tar.gz
esac
else
case "$OS_VER" in
7.2) SERVICES=services72.tar.gz
;;
7.3) SERVICES=services73.tar.gz
;;
8.0) SERVICES=services80.tar.gz
;;
9|9.0) SERVICES=services90.tar.gz
;;
2.1|3|3.0|3.1|3.3|3.4|3.5|3.6|3.7|3.8|3.9) SERVICES=services_es30.tar.gz
;;
4|4.0|4.1|4.2|4.3|4.4|4.5|4.6|4.7|4.8|4.9) SERVICES=services_es40.tar.gz
;;
5|5.0|5.1|5.2|5.3|5.4|5.5|5.6|5.7|5.8|5.9|5.10) SERVICES=services_es50.tar.gz
;;
6|6.0|6.1|6.2|6.3|6.4|6.5|6.6|6.7|6.8|6.9|6.10) SERVICES=services_es60.tar.gz
;;
7|7.0|7.1|7.2|7.3|7.4) SERVICES=services_es70.tar.gz
esac
fi
if [ "$SERVICES" = "" ]; then
yesno="n";
while [ $yesno = "n" ];
do
{
echo "";
echo "*** Unable to determine which services pack to use ***";
echo "";
echo "Please type in the file name closest to your system from the following list:";
echo "";
echo "Redhat:";
echo " services72.tar.gz";
echo " services73.tar.gz";
echo " services80.tar.gz";
echo " services90.tar.gz";
echo "";
echo "Fedora:";
echo " services_fedora1.tar.gz";
echo " services_fedora2.tar.gz";
echo " services_fedora3.tar.gz";
echo " services_fedora4.tar.gz";
echo " services_fedora5.tar.gz";
echo " services_fedora6.tar.gz";
echo " services_fedora7.tar.gz";
echo " services_fedora9.tar.gz";
echo "";
echo "Enterprise/Whitebox/CentOS:";
echo " services_es30.tar.gz";
echo " services_es40.tar.gz";
echo " services_es50.tar.gz";
echo " services_es60.tar.gz";
echo " services_es70.tar.gz";
echo " services_es41_64.tar.gz";
echo " services_es50_64.tar.gz";
echo " services_es60_64.tar.gz";
echo " services_es70_64.tar.gz";
echo "";
echo "FreeBSD:";
echo " services_freebsd48.tar.gz";
echo " services_freebsd49.tar.gz";
echo " services_freebsd51.tar.gz";
echo " services_freebsd60.tar.gz";
echo " services_freebsd70.tar.gz";
echo " services_freebsd71_64.tar.gz";
echo " services_freebsd80_64.tar.gz";
echo " services_freebsd90_64.tar.gz";
echo "";
echo "Debian:";
echo " services_debian30.tar.gz";
echo " services_debian31.tar.gz";
echo " services_debian50.tar.gz";
echo " services_debian50_64.tar.gz";
echo " services_debian60.tar.gz";
echo " services_debian60_64.tar.gz";
echo "";
echo -n "Type the filename: ";
read SERVICES
echo "";
echo "Value entered: $SERVICES";
echo -n "Is this correct? (y,n) : ";
read yesno;
}
done;
fi
/bin/mkdir -p $PACKAGES
yesno=n;
if [ "$CMD_LINE" -eq 1 ]; then
yesno=y;
else
echo "*****************************************************";
echo "*";
echo "* Directadmin v1.44.3 Nulled by Yvonne Lu";
echo "* Improved By MTimer";
echo "*";
echo "*****************************************************";
fi
while [ "$yesno" = "n" ];
do
{
echo -n "Please enter your Client ID : ";
read CID;
echo -n "Please enter your License ID : ";
read LID;
echo -e "Please enter your hostname \(server.domain.com\)";
echo "It must be a Fully Qualified Domain Name";
echo "Do *not* use a domain you plan on using for the hostname:";
echo "eg. don't use domain.com. Use server.domain.com instead.";
echo "Do not enter http:// or www";
echo "";
echo -n "Enter your hostname (FQDN) : ";
read HOST;
echo "Client ID: $CID";
echo "License ID: $LID";
echo "Hostname: $HOST";
echo -n "Is this correct? (y,n) : ";
read yesno;
}
done;
############
# Get the other info
EMAIL=${ADMIN_USER}@${HOST}
TEST=`echo $HOST | cut -d. -f3`
if [ "$TEST" = "" ]
then
NS1=ns1.`echo $HOST | cut -d. -f1,2`
NS2=ns2.`echo $HOST | cut -d. -f1,2`
else
NS1=ns1.`echo $HOST | cut -d. -f2,3,4,5,6`
NS2=ns2.`echo $HOST | cut -d. -f2,3,4,5,6`
fi
## Get the ethernet_dev
if [ $OS = "FreeBSD" ]; then
if [ $CMD_LINE -eq 0 ]; then
DEVS=`/sbin/ifconfig -a | grep -e "^[a-z]" | cut -d: -f1 |grep -v lp0|grep -v lo0|grep -v tun0|grep -v sl0|grep -v ppp0|grep -v faith0`
COUNT=0;
for i in $DEVS; do
{
COUNT=$(($COUNT+1));
};
done;
if [ $COUNT -eq 0 ]; then
echo "Could not find your ethernet device.";
echo -n "Please enter the name of your ethernet device: ";
read ETH_DEV;
elif [ $COUNT -eq 1 ]; then
echo -n "Is $DEVS your network adaptor with the license IP? (y,n) : ";
read yesno;
if [ "$yesno" = "n" ]; then
echo -n "Enter the name of the ethernet device you wish to use : ";
read ETH_DEV;
else
ETH_DEV=$DEVS
fi
else
# more than one
echo "The following ethernet devices were found. Please enter the name of the one you wish to use:";
echo "";
echo $DEVS;
echo "";
echo -n "Enter the device name: ";
read ETH_DEV;
fi
fi
echo "Using $ETH_DEV";
if [ "$IP" = "0" ]; then
IP=`/sbin/ifconfig $ETH_DEV | grep 'inet ' | head -n1 | cut -d\ -f2`
fi
echo "Using $IP";
NM_HEX=`/sbin/ifconfig $ETH_DEV | grep 'inet ' | head -n1 | cut -d\ -f4 | cut -dx -f2 | tr '[a-f]' '[A-F]'`
NMH1=`echo $NM_HEX | awk '{print substr($1,1,2)}'`
NMH2=`echo $NM_HEX | awk '{print substr($1,3,2)}'`
NMH3=`echo $NM_HEX | awk '{print substr($1,5,2)}'`
NMH4=`echo $NM_HEX | awk '{print substr($1,7,2)}'`
NM1=`echo "ibase=16; $NMH1" | bc`
NM2=`echo "ibase=16; $NMH2" | bc`
NM3=`echo "ibase=16; $NMH3" | bc`
NM4=`echo "ibase=16; $NMH4" | bc`
NM=$NM1.$NM2.$NM3.$NM4;
else
if [ $CMD_LINE -eq 0 ]; then
DEVS=`/sbin/ifconfig -a | grep -e "^[a-z]" | awk '{ print $1; }' | grep -v lo | grep -v sit0 | grep -v ppp0 | grep -v faith0`
COUNT=0;
for i in $DEVS; do
{
COUNT=$(($COUNT+1));
};
done;
if [ $COUNT -eq 0 ]; then
echo "Could not find your ethernet device.";
echo -n "Please enter the name of your ethernet device: ";
read ETH_DEV;
elif [ $COUNT -eq 1 ]; then
DIP=`/sbin/ifconfig $DEVS | grep 'inet addr:' | cut -d: -f2 | cut -d\ -f1`;
echo -n "Is $DEVS your network adaptor with the license IP ($DIP)? (y,n) : ";
read yesno;
if [ "$yesno" = "n" ]; then
echo -n "Enter the name of the ethernet device you wish to use : ";
read ETH_DEV;
else
ETH_DEV=$DEVS
fi
else
# more than one
echo "The following ethernet devices/IPs were found. Please enter the name of the device you wish to use:";
echo "";
#echo $DEVS;
for i in $DEVS; do
{
DIP=`/sbin/ifconfig $i | grep 'inet addr:' | cut -d: -f2 | cut -d\ -f1`;
echo "$i $DIP";
};
done;
echo "";
echo -n "Enter the device name: ";
read ETH_DEV;
fi
#echo -n "Is $ETH_DEV your network adaptor with the license IP? (y,n) : ";
#read yesno;
#if [ "$yesno" = "n" ]; then
# echo -n "Enter the name of the ethernet device you wish to use : ";
# read ETH_DEV;
#fi
fi
if [ "$IP" = "0" ]; then
IP=`/sbin/ifconfig $ETH_DEV | grep 'inet addr:' | cut -d: -f2 | cut -d\ -f1`;
fi
NM=`/sbin/ifconfig $ETH_DEV | grep 'Mask:' | cut -d: -f4`;
fi
if [ $CMD_LINE -eq 0 ]; then
if [ "$IP" = "" ]; then
yesno="n";
else
echo -n "Is $IP the IP in your license? (y,n) : ";
read yesno;
fi
if [ "$yesno" = "n" ]; then
echo -n "Enter the IP used in your license file : ";
read IP;
fi
if [ "$IP" = "" ]; then
echo "The IP entered is blank. Please try again, and enter a valid IP";
fi
fi
############
echo "";
echo "DirectAdmin will now be installed on: $OS $OS_VER";
if [ $CMD_LINE -eq 0 ]; then
echo -n "Is this correct? (must match license) (y,n) : ";
read yesno;
if [ "$yesno" = "n" ]; then
echo -e "\nPlease change the value in your license, or install the correct operating system\n";
exit 1;
fi
fi
################
if [ $CMD_LINE -eq 0 ]; then
echo "";
echo "You now have 4 options for your apache/php setup.";
echo "";
echo "1: customapache: end-of-life software. Apache 1.3, php 4, frontpage. Do not use. No support.";
echo "2: custombuild 1.1: older software. Apache 2.x, php 4, 5, or both in cli and/or suphp. Defaults to php 5.2";
echo "3: custombuild 1.2: * Recommended. simlar to 1.1, newer default versions. Apache 2.x, php 5, 6, or both in cli and/or suphp. Defaults to php 5.3";
echo "4: custombuild 2.0 ALPHA: Not yet recommended, still in testing. Apache 2.4, mod_ruid2, php 5.4. Can be set to use php-FPM. Experts only. Requires pre-release binaries.";
echo "";
echo " Post any issues with custombuild to the forum: http://www.directadmin.com/forum/forumdisplay.php?f=61";
echo "";
#echo -n "Enter your choice (1 or 2): ";
echo -n "Enter your choice (1, 2, 3 or 4): ";
read onetwo;
if [ "$onetwo" = "2" ] || [ "$onetwo" = "3" ] || [ "$onetwo" = "4" ]; then
CB_VER=1.1
PHP_V=5.2
PHP_T=cli
AP_VER=2.2
RUID="";
if [ "$onetwo" = "3" ]; then
CB_VER=1.2
PHP_V=5.3
fi
if [ "$onetwo" = "4" ]; then
CB_VER=2.0
PHP_V=5.4
AP_VER=2.4
RUID=" with mod_ruid2";
if [ "${OS}" = "FreeBSD" ]; then
RUID="";
PHP_T=suPhp
fi
fi
echo "You have chosen custombuild $CB_VER.";
echo "$CB_VER" > /root/.custombuild
#grab the build file.
CBPATH=$DA_PATH/custombuild
mkdir -p $CBPATH
BUILD=$CBPATH/build
BFILE=$SERVER/custombuild/${CB_VER}/custombuild/build
if [ $OS = "FreeBSD" ]; then
fetch -o $BUILD $BFILE
else
$WGET_PATH -O $BUILD $BFILE
fi
chmod 755 $BUILD
echo "";
echo -n "Would you like the default settings of apache ${AP_VER}${RUID} and php ${PHP_V} ${PHP_T}? (y/n): ";
read yesno;
if [ "$yesno" = "n" ]; then
echo "You have chosen to customize the custombuild options. Please wait while options configurator is downloaded... ";
echo "";
if [ -e $BUILD ]; then
$BUILD create_options
else
echo "unable to download the build file. Using defaults instead.";
fi
else
echo "Using the default settings for custombuild.";
fi
echo -n "Would you like to search for the fastest download mirror? (y/n): ";
read yesno;
if [ "$yesno" = "y" ]; then
$BUILD set_fastest;
if [ -s "${CB_OPTIONS}" ]; then
DL=`grep ^downloadserver= ${CB_OPTIONS} | cut -d= -f2`
if [ "${DL}" != "" ]; then
SERVER=http://${DL}/services
FTP_HOST=${DL}
fi
fi
fi
else
echo "Using customapache with apache 1.3 and php 4.";
fi
sleep 2
fi
##########
echo "beginning pre-checks, please wait...";
# Things to check for:
#
# bison
# flex
# webalizer
# bind (named)
# patch
# openssl-devel
# wget
BIN_DIR=/usr/bin
LIB_DIR=/usr/lib
if [ $OS = "FreeBSD" ]; then
BIN_DIR=/usr/local/bin
LIB_DIR=/usr/local/lib
fi
checkFile()
{
if [ -e $1 ]; then
echo 1;
else
echo 0;
fi
}
if [ $OS = "FreeBSD" ]; then
PERL=`pkg_info | grep -ce '^perl'`;
else
PERL=`checkFile /usr/bin/perl`;
fi
BISON=`checkFile $BIN_DIR/bison`;
FLEX=`checkFile /usr/bin/flex`;
WEBALIZER=`checkFile $BIN_DIR/webalizer`;
BIND=`checkFile /usr/sbin/named`;
PATCH=`checkFile /usr/bin/patch`;
SSL_DEVEL=`checkFile /usr/include/openssl/ssl.h`;
WGET=`checkFile $BIN_DIR/wget`;
WGET_PATH=$BIN_DIR/wget;
KRB5=`checkFile /usr/kerberos/include/krb5.h`;
KILLALL=`checkFile /usr/bin/killall`;
if [ $KRB5 -eq 0 ]; then
KRB5=`checkFile /usr/include/krb5.h`;
fi
if [ $OS = "FreeBSD" ]; then
GD=`checkFile $LIB_DIR/libgd.so.2`;
else
GD=`checkFile $LIB_DIR/libgd.so.1`; #1.8.4
fi
CURLDEV=`checkFile /usr/include/curl/curl.h`
E2FS=1;
E2FS_DEVEL=1;
if [ -e /etc/fedora-release ]; then
E2FS=`checkFile /lib/libcom_err.so.2`;
E2FS_DEVEL=`checkFile /usr/include/et/com_err.h`;
fi
if [ "$OS" = "Enterprise" ]; then
if [ $B64 -eq 1 ]; then
E2FS=`checkFile /lib64/libcom_err.so.2`;
else
E2FS=`checkFile /lib/libcom_err.so.2`;
fi
E2FS_DEVEL=`checkFile /usr/include/et/com_err.h`;
fi
###############################################################################
###############################################################################
# We now have all information gathered, now we need to start making decisions
if [ "$OS" = "debian" ]; then
if [ -e /bin/bash ] && [ -e /bin/dash ]; then
COUNT=`ls -la /bin/sh | grep -c dash`
if [ "$COUNT" -eq 1 ]; then
ln -sf bash /bin/sh
fi
fi
apt-get -y install ca-certificates
fi
if [ "$OS" = "debian" ] && [ "$OS_VER" = "3.0" ]; then
COUNT=`cat /etc/apt/sources.list |grep backports |grep -c debconf`
if [ "$COUNT" -eq 0 ]; then
echo "deb http://www.backports.org/debian/ woody debconf" >> /etc/apt/sources.list
fi
fi
if [ $WGET -eq 0 ]; then
if [ "$OS" = "FreeBSD" ]; then
echo "wget not found: Attempting to install wget ... ";
if [ "$B64" -eq 1 ]; then
case "$OS_VER" in
7.0|7.1|7.2|7.3|7.4|7.5) pkg_add -r http://$FTP_HOST/services/packages-7.1-release/Latest/wget.tbz
;;
8.0|8.1|8.2|8.3) pkg_add -r http://$FTP_HOST/services/packages-8.0-release/Latest/wget.tbz
;;
9.0|9.1|9.2|9.3) pkg_add -r http://$FTP_HOST/services/packages-9.0-release/Latest/wget.tbz
;;
esac
else
case "$OS_VER" in
7.0|7.1|7.2|7.3|7.4|7.5) pkg_add -r http://$FTP_HOST/services/packages-7-stable/Latest/wget.tbz
;;
6.0|6.1|6.2|6.3|6.4) pkg_add -r http://$FTP_HOST/services/packages-6-stable/Latest/wget.tbz
;;
5.3|5.4|5.5) pkg_add -r http://$FTP_HOST/services/packages-5.3-release/Latest/wget.tbz
;;
5.2.1) pkg_add -r http://$FTP_HOST/services/packages-5.2.1-release/Latest/wget.tbz
;;
4.8|4.9) pkg_add -r http://$FTP_HOST/services/packages-4-stable/Latest/wget.tgz
;;
4.10|4.11) pkg_add -r http://$FTP_HOST/services/packages-4.10-release/Latest/wget.tgz
;;
*) pkg_add -r http://$FTP_HOST/services/packages-5-stable/Latest/wget.tbz
;;
esac
fi
elif [ "$OS" = "debian" ]; then
echo "wget not found: Attempting to install wget ... ";
apt-get -y install wget
D64POST=""
if [ "$B64" -eq 1 ]; then
D64POST="_64"
fi
#the default wget from apt-get doesn't have https support
if [ -e $WGET_PATH ]; then
$WGET_PATH -O $WGET_PATH.new $SERVER/debian_${OS_VER}${D64POST}/wget
mv -f $WGET_PATH $WGET_PATH.old
mv -f $WGET_PATH.new $WGET_PATH
chmod 755 $WGET_PATH
fi
else
echo "*** wget not found: you *must* install wget (yum -y install wget)";
exit 2;
fi
WGET_10=`$WGET_PATH -V 2>/dev/null | head -n1 | grep -c 1.10`
WGET_OPTION="";
if [ $WGET_10 -eq 1 ]; then
WGET_OPTION="--no-check-certificate";
fi
fi
# Download the file that has the paths to all the relevant files.
FILES=$SCRIPTS_PATH/files.sh
if [ "$OS" != "FreeBSD" ]; then
FILES_PATH=$OS_VER
if [ "$OS" = "debian" ]; then
OS_VER=`echo $OS_VER | cut -d. -f1,2`
if [ "$OS_VER" = "5" ]; then
OS_VER=5.0
fi
if [ "$OS_VER" = "6" ]; then
OS_VER=6.0
fi
if [ $B64 -eq 1 ]; then
FILES_PATH=debian_${OS_VER}_64
else
FILES_PATH=debian_${OS_VER}
fi
elif [ "$OS" = "fedora" ]; then
case "$OS_VER" in
1|1.90) FILES_PATH=fedora_1
;;
2|2.0) FILES_PATH=fedora_2
;;
3|3.0) FILES_PATH=fedora_3
;;
4|4.0) FILES_PATH=fedora_4
;;
5|5.0) FILES_PATH=fedora_5
;;
6|6.0) FILES_PATH=fedora_6
;;
7|7.0) FILES_PATH=fedora_7
;;
8|8.0) FILES_PATH=fedora_8
;;
9|9.0) FILES_PATH=fedora_9
esac
elif [ $B64 -eq 1 ]; then
case "$OS_VER" in
4|4.0|4.1|4.2|4.3|4.4|4.5|4.6|4.7|4.8|4.9) FILES_PATH=es_4.1_64
;;
5|5.0|5.1|5.2) FILES_PATH=es_5.0_64
;;
5.3|5.4|5.5|5.6|5.7|5.8|5.9|5.10) FILES_PATH=es_5.3_64
;;
6.0|6.1|6.2|6.3|6.4|6.5|6.6|6.7|6.8) FILES_PATH=es_6.0_64
;;
esac
elif [ "$OS" = "Enterprise" ]; then
case "$OS_VER" in
5|5.1|5.2) FILES_PATH=es_5.0
;;
5.3|5.4|5.5|5.6|5.7|5.8|5.9|5.10) FILES_PATH=es_5.3
;;
6.0|6.1|6.2|6.3|6.4|6.5|6.6|6.7|6.8) FILES_PATH=es_6.0
;;
esac
fi
wget -O $FILES $SERVER/$FILES_PATH/files.sh
if [ ! -e $FILES ]; then
echo "*** Unable to download files.sh";
echo "tried: $SERVER/$FILES_PATH/files.sh";
exit 3;
fi
chmod 755 $FILES;
. $FILES
fi
addPackage()
{
echo "adding $1 ...";
if [ "$OS" = "FreeBSD" ]; then
if [ "$B64" -eq 1 ]; then
case "$OS_VER" in
7|7.0|7.1|7.2|7.3|7.4|7.5) pkg_add -r http://$FTP_HOST/services/packages-7.1-release/Latest/${1}.tbz
;;
8|8.0|8.1|8.2|8.3) pkg_add -r http://$FTP_HOST/services/packages-8.0-release/Latest/${1}.tbz
;;
9|9.0|9.1|9.2|9.3) pkg_add -r http://$FTP_HOST/services/packages-9.0-release/Latest/${1}.tbz
;;
esac
else
case "$OS_VER" in
7|7.0|7.1|7.2|7.3|7.4|7.5) pkg_add -r http://$FTP_HOST/services/packages-7-stable/Latest/${1}.tbz
;;
6.0|6.1|6.2|6.3|6.4) pkg_add -r http://$FTP_HOST/services/packages-6-stable/Latest/${1}.tbz
;;
5.3|5.4|5.5) pkg_add -r http://$FTP_HOST/services/packages-5.3-release/Latest/${1}.tbz
;;
5.2.1) pkg_add -r http://$FTP_HOST/services/packages-5.2.1-release/Latest/${1}.tbz
;;
4.8|4.9) pkg_add -r http://$FTP_HOST/services/packages-4-stable/Latest/${1}.tgz
;;
4.10|4.11) pkg_add -r http://$FTP_HOST/services/packages-4.10-release/Latest/${1}.tgz
;;
*) pkg_add -r http://$FTP_HOST/services/packages-5-stable/Latest/${1}.tbz
;;
esac
fi
elif [ "$OS" = "debian" ]; then
if [ "$3" = "0" ]; then
return;
fi
if [ "$3" = "" ]; then
apt-get -y install $1
else