forked from BlackArch/blackarch-installer
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathblackarch-install
2490 lines (1953 loc) · 51 KB
/
blackarch-install
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
################################################################################
# #
# blackarch-installer - Official Installer for BlackArch Linux #
# #
# AUTHOR #
# #
################################################################################
# blackarch-installer version
VERSION='1.1.27'
# path to blackarch-installer
BI_PATH='/usr/share/blackarch-installer'
# true / false
TRUE=0
FALSE=1
# return codes
SUCCESS=0
FAILURE=1
# verbose mode - default: quiet
VERBOSE='/dev/null'
# colors
WHITE="$(tput setaf 7)"
WHITEB="$(tput bold ; tput setaf 7)"
BLUE="$(tput setaf 4)"
BLUEB="$(tput bold ; tput setaf 4)"
CYAN="$(tput setaf 6)"
CYANB="$(tput bold ; tput setaf 6)"
GREEN="$(tput setaf 2)"
GREENB="$(tput bold ; tput setaf 2)"
RED="$(tput setaf 1)"
REDB="$(tput bold; tput setaf 1)"
YELLOW="$(tput setaf 3)"
YELLOWB="$(tput bold ; tput setaf 3)"
BLINK="$(tput blink)"
NC="$(tput sgr0)"
# installation mode
INSTALL_MODE=''
# install modes
INSTALL_REPO='1'
INSTALL_LIVE_ISO='2'
INSTALL_BLACKMAN='3'
# chosen locale
LOCALE=''
# set locale
SET_LOCALE='1'
# list locales
LIST_LOCALE='2'
# chosen keymap
KEYMAP=''
# set keymap
SET_KEYMAP='1'
# list keymaps
LIST_KEYMAP='2'
# network interfaces
NET_IFS=''
# chosen network interface
NET_IF=''
# network configuration mode
NET_CONF_MODE=''
# network configuration modes
NET_CONF_AUTO='1'
NET_CONF_WLAN='2'
NET_CONF_MANUAL='3'
NET_CONF_SKIP='4'
# hostname
HOST_NAME=''
# host ipv4 address
HOST_IPV4=''
# gateway ipv4 address
GATEWAY=''
# subnet mask
SUBNETMASK=''
# broadcast address
BROADCAST=''
# nameserver address
NAMESERVER=''
# DualBoot flag
DUALBOOT=''
# LUKS flag
LUKS=''
# avalable hard drive
HD_DEVS=''
# chosen hard drive device
HD_DEV=''
# partition label: gpt or msdos
PART_LABEL=''
# boot partition
BOOT_PART=''
# root partition
ROOT_PART=''
# crypted root
CRYPT_ROOT='r00t'
# swap partition
SWAP_PART=''
# boot fs type - default: ext4
BOOT_FS_TYPE=''
# root fs type - default: ext4
ROOT_FS_TYPE=''
# chroot directory / blackarch linux installation
CHROOT='/mnt'
# normal system user
NORMAL_USER=''
# default BlackArch Linux repository URL
BA_REPO_URL='http://ftp.halifax.rwth-aachen.de/blackarch/$repo/os/$arch'
# default ArchLinux repository URL
AR_REPO_URL='https://archlinux.surlyjake.com/archlinux/$repo/os/$arch'
AR_REPO_URL="$AR_REPO_URL http://mirrors.evowise.com/archlinux/\$repo/os/\$arch"
AR_REPO_URL="$AR_REPO_URL http://mirror.rackspace.com/archlinux/\$repo/os/\$arch"
# X (display + window managers ) setup - default: false
X_SETUP=$FALSE
# VirtualBox setup - default: false
VBOX_SETUP=$FALSE
# VMware setup - default: false
VMWARE_SETUP=$FALSE
# BlackArch Linux tools setup - default: false
BA_TOOLS_SETUP=$FALSE
# wlan ssid
WLAN_SSID=''
# wlan passphrase
WLAN_PASSPHRASE=''
# check boot mode
BOOT_MODE=''
# check type of ISO (live? netinst?)
ISO_TYPE=''
# check exit status
check()
{
es=$1
func="$2"
info="$3"
if [ $es -ne 0 ]
then
echo
warn "Something went wrong with $func. $info."
sleep 5
fi
}
# print formatted output
wprintf()
{
fmt="${1}"
shift
printf "%s$fmt%s" "$WHITE" "$@" "$NC"
return $SUCCESS
}
# print warning
warn()
{
printf "%s[!] WARNING: %s%s\n" "$YELLOW" "$@" "$NC"
return $SUCCESS
}
# print error and exit
err()
{
printf "%s[-] ERROR: %s%s\n" "$RED" "$@" "$NC"
exit $FAILURE
return $SUCCESS
}
# leet banner (very important)
banner()
{
columns="$(tput cols)"
str="--==[ blackarch-installer v$VERSION ]==--"
printf "${BLUEB}%*s${NC}\n" "${COLUMNS:-$(tput cols)}" | tr ' ' '-'
echo "$str" |
while IFS= read -r line
do
printf "%s%*s\n%s" "$CYANB" $(( (${#line} + columns) / 2)) \
"$line" "$NC"
done
printf "${BLUEB}%*s${NC}\n\n\n" "${COLUMNS:-$(tput cols)}" | tr ' ' '-'
return $SUCCESS
}
# check boot mode
check_boot_mode()
{
if [ "$(efivar --list 2> /dev/null)" ]
then
BOOT_MODE="uefi"
fi
return $SUCCESS
}
# check type of iso
check_iso_type()
{
if [ "$(which dnsspider 2> /dev/null)" ]
then
ISO_TYPE='live'
else
ISO_TYPE='net'
fi
return $SUCCESS
}
# sleep and clear
sleep_clear()
{
sleep $1
clear
return $SUCCESS
}
# confirm user inputted yYnN
confirm()
{
header="$1"
ask="$2"
while true
do
title "$header"
wprintf "$ask"
read input
case $input in
y|Y|yes|YES|Yes) return $TRUE ;;
n|N|no|NO|No) return $FALSE ;;
*) clear ; continue ;;
esac
done
return $SUCCESS
}
# print menu title
title()
{
banner
printf "${CYAN}>> %s${NC}\n\n\n" "${@}"
return "${SUCCESS}"
}
# check for environment issues
check_env()
{
if [ -f '/var/lib/pacman/db.lck' ]
then
err 'pacman locked - Please remove /var/lib/pacman/db.lck'
fi
}
# check user id
check_uid()
{
if [ "$(id -u)" != '0' ]
then
err 'You must be root to run the BlackArch installer!'
fi
return $SUCCESS
}
# welcome and ask for installation mode
ask_install_mode()
{
while [ \
"$INSTALL_MODE" != "$INSTALL_REPO" -a \
"$INSTALL_MODE" != "$INSTALL_BLACKMAN" -a \
"$INSTALL_MODE" != "$INSTALL_LIVE_ISO" ]
do
title 'Welcome to the BlackArch Linux installer!'
wprintf '[+] Available installation modes:'
printf "\n
1. Install from BlackArch repository (online)
2. Install from BlackArch Live-ISO (offline)
3. Install from sources using blackman (online)\n\n"
wprintf '[?] Choose an installation mode: '
read INSTALL_MODE
if [ "$INSTALL_MODE" = "$INSTALL_LIVE_ISO" ]
then
if [ "$ISO_TYPE" = "net" ]
then
err 'WTF, Live-ISO mode with Netinstall? Nope!'
fi
fi
clear
done
return $SUCCESS
}
# ask for output mode
ask_output_mode()
{
title 'Environment > Output Mode'
wprintf '[+] Available output modes:'
printf "\n
1. Quiet (default)
2. Verbose (output of system commands: mkfs, pacman, etc.)\n\n"
wprintf "[?] Make a choice: "
read output_opt
if [ "$output_opt" = 2 ]
then
VERBOSE='/dev/stdout'
fi
return $SUCCESS
}
# ask for locale to use
ask_locale()
{
while [ \
"$locale_opt" != "$SET_LOCALE" -a \
"$locale_opt" != "$LIST_LOCALE" ]
do
title 'Environment > Locale Setup'
wprintf '[+] Available locale options:'
printf "\n
1. Set a locale
2. List available locales\n\n"
wprintf "[?] Make a choice: "
read locale_opt
if [ "$locale_opt" = "$SET_LOCALE" ]
then
break
elif [ "$locale_opt" = "$LIST_LOCALE" ]
then
less /etc/locale.gen
echo
else
clear
continue
fi
clear
done
clear
return $SUCCESS
}
# set locale to use
set_locale()
{
title 'Environment > Locale Setup'
wprintf '[?] Set locale [en_US.UTF-8]: '
read LOCALE
# default locale
if [ -z "$LOCALE" ]
then
echo
warn 'Setting default locale: en_US.UTF-8'
sleep 1
LOCALE='en_US.UTF-8'
fi
localectl set-locale "LANG=$LOCALE"
check $? 'setting locale'
return $SUCCESS
}
# ask for keymap to use
ask_keymap()
{
while [ \
"$keymap_opt" != "$SET_KEYMAP" -a \
"$keymap_opt" != "$LIST_KEYMAP" ]
do
title 'Environment > Keymap Setup'
wprintf '[+] Available keymap options:'
printf "\n
1. Set a keymap
2. List available keymaps\n\n"
wprintf '[?] Make a choice: '
read keymap_opt
if [ "$keymap_opt" = "$SET_KEYMAP" ]
then
break
elif [ "$keymap_opt" = "$LIST_KEYMAP" ]
then
localectl list-x11-keymap-layouts
echo
else
clear
continue
fi
clear
done
clear
return $SUCCESS
}
# set keymap to use
set_keymap()
{
title 'Environment > Keymap Setup'
wprintf '[?] Set keymap [us]: '
read KEYMAP
# default keymap
if [ -z "$KEYMAP" ]
then
echo
warn 'Setting default keymap: us'
sleep 1
KEYMAP='us'
fi
localectl set-keymap --no-convert "$KEYMAP"
loadkeys "$KEYMAP" > $VERBOSE 2>&1
check $? 'setting keymap'
return $SUCCESS
}
# enable multilib in pacman.conf if x86_64 present
enable_pacman_multilib()
{
path="$1"
if [ "$path" = 'chroot' ]
then
path="$CHROOT"
else
path=""
fi
title 'Pacman Setup > Multilib'
if [ "$(uname -m)" = "x86_64" ]
then
wprintf '[+] Enabling multilib support'
printf "\n\n"
if grep -q "#\[multilib\]" "$path/etc/pacman.conf"
then
# it exists but commented
sed -i '/\[multilib\]/{ s/^#//; n; s/^#//; }' "$path/etc/pacman.conf"
elif ! grep -q "\[multilib\]" "$path/etc/pacman.conf"
then
# it does not exist at all
printf "[multilib]\nInclude = /etc/pacman.d/mirrorlist\n" \
>> "$path/etc/pacman.conf"
fi
fi
return $SUCCESS
}
# enable color mode in pacman.conf
enable_pacman_color()
{
path="$1"
if [ "$path" = 'chroot' ]
then
path="$CHROOT"
else
path=""
fi
title 'Pacman Setup > Color'
wprintf '[+] Enabling color mode'
printf "\n\n"
sed -i 's/^#Color/Color/' "$path/etc/pacman.conf"
return $SUCCESS
}
# update pacman package database
update_pkg_database()
{
title 'Pacman Setup > Package Database'
wprintf '[+] Updating pacman database'
printf "\n\n"
pacman -Syy --noconfirm > $VERBOSE 2>&1
return $SUCCESS
}
# update pacman.conf and database
update_pacman()
{
enable_pacman_multilib
sleep_clear 1
enable_pacman_color
sleep_clear 1
update_pkg_database
sleep_clear 1
return $SUCCESS
}
# ask user for hostname
ask_hostname()
{
while [ -z "$HOST_NAME" ]
do
title 'Network Setup > Hostname'
wprintf '[?] Set your hostname: '
read HOST_NAME
done
return $SUCCESS
}
# get available network interfaces
get_net_ifs()
{
NET_IFS="$(ls /sys/class/net)"
return $SUCCESS
}
# ask user for network interface
ask_net_if()
{
while true
do
title 'Network Setup > Network Interface'
wprintf '[+] Available network interfaces:'
printf "\n\n"
for i in $NET_IFS
do
echo " > $i"
done
echo
wprintf '[?] Please choose a network interface: '
read NET_IF
if echo $NET_IFS | grep "\<$NET_IF\>" > /dev/null
then
clear
break
fi
clear
done
return $SUCCESS
}
# ask for networking configuration mode
ask_net_conf_mode()
{
while [ \
"$NET_CONF_MODE" != "$NET_CONF_AUTO" -a \
"$NET_CONF_MODE" != "$NET_CONF_WLAN" -a \
"$NET_CONF_MODE" != "$NET_CONF_MANUAL" -a \
"$NET_CONF_MODE" != "$NET_CONF_SKIP" ]
do
title 'Network Setup > Network Interface'
wprintf '[+] Network interface configuration:'
printf "\n
1. Auto DHCP (use this for auto connect via dhcp on selected interface)
2. WiFi WPA Setup (use if you need to connect to a wlan before)
3. Manual (use this if you are 1337)
4. Skip (use this if you are already connected)\n\n"
wprintf "[?] Please choose a mode: "
read NET_CONF_MODE
clear
done
return $SUCCESS
}
# ask for network addresses
ask_net_addr()
{
while [ \
"$HOST_IPV4" = "" -o "$GATEWAY" = "" -o "$SUBNETMASK" = "" \
-o "$BROADCAST" = "" -o "$NAMESERVER" = "" ]
do
title 'Network Setup > Network Configuration (manual)'
wprintf "[+] Configuring network interface '$NET_IF' via USER: "
printf "\n
> Host ipv4
> Gateway ipv4
> Subnetmask
> Broadcast
> Nameserver
\n"
wprintf '[?] Host IPv4: '
read HOST_IPV4
wprintf '[?] Gateway IPv4: '
read GATEWAY
wprintf '[?] Subnetmask: '
read SUBNETMASK
wprintf '[?] Broadcast: '
read BROADCAST
wprintf '[?] Nameserver: '
read NAMESERVER
clear
done
return $SUCCESS
}
# manual network interface configuration
net_conf_manual()
{
title 'Network Setup > Network Configuration (manual)'
wprintf "[+] Configuring network interface '$NET_IF' manually: "
printf "\n\n"
ip addr flush dev $NET_IF
ip link set $NET_IF up
ip addr add "$HOST_IPV4/$SUBNETMASK" broadcast $BROADCAST dev $NET_IF
ip route add default via $GATEWAY
echo "nameserver $NAMESERVER" > /etc/resolv.conf
return $SUCCESS
}
# auto (dhcp) network interface configuration
net_conf_auto()
{
opts='-h noleak -i noleak -v ,noleak -I noleak -t 10'
title 'Network Setup > Network Configuration (auto)'
wprintf "[+] Configuring network interface '$NET_IF' via DHCP: "
printf "\n\n"
dhcpcd $opts -i $NET_IF > $VERBOSE 2>&1
return $SUCCESS
}
# ask for wlan data (ssid, wpa passphrase, etc.)
ask_wlan_data()
{
while [ "$WLAN_SSID" = "" -o "$WLAN_PASSPHRASE" = "" ]
do
title 'Network Setup > Network Configuration (WiFi)'
wprintf "[+] Configuring network interface '$NET_IF' via W-LAN + DHCP: "
printf "\n
> W-LAN SSID
> WPA Passphrase (will not echo)
\n"
wprintf "[?] W-LAN SSID: "
read WLAN_SSID
wprintf "[?] WPA Passphrase: "
read -s WLAN_PASSPHRASE
clear
done
return $SUCCESS
}
# wifi and auto dhcp network interface configuration
net_conf_wlan()
{
wpasup="$(mktemp)"
dhcp_opts='-h noleak -i noleak -v ,noleak -I noleak -t 10'
title 'Network Setup > Network Configuration (WiFi)'
wprintf "[+] Configuring network interface '$NET_IF' via W-LAN + DHCP: "
printf "\n\n"
wpa_passphrase "$WLAN_SSID" "$WLAN_PASSPHRASE" > $wpasup
wpa_supplicant -B -c $wpasup -i $NET_IF > $VERBOSE 2>&1
warn 'We need to wait a bit for wpa_supplicant and dhcpcd'
sleep 10
dhcpcd $dhcp_opts -i $NET_IF > $VERBOSE 2>&1
sleep 10
return $SUCCESS
}
# check for internet connection
check_inet_conn()
{
title 'Network Setup > Connection Check'
wprintf '[+] Checking for Internet connection...'
if ! curl -s http://www.yahoo.com/ > $VERBOSE 2>&1
then
err 'No Internet connection! Check your network (settings).'
fi
return $SUCCESS
}
# ask user for dualboot install
ask_dualboot()
{
while [ "$DUALBOOT" = '' ]
do
if confirm 'Hard Drive Setup > DualBoot' '[?] Install BlackArch Linux with Windows/Other OS [y/n]: '
then
DUALBOOT=$TRUE
else
DUALBOOT=$FALSE
fi
done
return $SUCCESS
}
# ask user for luks encrypted partition
ask_luks()
{
while [ "$LUKS" = '' ]
do
if confirm 'Hard Drive Setup > Crypto' '[?] Full encrypted root [y/n]: '
then
LUKS=$TRUE
echo
warn 'The root partition will be encrypted'
else
LUKS=$FALSE
echo
warn 'The root partition will NOT be encrypted'
fi
sleep_clear 2
done
return $SUCCESS
}
# get available hard disks
get_hd_devs()
{
HD_DEVS="$(lsblk | grep disk | awk '{print $1}')"
return $SUCCESS
}
# ask user for device to format and setup
ask_hd_dev()
{
while true
do
title 'Hard Drive Setup'
wprintf '[+] Available hard drives for installation:'
printf "\n\n"
for i in $HD_DEVS
do
echo " > ${i}"
done
echo
wprintf '[?] Please choose a device: '
read HD_DEV
if echo $HD_DEVS | grep "\<$HD_DEV\>" > /dev/null
then
HD_DEV="/dev/$HD_DEV"
clear
break
fi
clear
done
return $SUCCESS
}
# ask user to create partitions using cfdisk
ask_cfdisk()
{
if confirm 'Hard Drive Setup > Partitions' '[?] Create partitions with cfdisk (root and boot, optional swap) [y/n]: '
then
clear
zero_part
else
echo
warn 'No partitions chosed? Make sure you have them already configured.'
fi
return $SUCCESS
}
# zero out partition if needed/chosen
zero_part()
{
if confirm 'Hard Drive Setup' '[?] Start with an in-memory zeroed partition table [y/n]: '
then
cfdisk -z "$HD_DEV"
sync
else
cfdisk "$HD_DEV"
sync
fi
return $SUCCESS
}
# get partition label
get_partition_label()
{
PART_LABEL="$(parted -m $HD_DEV print | grep $HD_DEV | cut -d ':' -f 6)"
return $SUCCESS
}
# get partitions
ask_partitions()
{
partitions=$(ls ${HD_DEV}* | grep -v "${HD_DEV}\>")
while [ \
"$BOOT_PART" = '' -o \
"$ROOT_PART" = '' -o \
"$BOOT_FS_TYPE" = '' -o \
"$ROOT_FS_TYPE" = '' ]
do
title 'Hard Drive Setup > Partitions'
wprintf '[+] Created partitions:'
printf "\n\n"
for i in $partitions
do
echo " > $i"
done
echo
if [ "$BOOT_MODE" = 'uefi' ] && [ "$PART_LABEL" = 'gpt' ]
then
wprintf '[?] EFI System partition (/dev/sdXY): '
read BOOT_PART
BOOT_FS_TYPE="fat32"
else
wprintf '[?] Boot partition (/dev/sdXY): '
read BOOT_PART
wprintf '[?] Boot FS type (ext2, ext3, ext4): '
read BOOT_FS_TYPE
fi
wprintf '[?] Root partition (/dev/sdXY): '
read ROOT_PART
wprintf '[?] Root FS type (ext2, ext3, ext4, btrfs): '
read ROOT_FS_TYPE
wprintf '[?] Swap parition (/dev/sdXY - empty for none): '
read SWAP_PART
if [ "$SWAP_PART" = '' ]
then
SWAP_PART='none'
fi
clear
done
return $SUCCESS
}
# print partitions and ask for confirmation
print_partitions()
{
i=""
while true
do
title 'Hard Drive Setup > Partitions'
wprintf '[+] Current Partition table'
printf "\n
> /boot : $BOOT_PART ($BOOT_FS_TYPE)
> / : $ROOT_PART ($ROOT_FS_TYPE)
> swap : $SWAP_PART (swap)
\n"
wprintf '[?] Partition table correct [y/n]: '
read i
if [ "$i" = 'y' -o "$i" = 'Y' ]
then
clear
break
elif [ "$i" = 'n' -o "$i" = 'N' ]
then
echo
err 'Hard Drive Setup aborted.'
else
clear
continue
fi
clear
done
return $SUCCESS
}
# ask user and get confirmation for formatting
ask_formatting()
{
if confirm 'Hard Drive Setup > Partition Formatting' '[?] Formatting partitions. Are you sure? No crying afterwards? [y/n]: '
then
return $SUCCESS
else
echo
err 'Seriously? No formatting no fun!'
fi
return $SUCCESS