forked from hetzneronline/installimage
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfunctions.sh
executable file
·3855 lines (3340 loc) · 121 KB
/
functions.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
#
# functions
#
# originally written by Florian Wicke and David Mayr
# (c) 2007-2015, Hetzner Online GmbH
#
# nil settings parsed out of the config
PART_COUNT=""
PART_MOUNT=""
PART_FS=""
PART_SIZE=""
PARTS_SUM_SIZE=""
MOUNT_POINT_SIZE=""
HASROOT=""
SWRAID=""
SWRAIDLEVEL=""
LVM=""
LVM_VG_CHECK=""
IMAGE_PATH=""
IMAGE_PATH_TYPE=""
IMAGE_FILE=""
IMAGE_FILE_TYPE=""
IMAGE_SIGN=""
IMAGE_PUBKEY=""
IMAGE_PUBKEY_IMPORTED=""
IAM=""
IMG_VERSION=0
BOOTLOADER=""
GOVERNOR=""
SFDISKPARTS=""
COUNT_DRIVES="0"
LAST_PART_START=""
LAST_PART_END=""
DISK_SIZE_SECTORS=""
SYSTEMROOTDEVICE=""
SYSTEMBOOTDEVICE=""
SYSTEMREALBOOTDEVICE=""
EXTRACTFROM=""
ETHDEV=""
HWADDR=""
IPADDR=""
BROADCAST=""
SUBNETMASK=""
GATEWAY=""
NETWORK=""
IP6ADDR=""
IP6PREFLEN=""
IP6GATEWAY=""
ROOTHASH=""
LILOEXTRABOOT=""
ERROREXIT="0"
FINALIMAGEPATH=""
PLESK_STD_VERSION="PLESK_12_0_18"
SYSMFC=$(dmidecode -s system-manufacturer 2>/dev/null | head -n1)
SYSTYPE=$(dmidecode -s system-product-name 2>/dev/null | head -n1)
MBTYPE=$(dmidecode -s baseboard-product-name 2>/dev/null | head -n1)
# functions
# show text in a different color
echo_red() {
echo -e "\033[01;31m$*\033[00m"
}
echo_green() {
echo -e "\033[01;32m$*\033[00m"
}
echo_bold() {
echo -e "\033[0;1m$*\033[00m"
}
# generate submenus to choose which image to install
# generate_menu "SUBMENU"
generate_menu() {
# security check - just execute the function WITH parameters
if [ "$1" ]; then
# empty the menu
MENULIST=""
PROXMOX=false
# find image-files and generate raw list
FINALIMAGEPATH="$IMAGESPATH"
if [ "$1" = "openSUSE" ]; then
RAWLIST=`ls -1 $IMAGESPATH | grep -i -e "^$1\|^old_$1\|^suse\|^old_suse"`
elif [ "$1" = "Virtualization" ]; then
RAWLIST=""
RAWLIST=`ls -1 $IMAGESPATH | grep -i -e "^CoreOS"`
RAWLIST="$RAWLIST Proxmox-Virtualization-Environment-on-Debian-Wheezy"
elif [ "$1" = "old_images" ]; then
RAWLIST=`ls -1 $OLDIMAGESPATH`
FINALIMAGEPATH="$OLDIMAGESPATH"
else
RAWLIST=`ls -1 $IMAGESPATH | grep -i -e "^$1\|^old_$1"`
fi
# Remove CPANEL image and signature files from list
RAWLIST="`echo $RAWLIST |tr ' ' '\n' |egrep -i -v "cpanel|.sig$"`"
# check if 32-bit rescue is activated and disable 64-bit images then
ARCH="`uname -m`"
if [ "$ARCH" != "x86_64" ]; then
RAWLIST="`echo $RAWLIST |tr ' ' '\n' |grep -v "\-64\-[a-zA-Z]"`"
fi
# generate formatted list for usage with "dialog"
for i in $RAWLIST; do
TEMPVAR="$i"
TEMPVAR=`basename $TEMPVAR .bin`
TEMPVAR=`basename $TEMPVAR .bin.bz2`
TEMPVAR=`basename $TEMPVAR .txz`
TEMPVAR=`basename $TEMPVAR .tar.xz`
TEMPVAR=`basename $TEMPVAR .tgz`
TEMPVAR=`basename $TEMPVAR .tar.gz`
TEMPVAR=`basename $TEMPVAR .tbz`
TEMPVAR=`basename $TEMPVAR .tar.bz`
TEMPVAR=`basename $TEMPVAR .tar.bz2`
TEMPVAR=`basename $TEMPVAR .tar`
MENULIST=$MENULIST"$TEMPVAR . "
done
# add "back to mainmenu" entry
MENULIST=$MENULIST'back . '
# show menu and get result
dialog --backtitle "$DIATITLE" --title "$1 images" --no-cancel --menu "choose image" 0 0 0 $MENULIST 2>$FOLD/submenu.chosen
IMAGENAME=`cat $FOLD/submenu.chosen`
# create proxmox post-install file if needed
case $IMAGENAME in
Proxmox-Virtualization-Environment*)
case "$IMAGENAME" in
Proxmox-Virtualization-Environment-on-Debian-Wheezy) export PROXMOX_VERSION="3" ;;
esac
cp $SCRIPTPATH/post-install/proxmox$PROXMOX_VERSION /post-install
chmod 0755 /post-install
PROXMOX=true
IMAGENAME=`eval echo \\$PROXMOX${PROXMOX_VERSION}_BASE_IMAGE`
DEFAULTPARTS=""
DEFAULTPARTS="$DEFAULTPARTS\nPART /boot ext3 512M"
DEFAULTPARTS="$DEFAULTPARTS\nPART lvm vg0 all\n"
DEFAULTPARTS="$DEFAULTPARTS\nLV vg0 root / ext3 15G"
DEFAULTPARTS="$DEFAULTPARTS\nLV vg0 swap swap swap 6G"
;;
CoreOS*)
PROXMOX=false
;;
*)
: # no proxmox installation
;;
esac
whoami "$IMAGENAME"
fi
}
# create new config file from standardconfig and misc options
# create_config "IMAGENAME"
create_config() {
if [ "$1" ]; then
CNF="$FOLD/install.conf"
getdrives; EXITCODE=$?
if [ $COUNT_DRIVES -eq 0 ] ; then
graph_notice "There are no drives in your server!\nIf there is a raid controller in your server, please configure it!\n\nThe setup will quit now!"
return 1
fi
echo -e "## ===================================================" > $CNF
echo -e "## Hetzner Online GmbH - installimage - standardconfig " >> $CNF
echo -e "## ===================================================" >> $CNF
echo -e "" >> $CNF
# first drive
echo -e "\n" >> $CNF
echo -e "## ====================" >> $CNF
echo -e "## HARD DISK DRIVE(S):" >> $CNF
echo -e "## ====================\n" >> $CNF
[ $COUNT_DRIVES -gt 2 ] && echo -e "## PLEASE READ THE NOTES BELOW!" >> $CNF
echo -e "" >> $CNF
local found_optdrive=0
local optdrive_count=0
for i in $(seq 1 $COUNT_DRIVES) ; do
DISK="$(eval echo \$DRIVE${i})"
OPTDISK="$(eval echo \$OPT_DRIVE${i})"
if [ -n "$OPTDISK" ] ; then
optdrive_count=$[$optdrive_count+1]
found_optdrive=1
hdinfo /dev/$OPTDISK >>$CNF
echo "DRIVE$i /dev/$OPTDISK" >>$CNF
else
hdinfo $DISK >>$CNF
# comment drive out when not given via commandline
[ $found_optdrive -eq 1 ] && echo -n "# " >>$CNF
echo "DRIVE$i $DISK" >>$CNF
fi
done
# reset drive count to number of drives explicitly passed via command line
[ $optdrive_count -gt 0 ] && COUNT_DRIVES=$optdrive_count
echo -e "" >> $CNF
if [ $COUNT_DRIVES -gt 2 ] ; then
if [ $COUNT_DRIVES -lt 4 ] ; then
echo "## if you dont want raid over your three drives then comment out the following line and set SWRAIDLEVEL not to 5" >>$CNF
echo "## please make sure the DRIVE[nr] variable is strict ascending with the used harddisks, when you comment out one or more harddisks" >>$CNF
else
echo "## if you dont want raid over all of your drives then comment out the following line and set SWRAIDLEVEL not to 5 or 6 or 10" >>$CNF
echo "## please make sure the DRIVE[nr] variable is strict ascending with the used harddisks, when you comment out one or more harddisks" >>$CNF
fi
fi
echo -e "" >> $CNF
# software-raid
if [ $COUNT_DRIVES -gt 1 ]; then
echo -e "\n" >> $CNF
echo -e "## ===============" >> $CNF
echo -e "## SOFTWARE RAID:" >> $CNF
echo -e "## ===============\n" >> $CNF
echo -e "## activate software RAID? < 0 | 1 >\n" >> $CNF
case "$OPT_SWRAID" in
0) echo -e "SWRAID 0" >> $CNF ;;
1) echo -e "SWRAID 1" >> $CNF ;;
*) echo -e "SWRAID $DEFAULTSWRAID" >> $CNF ;;
esac
echo >> $CNF
# available raidlevels
local raid_levels="0 1 5 6 10"
# set default raidlevel
local default_level=$DEFAULTTWODRIVESWRAIDLEVEL
if [ $COUNT_DRIVES -eq 3 ] ; then
default_level=$DEFAULTTHREEDRIVESWRAIDLEVEL
elif [ $COUNT_DRIVES -gt 3 ] ; then
default_level=$DEFAULTFOURDRIVESWRAIDLEVEL
fi
local set_level=""
local avail_level=""
# check for possible raidlevels
for level in $raid_levels ; do
# set raidlevel to given opt raidlevel
if [ -n "$OPT_SWRAIDLEVEL" ] ; then
[ $OPT_SWRAIDLEVEL -eq $level ] && set_level="$level"
fi
# no raidlevel 5 if less then 3 hdds
[ $level -eq 5 -a $COUNT_DRIVES -lt 3 ] && continue
# no raidlevel 6 if less then 4 hdds
[ $level -eq 6 -a $COUNT_DRIVES -lt 4 ] && continue
# no raidlevel 10 if less then 2 hdds
[ $level -eq 10 -a $COUNT_DRIVES -lt 2 ] && continue
# create list of all possible raidlevels
if [ -z "$avail_level" ] ; then
avail_level="$level"
else
avail_level="$avail_level | $level"
fi
done
[ -z "$set_level" ] && set_level="$default_level"
echo -e "## Choose the level for the software RAID < $avail_level >\n" >> $CNF
echo -e "SWRAIDLEVEL $set_level" >> $CNF
fi
# bootloader
# we no longer support lilo, so don't show this option if it isn't in the image
if [ "$IAM" = "arch" ] ||
[ "$IAM" = "coreos" ] ||
[ "$IAM" = "centos" ] ||
[ "$IAM" = "ubuntu" -a "$IMG_VERSION" -ge 1204 ] ||
[ "$IAM" = "debian" -a "$IMG_VERSION" -ge 70 ] ||
[ "$IAM" = "suse" -a "$IMG_VERSION" -ge 122 ]; then
NOLILO="true"
else
NOLILO=''
fi
echo -e "\n" >> $CNF
echo -e "## ============" >> $CNF
echo -e "## BOOTLOADER:" >> $CNF
echo -e "## ============\n" >> $CNF
if [ "$NOLILO" ]; then
echo -e "\n## Do not change. This image does not include or support lilo (grub only)!:\n" >> $CNF
echo "BOOTLOADER grub" >> $CNF
else
echo -e "\n## which bootloader should be used? < lilo | grub >\n" >> $CNF
case "$OPT_BOOTLOADER" in
lilo) echo "BOOTLOADER lilo" >> $CNF ;;
grub) echo "BOOTLOADER grub" >> $CNF ;;
*) echo "BOOTLOADER $DEFAULTLOADER" >> $CNF ;;
esac
echo -e "" >> $CNF
fi
# hostname
get_active_eth_dev
gather_network_information
echo -e "\n" >> $CNF
echo -e "## ==========" >> $CNF
echo -e "## HOSTNAME:" >> $CNF
echo -e "## ==========\n" >> $CNF
echo -e "## which hostname should be set?\n## \n" >> $CNF
# set default hostname to image name
DEFAULT_HOSTNAME="$1"
# or to proxmox if chosen
if [ "$PROXMOX" = "true" ]; then
echo -e "## This must be a FQDN otherwise installation will fail\n## \n" >> $CNF
DEFAULT_HOSTNAME="Proxmox-VE.localdomain"
fi
# or to the hostname passed through options
[ "$OPT_HOSTNAME" ] && DEFAULT_HOSTNAME="$OPT_HOSTNAME"
echo -e "HOSTNAME $DEFAULT_HOSTNAME" >> $CNF
echo -e "" >> $CNF
## Calculate how much hardisk space at raid level 0,1,5,6,10
RAID0=0
local small_hdd="$(smallest_hd)"
local small_hdd_size="$[$(blockdev --getsize64 $small_hdd)/1024/1024/1024]"
RAID0=$[$small_hdd_size*$COUNT_DRIVES]
RAID1=$small_hdd_size
if [ $COUNT_DRIVES -ge 3 ] ; then
RAID5=$[$RAID0-$small_hdd_size]
fi
if [ $COUNT_DRIVES -ge 4 ] ; then
RAID6=$[$RAID0-2*$small_hdd_size]
RAID10=$[$RAID0/2]
fi
# partitions
echo -e "\n" >> $CNF
echo -e "## ==========================" >> $CNF
echo -e "## PARTITIONS / FILESYSTEMS:" >> $CNF
echo -e "## ==========================\n" >> $CNF
echo -e "## define your partitions and filesystems like this:" >> $CNF
echo -e "##" >> $CNF
echo -e "## PART <mountpoint/lvm> <filesystem/VG> <size in MB>" >> $CNF
echo -e "##" >> $CNF
echo -e "## * <mountpoint/lvm> mountpoint for this filesystem *OR* keyword 'lvm'" >> $CNF
echo -e "## to use this PART as volume group (VG) for LVM" >> $CNF
echo -e "## * <filesystem/VG> can be ext2, ext3, reiserfs, xfs, swap *OR* name" >> $CNF
echo -e "## of the LVM volume group (VG), if this PART is a VG" >> $CNF
echo -e "## * <size> you can use the keyword 'all' to assign all the" >> $CNF
echo -e "## remaining space of the drive to the *last* partition." >> $CNF
echo -e "## you can use M/G/T for unit specification in MIB/GIB/TIB" >> $CNF
echo -e "##" >> $CNF
echo -e "## notes:" >> $CNF
echo -e "## - extended partitions are created automatically" >> $CNF
echo -e "## - '/boot' cannot be on a xfs filesystem!" >> $CNF
echo -e "## - '/boot' cannot be on LVM!" >> $CNF
echo -e "## - when using software RAID 0, you need a '/boot' partition" >> $CNF
echo -e "##" >> $CNF
echo -e "## example without LVM (default):" >> $CNF
echo -e "## -> 4GB swapspace" >> $CNF
echo -e "## -> 512MB /boot" >> $CNF
echo -e "## -> 10GB /" >> $CNF
echo -e "## -> 5GB /tmp" >> $CNF
echo -e "## -> all the rest to /home" >> $CNF
echo -e "#PART swap swap 4096" >> $CNF
echo -e "#PART /boot ext2 512" >> $CNF
echo -e "#PART / reiserfs 10240" >> $CNF
echo -e "#PART /tmp xfs 5120" >> $CNF
echo -e "#PART /home ext3 all" >> $CNF
echo -e "#" >> $CNF
echo -e "##" >> $CNF
echo -e "## to activate LVM, you have to define volume groups and logical volumes" >> $CNF
echo -e "##" >> $CNF
echo -e "## example with LVM:" >> $CNF
echo -e "#" >> $CNF
echo -e "## normal filesystems and volume group definitions:" >> $CNF
echo -e "## -> 512MB boot (not on lvm)" >> $CNF
echo -e "## -> all the rest for LVM VG 'vg0'" >> $CNF
echo -e "#PART /boot ext3 512M" >> $CNF
echo -e "#PART lvm vg0 all" >> $CNF
echo -e "#" >> $CNF
echo -e "## logical volume definitions:" >> $CNF
echo -e "#LV <VG> <name> <mount> <filesystem> <size>" >> $CNF
echo -e "#" >> $CNF
echo -e "#LV vg0 root / ext4 10G" >> $CNF
echo -e "#LV vg0 swap swap swap 4G" >> $CNF
echo -e "#LV vg0 tmp /tmp reiserfs 5G" >> $CNF
echo -e "#LV vg0 home /home xfs 20G" >> $CNF
echo -e "#" >> $CNF
if [ -x "/usr/local/bin/hwdata" ]; then
echo -e "#" >> $CNF
echo -e "## your system has the following devices:" >> $CNF
echo -e "#" >> $CNF
echo -e "$(/usr/local/bin/hwdata | grep "Disk /" | sed "s/^ /#/")" >> $CNF
fi
if [ "$RAID1" -a "$RAID0" ] ; then
echo -e "#" >> $CNF
echo -e "## Based on your disks and which RAID level you will choose you have" >> $CNF
echo -e "## the following free space to allocate (in GiB):" >> $CNF
echo -e "# RAID 0: ~$RAID0" >> $CNF
echo -e "# RAID 1: ~$RAID1" >> $CNF
[ "$RAID5" ] && echo -e "# RAID 5: ~$RAID5" >> $CNF
if [ "$RAID6" ]; then
echo -e "# RAID 6: ~$RAID6" >> $CNF
echo -e "# RAID 10: ~$RAID10" >> $CNF
fi
fi
echo -e "#" >> $CNF
echo -e "" >> $CNF
# check if there are 3TB disks inside and use other default scheme
local LIMIT=2096128
local THREE_TB=2861588
local DRIVE_SIZE="$(sfdisk -s `smallest_hd` 2>/dev/null)"
DRIVE_SIZE="$(echo $DRIVE_SIZE / 1024 | bc)"
# adjust swap dynamically according to RAM
# RAM < 2 GB : SWAP=2 * RAM
# RAM > 2GB - 8GB : SWAP=RAM
# RAM > 8GB - 64GB : SWAP = 0.5 RAM
# RAM > 64GB: SWAP = 4GB
# http://docs.fedoraproject.org/en-US/Fedora/18/html/Installation_Guide/s2-diskpartrecommend-x86.html
# https://access.redhat.com/knowledge/docs/en-US/Red_Hat_Enterprise_Linux/6/html/Installation_Guide/s2-diskpartrecommend-x86.html
RAM=$(free -m | grep Mem: | tr -s ' ' | cut -d' ' -f2)
SWAPSIZE=4
if [ "$RAM" -lt 2048 ]; then
SWAPSIZE=$(($RAM * 2 / 1024 + 1))
elif [ "$RAM" -lt 8192 ]; then
SWAPSIZE=$(($RAM / 1024 + 1))
elif [ "$RAM" -lt 65535 ]; then
SWAPSIZE=$(($RAM / 2 / 1024 + 1))
fi
DEFAULTPARTS=${DEFAULTPARTS/SWAPSIZE##/$SWAPSIZE}
DEFAULTPARTS_BIG=${DEFAULTPARTS_BIG/SWAPSIZE##/$SWAPSIZE}
DEFAULTPARTS_LARGE=${DEFAULTPARTS_LARGE/SWAPSIZE##/$SWAPSIZE}
# use ext3 for vservers, because ext4 is too trigger happy of device timeouts
if isVServer; then
# DEFAULTPARTS=${DEFAULTPARTS//ext4/ext3}
DEFAULTPARTS=$DEFAULTPARTS_VSERVER
fi
# use /var instead of /home for all partition when installing plesk
if [ "$OPT_INSTALL" ]; then
if [ $(echo $OPT_INSTALL | grep -i "PLESK") ]; then
DEFAULTPARTS_BIG="${DEFAULTPARTS_BIG//home/var}"
fi
fi
if [ "$IAM" = "coreos" ]; then
echo -e "## NOTICE: This image does not support custom partition sizes." >>$CNF
echo -e "## NOTICE: Please keep the following lines unchanged. They are just placeholders." >>$CNF
fi
if [ $DRIVE_SIZE -gt $LIMIT ]; then
if [ $DRIVE_SIZE -gt $THREE_TB ]; then
[ "$OPT_PARTS" ] && echo -e "$OPT_PARTS" >>$CNF || echo -e "$DEFAULTPARTS_LARGE" >>$CNF
else
[ "$OPT_PARTS" ] && echo -e "$OPT_PARTS" >>$CNF || echo -e "$DEFAULTPARTS_BIG" >>$CNF
fi
else
[ "$OPT_PARTS" ] && echo -e "$OPT_PARTS" >>$CNF || echo -e "$DEFAULTPARTS" >>$CNF
fi
[ "$OPT_LVS" ] && echo -e "$OPT_LVS" >>$CNF
echo -e "" >> $CNF
# image
echo -e "\n" >> $CNF
echo -e "## ========================" >> $CNF
echo -e "## OPERATING SYSTEM IMAGE:" >> $CNF
echo -e "## ========================\n" >> $CNF
echo -e "## full path to the operating system image" >> $CNF
echo -e "## supported image sources: local dir, ftp, http, nfs" >> $CNF
echo -e "## supported image types: tar, tar.gz, tar.bz, tar.bz2, tar.xz, tgz, tbz, txz" >> $CNF
echo -e "## examples:" >> $CNF
echo -e "#" >> $CNF
echo -e "# local: /path/to/image/filename.tar.gz" >> $CNF
echo -e "# ftp: ftp://<user>:<password>@hostname/path/to/image/filename.tar.bz2" >> $CNF
echo -e "# http: http://<user>:<password>@hostname/path/to/image/filename.tbz" >> $CNF
echo -e "# https: https://<user>:<password>@hostname/path/to/image/filename.tbz" >> $CNF
echo -e "# nfs: hostname:/path/to/image/filename.tgz" >> $CNF
echo -e "#" >> $CNF
echo -e "# for validation of the image, place the detached gpg-signature" >> $CNF
echo -e "# and your public key in the same directory as your image file." >> $CNF
echo -e "# naming examples:" >> $CNF
echo -e "# signature: filename.tar.bz2.sig" >> $CNF
echo -e "# public key: public-key.asc" >> $CNF
echo -e "" >> $CNF
if [ "$1" = "custom" ]; then
echo -e "IMAGE " >> $CNF
else
if [ "$OPT_IMAGE" ] ; then
if [ -f "$FINALIMAGEPATH/$OPT_IMAGE" ] ; then
echo -e "IMAGE $FINALIMAGEPATH/$OPT_IMAGE" >> $CNF
else
echo -e "IMAGE $OPT_IMAGE" >> $CNF
fi
else
[ -n "$IMG_EXT" ] && IMAGESEXT="$IMG_EXT"
echo -e "IMAGE $FINALIMAGEPATH$1.$IMAGESEXT" >> $CNF
fi
fi
echo -e "" >> $CNF
fi
return 0
}
getdrives() {
local DRIVES="$(sfdisk -s 2>/dev/null | sort -u | grep -e "/dev/[hsv]d" | cut -d: -f1)"
local i=1
#cast drives into an array
DRIVES=( $DRIVES )
for drive in ${DRIVES[*]} ; do
# if we have just one drive, add it. Otherwise check that multiple drives are at least HDDMINSIZE
if [ ${#DRIVES[@]} -eq 1 ] || [ ! $(fdisk -s $drive 2>/dev/null || echo 0) -lt $HDDMINSIZE ] ; then
eval DRIVE$i="$drive"
let i=i+1
fi
done
[ -z "$DRIVE1" ] && DRIVE1="no valid drive found"
COUNT_DRIVES=$[$i - 1]
return 0
}
# read all variables from config file
# read_vars "CONFIGFILE"
read_vars(){
if [ "$1" ]; then
# count disks again, for setting COUNT_DRIVES correct after restarting installimage
getdrives
# special hidden configure option: create RAID1 and 10 with assume clean to
# avoid initial resync
RAID_ASSUME_CLEAN="`grep -m1 -e ^RAID_ASSUME_CLEAN $1 |awk '{print \$2}'`"
# special hidden configure option: GPT usage
# if set to 1, use GPT even on disks smaller than 2TiB
# if set to 2, always use GPT, even if the OS does not support it
FORCE_GPT="`grep -m1 -e ^FORCE_GPT $1 |awk '{print \$2}'`"
# another special hidden configure option: force image validation
# if set to 1: force validation
FORCE_SIGN="`grep -m1 -e ^FORCE_SIGN $1 |awk '{print \$2}'`"
# hidden configure option:
# if set to 1: force setting root password even if ssh keys are
# provided
FORCE_PASSWORD="`grep -m1 -e ^FORCE_PASSWORD $1 |awk '{print \$2}'`"
# get all disks from configfile
local used_disks=1
for i in $(seq 1 $COUNT_DRIVES) ; do
disk="$(grep -m1 -e ^DRIVE$i $1 | awk '{print $2}')"
if [ -n "$disk" ] ; then
export DRIVE$i
eval DRIVE$i="$disk"
let used_disks=used_disks+1
else
unset DRIVE$i
fi
format_disk="$(grep -m1 -e ^FORMATDRIVE$i $1 | awk '{print $2}')"
export FORMAT_DRIVE$i
eval FORMAT_DRIVE$i="0"
if [ -n "$format_disk" ] ; then
eval FORMAT_DRIVE$i="1"
fi
done
# get count of drives
COUNT_DRIVES="$((used_disks-1))"
# is RAID activated?
SWRAID="`grep -m1 -e ^SWRAID $1 |awk '{print \$2}'`"
[ "$SWRAID" = "" ] && SWRAID="0"
# Software RAID Level
SWRAIDLEVEL="$(grep -m1 -e ^SWRAIDLEVEL $1 | awk '{ print $2 }')"
[ "$SWRAIDLEVEL" = "" ] && SWRAIDLEVEL="1"
PARTS_SUM_SIZE="0"
PART_COUNT="$(grep -c -e '^PART' $1)"
PART_LINES="$(grep -e '^PART ' $1)"
echo "$PART_LINES" > /tmp/part_lines.tmp
i=0
while read PART_LINE ; do
i=$[$i+1]
PART_MOUNT[$i]="`echo $PART_LINE | awk '{print \$2}'`"
PART_FS[$i]="`echo $PART_LINE | awk '{print \$3}'`"
PART_SIZE[$i]="$(translate_unit "$(echo "$PART_LINE" | awk '{ print $4 }')")"
MOUNT_POINT_SIZE[$i]=${PART_SIZE[$i]}
#calculate new partition size if software raid is enabled and it is not /boot or swap
if [ "$SWRAID" = "1" ]; then
if [ "${PART_MOUNT[$i]}" != "/boot" -a "${PART_SIZE[$i]}" != "all" -a "${PART_MOUNT[$i]}" != "swap" ]; then
if [ "$SWRAIDLEVEL" = "0" ]; then
PART_SIZE[$i]=$((${PART_SIZE[$i]}/$COUNT_DRIVES))
elif [ "$SWRAIDLEVEL" = "5" ]; then
PART_SIZE[$i]=$((${PART_SIZE[$i]}/($COUNT_DRIVES-1)))
elif [ "$SWRAIDLEVEL" = "6" ]; then
PART_SIZE[$i]=$((${PART_SIZE[$i]}/($COUNT_DRIVES-2)))
elif [ "$SWRAIDLEVEL" = "10" ]; then
PART_SIZE[$i]=$((${PART_SIZE[$i]}/($COUNT_DRIVES/2)))
fi
fi
fi
echo "${PART_MOUNT[$i]} : ${PART_SIZE[$i]}" | debugoutput
if [ "${PART_SIZE[$i]}" != "all" ]; then
PARTS_SUM_SIZE="$(echo ${PART_SIZE[$i]} + $PARTS_SUM_SIZE | bc)"
fi
if [ "${PART_MOUNT[$i]}" = "/" ]; then
HASROOT="true"
fi
done < /tmp/part_lines.tmp
# get LVM volume group config
LVM_VG_COUNT="$(egrep -c '^PART *lvm ' $1)"
LVM_VG_ALL="$(egrep '^PART *lvm ' $1)"
# void the check var
LVM_VG_CHECK=""
for i in `seq 1 $LVM_VG_COUNT`; do
LVM_VG_LINE="`echo "$LVM_VG_ALL" | head -n$i | tail -n1`"
#LVM_VG_PART[$i]=$i #"`echo $LVM_VG_LINE | awk '{print \$2}'`"
LVM_VG_PART[$i]=$(echo "$PART_LINES" | egrep -n '^PART *lvm ' | head -n$i | tail -n1 | cut -d: -f1)
LVM_VG_NAME[$i]="`echo $LVM_VG_LINE | awk '{print \$3}'`"
LVM_VG_SIZE[$i]="$(translate_unit "$(echo $LVM_VG_LINE | awk '{print $4}')")"
if [ "${LVM_VG_SIZE[$i]}" != "all" ] ; then
LVM_VG_CHECK="$i $LVM_VG_CHECK"
fi
done
# get LVM logical volume config
LVM_LV_COUNT="`grep -c -e "^LV " $1`"
LVM_LV_ALL="`grep -e "^LV " $1`"
for i in `seq 1 $LVM_LV_COUNT`; do
LVM_LV_LINE="`echo "$LVM_LV_ALL" | head -n$i | tail -n1`"
LVM_LV_VG[$i]="`echo $LVM_LV_LINE | awk '{print \$2}'`"
LVM_LV_VG_SIZE[$i]="$(echo "$LVM_VG_ALL" | grep "${LVM_LV_VG[$i]}" | awk '{print $4}')"
LVM_LV_NAME[$i]="`echo $LVM_LV_LINE | awk '{print \$3}'`"
LVM_LV_MOUNT[$i]="`echo $LVM_LV_LINE | awk '{print \$4}'`"
LVM_LV_FS[$i]="`echo $LVM_LV_LINE | awk '{print \$5}'`"
LVM_LV_SIZE[$i]="$(translate_unit "$(echo "$LVM_LV_LINE" | awk '{ print $6 }')")"
# we only add LV sizes to PART_SUM_SIZE if the appropiate volume group has
# "all" as size (otherwise we would count twice: SIZE of VG + SIZE of LVs of VG)
if [ "${LVM_LV_SIZE[$i]}" != "all" ] && [ "${LVM_LV_VG_SIZE[$i]}" == "all" ]; then
PARTS_SUM_SIZE="$(echo ${LVM_LV_SIZE[$i]} + $PARTS_SUM_SIZE | bc)"
fi
if [ "${LVM_LV_MOUNT[$i]}" = "/" ]; then
HASROOT="true"
fi
done
# is LVM activated?
[ "$LVM_VG_COUNT" != "0" -a "$LVM_LV_COUNT" != "0" ] && LVM="1" || LVM="0"
IMAGE="`grep -m1 -e ^IMAGE $1 | awk '{print \$2}'`"
[ -e "$wd/$IMAGE" ] && IMAGE="$wd/$IMAGE"
IMAGE_PATH="$(dirname $IMAGE)/"
IMAGE_FILE="$(basename $IMAGE)"
case $IMAGE_PATH in
https:*|http:*|ftp:*) IMAGE_PATH_TYPE="http" ;;
/*) IMAGE_PATH_TYPE="local" ;;
*) IMAGE_PATH_TYPE="nfs" ;;
esac
case $IMAGE_FILE in
*.tar) IMAGE_FILE_TYPE="tar" ;;
*.tar.gz|*.tgz) IMAGE_FILE_TYPE="tgz" ;;
*.tar.bz|*.tbz|*.tbz2|*.tar.bz2) IMAGE_FILE_TYPE="tbz" ;;
*.tar.xz|*.txz) IMAGE_FILE_TYPE="txz" ;;
*.bin) IMAGE_FILE_TYPE="bin" ;;
*.bin.bz2|*.bin.bz) IMAGE_FILE_TYPE="bbz" ;;
esac
BOOTLOADER="`grep -m1 -e ^BOOTLOADER $1 |awk '{print \$2}'`"
if [ "$BOOTLOADER" = "" ]; then
BOOTLOADER=$(echo "$DEFAULTLOADER" | awk '{ print $2 }')
fi
BOOTLOADER=$(echo $BOOTLOADER | tr [:upper:] [:lower:])
NEWHOSTNAME=$(grep -m1 -e ^HOSTNAME $1 | awk '{print $2}')
GOVERNOR="`grep -m1 -e ^GOVERNOR $1 |awk '{print \$2}'`"
if [ "$GOVERNOR" = "" ]; then GOVERNOR="ondemand"; fi
SYSTEMDEVICE="$DRIVE1"
SYSTEMREALDEVICE="$DRIVE1"
fi
}
# validate all variables for correct values
# validate_vars "CONFIGFILE"
validate_vars() {
if [ "$1" ]; then
read_vars "$1"
# test if IMAGEPATH is given
if [ -z "$IMAGE_PATH" ]; then
graph_error "ERROR: No valid IMAGEPATH"
return 1
fi
# test if PATHTYPE is a supported type
CHECK="`echo $IMAGE_PATH_TYPE |grep -i -e "^http$\|^nfs$\|^local$"`"
if [ -z "$CHECK" ]; then
graph_error "ERROR: No valid PATHTYPE"
return 1
fi
# test if IMAGEFILE is given
if [ -z "$IMAGE_FILE" ]; then
graph_error "ERROR: No valid IMAGEFILE"
return 1
fi
# test if FILETYPE is a supported type
CHECK="`echo $IMAGE_FILE_TYPE |grep -i -e "^tar$\|^tgz$\|^tbz$\|^txz$\|^bin$\|^bbz$"`"
if [ -z "$CHECK" ]; then
graph_error "ERROR: $IMAGE_FILE_TYPE is no valid FILETYPE for images"
return 1
fi
whoami "$IMAGE_FILE"
# test if $DRIVE1 is a valid block device and is able to create partitions
CHECK="`test -b "$DRIVE1" && sfdisk -l "$DRIVE1" 2>>/dev/null`"
if [ -z "$CHECK" ]; then
graph_error "ERROR: Value for DRIVE1 is not correct: $DRIVE1 "
return 1
fi
# test if $DRIVE1 is not busy
# CHECK="$(hdparm -z $DRIVE1 2>&1 | grep 'BLKRRPART failed: Device or resource busy')"
# if [ "$CHECK" ]; then
# graph_error "ERROR: DRIVE1 is busy - cannot access device $DRIVE1 "
# return 1
# fi
# test if $SWRAID has not 0 or 1 as parameter
if [ "$SWRAID" != "0" -a "$SWRAID" != "1" ]; then
graph_error "ERROR: Value for SWRAID is not correct"
return 1
fi
# test if $SWRAIDLEVEL is either 0 or 1
if [ "$SWRAID" = "1" -a "$SWRAIDLEVEL" != "0" -a "$SWRAIDLEVEL" != "1" -a "$SWRAIDLEVEL" != "5" -a "$SWRAIDLEVEL" != "6" -a "$SWRAIDLEVEL" != "10" ]; then
graph_error "ERROR: Value for SWRAIDLEVEL is not correct"
return 1
fi
# check for valid drives
local drive_array=( $DRIVE1 )
for i in $(seq 1 $COUNT_DRIVES) ; do
local format="$(eval echo \$FORMAT_DRIVE$i)"
local drive="$(eval echo \$DRIVE$i)"
if [ $i -gt 1 ] ; then
for j in $(seq 0 $((${#drive_array[@]} - 1))); do
if [ ${drive_array[$j]} = $drive ]; then
graph_error "Duplicate DRIVE definition. $drive used for DRIVE$[$j+1] and DRIVE$i"
fi
done
drive_array=( "${drive_array[@]}" "$drive" )
if [ "$format" != "0" -a "$format" != "1" ]; then
graph_error "ERROR: Value for FORMATDRIVE$i is not correct"
return 1
fi
if [ "$format" = 1 -a "$SWRAID" = 1 ] ; then
graph_error "ERROR: FORMATDRIVE$i _AND_ SWRAID are active - use one or none of these options, not both"
return 1
fi
fi
if [ "$SWRAID" = "1" -o "$format" = "1" -o $i -eq 1 ] ; then
# test if drive is a valid block device and is able to create partitions
CHECK="`test -b "$drive" && sfdisk -l "$drive" 2>>/dev/null`"
if [ -z "$CHECK" ]; then
graph_error "ERROR: Value for DRIVE$i is not correct: $drive"
return 1
fi
# test if drive is not busy
CHECK="$(hdparm -z $drive 2>&1 | grep 'BLKRRPART failed: Device or resource busy')"
if [ "$CHECK" ]; then
graph_error "ERROR: DRIVE$i is busy - cannot access device $drive"
return 1
fi
fi
done
# test if there is more than 1 hdd if swraid enabled
if [ "$SWRAID" = "1" -a $COUNT_DRIVES -le 1 ] ; then
graph_error "ERROR: You need to select at least 2 disks for creating software raid!"
return 1
fi
# test if enough disks for the choosen raid level
if [ "$SWRAID" = "1" ]; then
if [ "$SWRAIDLEVEL" = "5" -a "$COUNT_DRIVES" -lt "3" ]; then
graph_error "ERROR: Not enough disks for RAID level 5"
return 1
elif [ "$SWRAIDLEVEL" = "6" -a "$COUNT_DRIVES" -lt "4" ]; then
graph_error "ERROR: Not enough disks for RAID level 6"
return 1
elif [ "$SWRAIDLEVEL" = "10" -a "$COUNT_DRIVES" -lt "2" ]; then
graph_error "ERROR: Not enough disks for RAID level 10"
return 1
fi
fi
# test if a /boot partition is defined when using software RAID 0
if [ "$SWRAID" = "1" ]; then
if [ "$SWRAIDLEVEL" = "0" -o "$SWRAIDLEVEL" = "5" -o "$SWRAIDLEVEL" = "6" -o "$SWRAIDLEVEL" = "10" ]; then
TMPCHECK=0
for i in $(seq 1 $PART_COUNT); do
if [ "${PART_MOUNT[$i]}" = "/boot" ]; then
TMPCHECK=1
fi
done
if [ $TMPCHECK -eq 0 ]; then
graph_error "ERROR: You need a /boot partition when using software RAID level 0, 5, 6 or 10"
return 1
fi
fi
fi
# calculate drive_sum_size
if [ "$SWRAID" = "0" ] ; then
# just the first hdd is used so we need the size of DRIVE1
DRIVE_SUM_SIZE=$(blockdev --getsize64 $DRIVE1)
echo "Size of the first hdd is: $DRIVE_SUM_SIZE" | debugoutput
else
local smallest_hdd=$(smallest_hd)
DRIVE_SUM_SIZE="$(blockdev --getsize64 $smallest_hdd)"
# this variable is used later when determining what disk to use as reference
# when drives of different sizes are in a system
SMALLEST_HDD_SIZE=$DRIVE_SUM_SIZE
SMALLEST_HDD_SIZE=$[$SMALLEST_HDD_SIZE / 1024 / 1024]
echo "Size of smallest drive is $DRIVE_SUM_SIZE" | debugoutput
if [ "$SWRAIDLEVEL" = "0" ]; then
DRIVE_SUM_SIZE=$[$DRIVE_SUM_SIZE * $COUNT_DRIVES]
elif [ "$SWRAIDLEVEL" = "5" ]; then
DRIVE_SUM_SIZE=$[$DRIVE_SUM_SIZE * ($COUNT_DRIVES - 1)]
elif [ "$SWRAIDLEVEL" = "6" ]; then
DRIVE_SUM_SIZE=$[$DRIVE_SUM_SIZE * ($COUNT_DRIVES - 2)]
elif [ "$SWRAIDLEVEL" = "10" ]; then
DRIVE_SUM_SIZE=$[$DRIVE_SUM_SIZE * ($COUNT_DRIVES / 2)]
fi
echo "Calculated size of array is: $DRIVE_SUM_SIZE" | debugoutput
fi
DRIVE_SUM_SIZE=$[$DRIVE_SUM_SIZE / 1024 / 1024]
for i in `seq 1 $PART_COUNT`; do
if [ "${PART_SIZE[$i]}" = "all" ]; then
# make sure that the all partition has at least 1G available
DRIVE_SUM_SIZE=$[$DRIVE_SUM_SIZE - 1024]
fi
done
# test if /boot or / is mounted outside the LVM
if [ "$LVM" = "1" ]; then
TMPCHECK=0
for i in $(seq 1 $PART_COUNT); do
if [ "${PART_MOUNT[$i]}" = "/boot" ]; then
TMPCHECK=1
fi
done
if [ "$TMPCHECK" = "0" ]; then
for i in $(seq 1 $PART_COUNT); do
if [ "${PART_MOUNT[$i]}" = "/" ]; then
TMPCHECK=1
fi
done
fi
if [ "$TMPCHECK" = "0" ]; then
graph_error "ERROR: /boot or / may not be a Logical Volume"
return 1
fi
fi
# Check if /boot or / is mounted on one of the first three partitions.
if [ $PART_COUNT -gt 3 ]; then
tmp=0
for i in $(seq 1 $PART_COUNT); do
if [ "${PART_MOUNT[$i]}" = "/boot" ]; then
tmp=$i
break
fi
done
if [ $tmp -gt 3 ]; then
graph_error "ERROR: /boot must be mounted on a primary partition"
return 1
fi
if [ $tmp -eq 0 ]; then
for i in $(seq 4 $PART_COUNT); do
if [ "${PART_MOUNT[$i]}" = "/" ]; then
graph_error "ERROR: / must be mounted on a primary partition"
return 1
fi
done
fi
fi
# test if there are partitions in the configfile
if [ "$PART_COUNT" -gt "0" ]; then
WARNBTRFS=0
# test each partition line
for i in `seq 1 $PART_COUNT`; do
# test if the mountpoint is valid (start with / or swap or lvm)
CHECK="`echo ${PART_MOUNT[$i]} | grep -e "^none\|^/\|^swap$\|^lvm$"`"
if [ -z "$CHECK" ]; then
graph_error "ERROR: Mountpoint for partition $i is not correct"
return 1
fi
# test if the filesystem is one of our supportet types (btrfs/ext2/ext3/ext4/reiserfs/xfs/swap)
CHECK="`echo ${PART_FS[$i]} |grep -e "^bios_grub\|^btrfs$\|^ext2$\|^ext3$\|^ext4$\|^reiserfs$\|^xfs$\|^swap$\|^lvm$"`"
if [ -z "$CHECK" -a "${PART_MOUNT[$i]}" != "lvm" ]; then
graph_error "ERROR: Filesystem for partition $i is not correct"
return 1
fi
if [ "${PART_FS[$i]}" = "reiserfs" -a "$IAM" = "centos" ]; then
graph_error "ERROR: centos doesn't support reiserfs"
return 1
fi
# warn if using btrfs
if [ "${PART_FS[$i]}" = "btrfs" ]; then
WARNBTRFS=1
fi
# we can't use bsdtar on non ext2/3/4 partitions
CHECK=$(echo ${PART_FS[$i]} |grep -e "^ext2$\|^ext3$\|^ext4$\|^swap$")
if [ -z "$CHECK" -a "${PART_MOUNT[$i]}" != "lvm" ]; then
export TAR="tar"
echo "setting TAR to GNUtar" | debugoutput
fi
if [ "${PART_FS[$i]}" = "btrfs" -a "$IAM" = "centos" -a "$IMG_VERSION" -lt 62 ]; then
graph_error "ERROR: CentOS older than 6.2 doesn't support btrfs"
return 1
fi
# test if "all" is at the last partition entry
### TODO: correct this for LVM
if [ "${PART_SIZE[$i]}" = "all" -a "$i" -lt "$PART_COUNT" ]; then
graph_error "ERROR: Partition size \"all\" has to be on the last partition"
return 1
fi
# Check if the partition size is a valid number
if [ "${PART_SIZE[$i]}" != "all" -a "$(echo "${PART_SIZE[$i]}" | sed "s/[0-9]//g")" != "" -o "${PART_SIZE[$i]}" = "0" ]; then
graph_error "ERROR: The size of the partiton PART ${PART_MOUNT[$i]} is not a valid number"
return 1
fi
# check if /boot partition has at least 200M
if [ "${PART_MOUNT[$i]}" = "/boot" -a "${PART_SIZE[$i]}" != "all" ]; then
if [ "${MOUNT_POINT_SIZE[$i]}" -lt "200" ]; then
graph_error "ERROR: Your /boot partition has to be at least 200M (current size: ${MOUNT_POINT_SIZE[$i]})"
return 1
fi
fi
# check if / partition has at least 1500M
if [ "${PART_MOUNT[$i]}" = "/" -a "${PART_SIZE[$i]}" != "all" ]; then
if [ "${MOUNT_POINT_SIZE[$i]}" -lt "1500" ]; then
graph_error "ERROR: Your / partition has to be at least 1500M (current size: ${MOUNT_POINT_SIZE[$i]})"