3 # Arch Base Installation Framework (version 2.2.3 - 26-Mar-2016)
5 # Written by Carl Duff for PacBang Linux
7 # This program is free software, provided under the GNU General Public License
8 # as published by the Free Software Foundation. So feel free to copy, distribute,
9 # or modify it as you wish.
12 ######################################################################
14 ## Installer Variables ##
16 ######################################################################
19 # ISO Specific Variables. READ CAREFULLY FOR YOUR DISTRO #
22 # This MUST be the same as listed in /etc/hosts
23 ISO_HOST="pacbang" # ISO Host Name
25 # This MUST be the same as the live account
26 ISO_USER="paclive" # Live user account.
28 # Call this what you like
29 VERSION="Pacbang Installation Framework 2.2.3" # Installer Name / Version
31 # This should not need to be changed
32 TRANS_SRC="/pbif-master" # Dir where translation files are stored
35 # Other variables for installer #
38 # Editor for modifying configs
41 # Create a temporary file to store menu selections
45 BOOTLOADER="n/a" # Which bootloader has been installed?
46 KEYMAP="us" # Virtual console keymap. Default is "us"
47 XKBMAP="us" # X11 keyboard layout. Default is "us"
50 LOCALE="en_US.UTF-8" # System locale. Default is "en_US.UTF-8"
53 ARCHI=$(uname -m) # Display whether 32 or 64 bit system
54 SYSTEM="Unknown" # Display whether system is BIOS or UEFI. Default is "unknown"
55 ROOT_PART="" # ROOT partition
56 UEFI_PART="" # UEFI partition
57 UEFI_MOUNT="" # UEFI mountpoint
58 INST_DEV="" # Device where system has been installed
59 HIGHLIGHT=0 # Highlight items for Main Menu
60 HIGHLIGHT_SUB=0 # Highlight items for submenus
61 SUB_MENU="" # Submenu to be highlighted
63 # Logical Volume Management
64 LVM=0 # Logical Volume Management Detected?
65 LVM_SEP_BOOT=0 # 1 = Seperate /boot, 2 = seperate /boot & LVM
66 LVM_VG="" # Name of volume group to create or use
67 LVM_VG_MB=0 # MB remaining of VG
68 LVM_LV_NAME="" # Name of LV to create or use
69 LV_SIZE_INVALID=0 # Is LVM LV size entered valid?
70 VG_SIZE_TYPE="" # Is VG in Gigabytes or Megabytes?
73 LUKS=0 # Luks Detected?
74 LUKS_DEV="" # If encrypted, partition
75 LUKS_NAME="" # Name given to encrypted partition
76 LUKS_UUID="" # UUID used for comparison purposes
77 LUKS_OPT="" # Default or user-defined?
80 MOUNTPOINT="/mnt" # Installation
81 AIROOTIMG="" # Root image to install
82 BYPASS="$MOUNTPOINT/bypass/" # Root image mountpoint
83 BTRFS=0 # BTRFS used? "1" = btrfs alone, "2" = btrfs + subvolume(s)
84 MOUNT_OPTS="/tmp/.mnt_opts" # Filesystem Mount options
85 FS_OPTS="" # FS mount options available
86 CHK_NUM=16 # Used for FS mount options checklist length
89 CURR_LOCALE="en_US.UTF-8" # Default Locale
90 FONT="" # Set new font if necessary
93 FILE="" # Which file is to be opened?
95 ######################################################################
99 ######################################################################
101 # Add locale on-the-fly and sets source translation file for installer
104 dialog --backtitle "$VERSION - $SYSTEM ($ARCHI)" --title " Select Language " --menu "\nLanguage / sprache / taal / språk / lingua / idioma / nyelv / língua" 0 0 9 \
105 "1" $"English (en_**)" \
106 "2" $"Español (es_ES)" \
107 "3" $"Português [Brasil] (pt_BR)" \
108 "4" $"Português (pt_PT)" \
109 "5" $"Français (fr_FR)" \
110 "6" $"Russkiy (ru_RU)" \
111 "7" $"Italiano (it_IT)" \
112 "8" $"Nederlands (nl_NL)" \
113 "9" $"Magyar (hu_HU)" 2>${ANSWER}
115 case $(cat ${ANSWER}) in
116 "1") source ${TRANS_SRC}/english.trans
117 CURR_LOCALE="en_US.UTF-8"
119 "2") source ${TRANS_SRC}/spanish.trans
120 CURR_LOCALE="es_ES.UTF-8"
122 "3") source ${TRANS_SRC}/portuguese_brasil.trans
123 CURR_LOCALE="pt_BR.UTF-8"
125 "4") source ${TRANS_SRC}/portuguese.trans
126 CURR_LOCALE="pt_PT.UTF-8"
128 "5") source ${TRANS_SRC}/french.trans
129 CURR_LOCALE="fr_FR.UTF-8"
131 "6") source ${TRANS_SRC}/russian.trans
132 CURR_LOCALE="ru_RU.UTF-8"
133 FONT="LatKaCyrHeb-14.psfu"
135 "7") source ${TRANS_SRC}/italian.trans
136 CURR_LOCALE="it_IT.UTF-8"
138 "8") source ${TRANS_SRC}/dutch.trans
139 CURR_LOCALE="nl_NL.UTF-8"
141 "9") source ${TRANS_SRC}/hungarian.trans
142 CURR_LOCALE="hu_HU.UTF-8"
149 # Generate the chosen locale and set the language
150 sed -i "s/#${CURR_LOCALE}/${CURR_LOCALE}/" /etc/locale.gen
151 locale-gen >/dev/null 2>&1
152 export LANG=${CURR_LOCALE}
153 [[ $FONT != "" ]] && setfont $FONT
158 # Check user is root, and that there is an active internet connection
159 # Seperated the checks into seperate "if" statements for readability.
160 check_requirements() {
162 dialog --backtitle "$VERSION - $SYSTEM ($ARCHI)" --title " $_ChkTitle " --infobox "$_PlsWaitBody" 0 0
165 if [[ $(whoami) != "root" ]]; then
166 dialog --backtitle "$VERSION - $SYSTEM ($ARCHI)" --title " $_Erritle " --infobox "$_RtFailBody" 0 0
171 # The error log is also cleared, just in case something is there from a previous use of the installer.
172 dialog --backtitle "$VERSION - $SYSTEM ($ARCHI)" --title " $_ReqMetTitle " --infobox "$_ReqMetBody" 0 0
175 echo "" > /tmp/.errlog
178 # Adapted from AIS. Checks if system is made by Apple, whether the system is BIOS or UEFI,
179 # and for LVM and/or LUKS.
182 # Apple System Detection
183 if [[ "$(cat /sys/class/dmi/id/sys_vendor)" == 'Apple Inc.' ]] || [[ "$(cat /sys/class/dmi/id/sys_vendor)" == 'Apple Computer, Inc.' ]]; then
184 modprobe -r -q efivars || true # if MAC
186 modprobe -q efivarfs # all others
189 # BIOS or UEFI Detection
190 if [[ -d "/sys/firmware/efi/" ]]; then
191 # Mount efivarfs if it is not already mounted
192 if [[ -z $(mount | grep /sys/firmware/efi/efivars) ]]; then
193 mount -t efivarfs efivarfs /sys/firmware/efi/efivars
203 # Adapted from AIS. An excellent bit of code!
205 arch-chroot $MOUNTPOINT /bin/bash -c "${1}"
208 # If there is an error, display it, clear the log and then go back to the main menu (no point in continuing).
211 if [[ $? -eq 1 ]] && [[ $(cat /tmp/.errlog | grep -i "error") != "" ]]; then
212 dialog --backtitle "$VERSION - $SYSTEM ($ARCHI)" --title " $_ErrTitle " --msgbox "$(cat /tmp/.errlog)" 0 0
213 echo "" > /tmp/.errlog
219 # Ensure that a partition is mounted
222 if [[ $(lsblk -o MOUNTPOINT | grep ${MOUNTPOINT}) == "" ]]; then
223 dialog --backtitle "$VERSION - $SYSTEM ($ARCHI)" --title " $_ErrTitle " --msgbox "$_ErrNoMount" 0 0
229 # Ensure that Arch has been installed
232 if [[ ! -e ${MOUNTPOINT}/etc ]]; then
233 dialog --backtitle "$VERSION - $SYSTEM ($ARCHI)" --title " $_ErrTitle " --msgbox "$_ErrNoBase" 0 0
239 # Simple code to show devices / partitions.
241 lsblk -o NAME,MODEL,TYPE,FSTYPE,SIZE,MOUNTPOINT | grep "disk\|part\|lvm\|crypt\|NAME\|MODEL\|TYPE\|FSTYPE\|SIZE\|MOUNTPOINT" > /tmp/.devlist
242 dialog --backtitle "$VERSION - $SYSTEM ($ARCHI)" --title " $_DevShowOpt " --textbox /tmp/.devlist 0 0
247 ######################################################################
249 ## Configuration Functions ##
251 ######################################################################
253 # virtual console keymap
257 for i in $(ls -R /usr/share/kbd/keymaps | grep "map.gz" | sed 's/\.map\.gz//g' | sort); do
258 KEYMAPS="${KEYMAPS} ${i} -"
261 dialog --backtitle "$VERSION - $SYSTEM ($ARCHI)" --title " $_VCKeymapTitle " \
262 --menu "$_VCKeymapBody" 20 40 16 ${KEYMAPS} 2>${ANSWER} || prep_menu
263 KEYMAP=$(cat ${ANSWER})
265 echo -e "KEYMAP=${KEYMAP}\nFONT=${FONT}" > /tmp/vconsole.conf
272 keymaps_xkb=("af al am at az ba bd be bg br bt bw by ca cd ch cm cn cz de dk ee es et eu fi fo fr gb ge gh gn gr hr hu ie il in iq ir is it jp ke kg kh kr kz la lk lt lv ma md me mk ml mm mn mt mv ng nl no np pc ph pk pl pt ro rs ru se si sk sn sy tg th tj tm tr tw tz ua us uz vn za")
274 for i in ${keymaps_xkb}; do
275 XKBMAP_LIST="${XKBMAP_LIST} ${i} -"
278 dialog --backtitle "$VERSION - $SYSTEM ($ARCHI)" --title " $_PrepKBLayout " --menu "$_XkbmapBody" 0 0 16 ${XKBMAP_LIST} 2>${ANSWER} || install_graphics_menu
279 XKBMAP=$(cat ${ANSWER} |sed 's/_.*//')
280 echo -e "Section "\"InputClass"\"\nIdentifier "\"system-keyboard"\"\nMatchIsKeyboard "\"on"\"\nOption "\"XkbLayout"\" "\"${XKBMAP}"\"\nEndSection" > /tmp/01-keyboard-layout.conf
282 setxkbmap $XKBMAP 2>/tmp/.errlog
287 # locale array generation code adapted from the Manjaro 0.8 installer
291 for i in $(cat /etc/locale.gen | grep -v "# " | sed 's/#//g' | sed 's/ UTF-8//g' | grep .UTF-8); do
292 LOCALES="${LOCALES} ${i} -"
295 dialog --backtitle "$VERSION - $SYSTEM ($ARCHI)" --title " $_ConfBseSysLoc " --menu "$_localeBody" 0 0 12 ${LOCALES} 2>${ANSWER} || config_base_menu
297 LOCALE=$(cat ${ANSWER})
299 echo "LANG=\"${LOCALE}\"" > ${MOUNTPOINT}/etc/locale.conf
300 sed -i "s/#${LOCALE}/${LOCALE}/" ${MOUNTPOINT}/etc/locale.gen 2>/tmp/.errlog
301 arch_chroot "locale-gen" >/dev/null 2>>/tmp/.errlog
305 # Set Zone and Sub-Zone
309 for i in $(cat /usr/share/zoneinfo/zone.tab | awk '{print $3}' | grep "/" | sed "s/\/.*//g" | sort -ud); do
313 dialog --backtitle "$VERSION - $SYSTEM ($ARCHI)" --title " $_ConfBseTimeHC " --menu "$_TimeZBody" 0 0 10 ${ZONE} 2>${ANSWER} || config_base_menu
314 ZONE=$(cat ${ANSWER})
317 for i in $(cat /usr/share/zoneinfo/zone.tab | awk '{print $3}' | grep "${ZONE}/" | sed "s/${ZONE}\///g" | sort -ud); do
318 SUBZONE="$SUBZONE ${i} -"
321 dialog --backtitle "$VERSION - $SYSTEM ($ARCHI)" --title " $_ConfBseTimeHC " --menu "$_TimeSubZBody" 0 0 11 ${SUBZONE} 2>${ANSWER} || config_base_menu
322 SUBZONE=$(cat ${ANSWER})
324 dialog --backtitle "$VERSION - $SYSTEM ($ARCHI)" --title " $_ConfBseTimeHC " --yesno "$_TimeZQ ${ZONE}/${SUBZONE}?" 0 0
326 if [[ $? -eq 0 ]]; then
327 arch_chroot "ln -sf /usr/share/zoneinfo/${ZONE}/${SUBZONE} /etc/localtime" 2>/tmp/.errlog
336 dialog --backtitle "$VERSION - $SYSTEM ($ARCHI)" --title " $_ConfBseTimeHC " --menu "$_HwCBody" 0 0 2 \
337 "utc" "-" "localtime" "-" 2>${ANSWER}
339 [[ $(cat ${ANSWER}) != "" ]] && arch_chroot "hwclock --systohc --$(cat ${ANSWER})" 2>/tmp/.errlog && check_for_error
342 # Generate the installed system's FSTAB
345 dialog --backtitle "$VERSION - $SYSTEM ($ARCHI)" --title " $_ConfBseFstab " --menu "$_FstabBody" 0 0 4 \
346 "genfstab -U -p" "$_FstabDevUUID" \
347 "genfstab -p" "$_FstabDevName" \
348 "genfstab -L -p" "$_FstabDevLabel" \
349 "genfstab -t PARTUUID -p" "$_FstabDevPtUUID" 2>${ANSWER}
351 if [[ $(cat ${ANSWER}) != "" ]]; then
352 if [[ $SYSTEM == "BIOS" ]] && [[ $(cat ${ANSWER}) == "genfstab -t PARTUUID -p" ]]; then
353 dialog --backtitle "$VERSION - $SYSTEM ($ARCHI)" --title " $_ErrTitle " --msgbox "$_FstabErr" 0 0
356 $(cat ${ANSWER}) ${MOUNTPOINT} > ${MOUNTPOINT}/etc/fstab 2>/tmp/.errlog
358 [[ -f ${MOUNTPOINT}/swapfile ]] && sed -i "s/\\${MOUNTPOINT}//" ${MOUNTPOINT}/etc/fstab
362 # Determine if there is a swapfile before copying over appropriate OB configs
363 if [[ $(cat $MOUNTPOINT/etc/fstab | grep "swap") != "" ]]; then
364 # rc.xml -- swap/hibernate
365 cp -f /inst/rc2.xml $MOUNTPOINT/etc/skel/.config/openbox/menu.xml 2>/tmp/.errlog
366 cp -f /inst/rc2.xml $MOUNTPOINT/root/.config/openbox/menu.xml 2>/tmp/.errlog
367 cp -f /inst/rc2.xml $MOUNTPOINT/home/$ISO_USER/.config/openbox/menu.xml 2>/tmp/.errlog
368 # menu.xml -- swap/hibernate
369 cp -f /inst/menu2.xml $MOUNTPOINT/etc/skel/.config/openbox/menu.xml 2>/tmp/.errlog
370 cp -f /inst/menu2.xml $MOUNTPOINT/root/.config/openbox/menu.xml 2>/tmp/.errlog
371 cp -f /inst/menu2.xml $MOUNTPOINT/home/$ISO_USER/.config/openbox/menu.xml 2>/tmp/.errlog
374 cp -f /inst/rc.xml $MOUNTPOINT/etc/skel/.config/openbox/menu.xml 2>/tmp/.errlog
375 cp -f /inst/rc.xml $MOUNTPOINT/root/.config/openbox/menu.xml 2>/tmp/.errlog
376 cp -f /inst/rc.xml $MOUNTPOINT/home/$ISO_USER/.config/openbox/menu.xml 2>/tmp/.errlog
378 cp -f /inst/menu.xml $MOUNTPOINT/etc/skel/.config/openbox/menu.xml 2>/tmp/.errlog
379 cp -f /inst/menu.xml $MOUNTPOINT/root/.config/openbox/menu.xml 2>/tmp/.errlog
380 cp -f /inst/menu.xml $MOUNTPOINT/home/$ISO_USER/.config/openbox/menu.xml 2>/tmp/.errlog
386 # Set the installed system's hostname
389 dialog --backtitle "$VERSION - $SYSTEM ($ARCHI)" --title " $_ConfBseHost " --inputbox "$_HostNameBody" 0 0 "pacbang" 2>${ANSWER} || config_base_menu
391 echo "$(cat ${ANSWER})" > ${MOUNTPOINT}/etc/hostname 2>/tmp/.errlog
392 echo -e "#ip-address\thostname.domain.org\thostname\n127.0.0.1\tlocalhost.localdomain\tlocalhost\n::1\tlocalhost\n127.0.1.1\t$(cat ${ANSWER}).localdomain\t$(cat ${ANSWER})" > ${MOUNTPOINT}/etc/hosts 2>>/tmp/.errlog
396 # Set the installed system's root password
397 set_root_password() {
399 dialog --backtitle "$VERSION - $SYSTEM ($ARCHI)" --title " $_ConfUsrRoot " --clear --insecure --passwordbox "$_PassRtBody" 0 0 2> ${ANSWER} || config_base_menu
400 PASSWD=$(cat ${ANSWER})
402 dialog --backtitle "$VERSION - $SYSTEM ($ARCHI)" --title " $_ConfUsrRoot " --clear --insecure --passwordbox "$_PassReEntBody" 0 0 2> ${ANSWER} || config_base_menu
403 PASSWD2=$(cat ${ANSWER})
405 if [[ $PASSWD == $PASSWD2 ]]; then
406 echo -e "${PASSWD}\n${PASSWD}" > /tmp/.passwd
407 arch_chroot "passwd root" < /tmp/.passwd >/dev/null 2>/tmp/.errlog
411 dialog --backtitle "$VERSION - $SYSTEM ($ARCHI)" --title " $_ErrTitle " --msgbox "$_PassErrBody" 0 0
417 # Create new user(s) for installed system. First user is created by renaming the live account.
418 # All others are brand new.
421 dialog --backtitle "$VERSION - $SYSTEM ($ARCHI)" --title " $_NUsrTitle " --inputbox "$_NUsrBody" 0 0 "" 2>${ANSWER} || config_base_menu
422 USER=$(cat ${ANSWER})
424 # Loop while user name is blank, has spaces, or has capital letters in it.
425 while [[ ${#USER} -eq 0 ]] || [[ $USER =~ \ |\' ]] || [[ $USER =~ [^a-z0-9\ ] ]]; do
426 dialog --backtitle "$VERSION - $SYSTEM ($ARCHI)" --title " $_NUsrTitle " --inputbox "$_NUsrErrBody" 0 0 "" 2>${ANSWER} || config_base_menu
427 USER=$(cat ${ANSWER})
430 # Enter password. This step will only be reached where the loop has been skipped or broken.
431 dialog --backtitle "$VERSION - $SYSTEM ($ARCHI)" --title " $_ConfUsrNew " --clear --insecure --passwordbox "$_PassNUsrBody $USER\n\n" 0 0 2> ${ANSWER} || config_base_menu
432 PASSWD=$(cat ${ANSWER})
434 dialog --backtitle "$VERSION - $SYSTEM ($ARCHI)" --title " $_ConfUsrNew " --clear --insecure --passwordbox "$_PassReEntBody" 0 0 2> ${ANSWER} || config_base_menu
435 PASSWD2=$(cat ${ANSWER})
437 # loop while passwords entered do not match.
438 while [[ $PASSWD != $PASSWD2 ]]; do
439 dialog --backtitle "$VERSION - $SYSTEM ($ARCHI)" --title " $_ErrTitle " --msgbox "$_PassErrBody" 0 0
441 dialog --backtitle "$VERSION - $SYSTEM ($ARCHI)" --title " $_ConfUsrNew " --clear --insecure --passwordbox "$_PassNUsrBody $USER\n\n" 0 0 2> ${ANSWER} || config_base_menu
442 PASSWD=$(cat ${ANSWER})
444 dialog --backtitle "$VERSION - $SYSTEM ($ARCHI)" --title " $_ConfUsrNew " --clear --insecure --passwordbox "$_PassReEntBody" 0 0 2> ${ANSWER} || config_base_menu
445 PASSWD2=$(cat ${ANSWER})
448 # create new user. This step will only be reached where the password loop has been skipped or broken.
449 dialog --backtitle "$VERSION - $SYSTEM ($ARCHI)" --title " $_ConfUsrNew " --infobox "$_NUsrSetBody" 0 0
451 echo -e "${PASSWD}\n${PASSWD}" > /tmp/.passwd
453 # If the first (or only) user account, then change the live account
454 if [[ -e ${MOUNTPOINT}/home/$ISO_USER ]]; then
455 arch_chroot "passwd $ISO_USER" < /tmp/.passwd >/dev/null 2>>/tmp/.errlog
458 # Distro-specific configuration for entered username
459 sed -i "s/$ISO_USER/$USER/g" ${MOUNTPOINT}/home/$ISO_USER/.gtkrc-2.0 2>/tmp/.errlog
461 # Convert live account to entered username - group, password, folder, and ownership
462 sed -i "s/$ISO_USER/$USER/g" ${MOUNTPOINT}/etc/group 2>>/tmp/.errlog
463 sed -i "s/$ISO_USER/$USER/g" ${MOUNTPOINT}/etc/gshadow 2>>/tmp/.errlog
464 sed -i "s/$ISO_USER/$USER/g" ${MOUNTPOINT}/etc/passwd 2>>/tmp/.errlog
465 sed -i "s/$ISO_USER/$USER/g" ${MOUNTPOINT}/etc/shadow 2>>/tmp/.errlog
466 mv ${MOUNTPOINT}/home/$ISO_USER ${MOUNTPOINT}/home/$USER 2>>/tmp/.errlog
467 chown -R $USER:users ${MOUNTPOINT}/home/$USER 2>>/tmp/.errlog
469 # Change sudoers file to require passwords for sudo commands
470 sed -i '/%wheel ALL=(ALL) ALL/s/^#//' ${MOUNTPOINT}/etc/sudoers 2>>/tmp/.errlog
471 sed -i '/%wheel ALL=(ALL) ALL NOPASSWD: ALL/s/#%wheel ALL=(ALL) ALL NOPASSWD: ALL//' ${MOUNTPOINT}/etc/sudoers 2>>/tmp/.errlog
474 # If the live account has already been changed, create a new user account
475 arch_chroot "useradd ${USER} -m -g users -G wheel,storage,power,network,video,audio,lp -s /bin/bash" 2>/tmp/.errlog
476 arch_chroot "passwd ${USER}" < /tmp/.passwd >/dev/null 2>>/tmp/.errlog
478 # Set up basic configuration files and ownership for new account
479 arch_chroot "cp -R /etc/skel/ /home/${USER}" 2>>/tmp/.errlog
480 arch_chroot "chown -R ${USER}:users /home/${USER}" 2>>/tmp/.errlog
492 # If LVM and/or LUKS used, add the relevant hook(s)
493 ([[ $LVM -eq 1 ]] && [[ $LUKS -eq 0 ]]) && sed -i 's/block filesystems/block lvm2 filesystems/g' ${MOUNTPOINT}/etc/mkinitcpio.conf 2>/tmp/.errlog
494 ([[ $LVM -eq 1 ]] && [[ $LUKS -eq 1 ]]) && sed -i 's/block filesystems/block encrypt lvm2 filesystems/g' ${MOUNTPOINT}/etc/mkinitcpio.conf 2>/tmp/.errlog
495 ([[ $LVM -eq 0 ]] && [[ $LUKS -eq 1 ]]) && sed -i 's/block filesystems/block encrypt filesystems/g' ${MOUNTPOINT}/etc/mkinitcpio.conf 2>/tmp/.errlog
498 arch_chroot "mkinitcpio -p linux" 2>>/tmp/.errlog
503 ######################################################################
505 ## System and Partitioning Functions ##
507 ######################################################################
511 # Unmount partitions.
515 MOUNTED=$(mount | grep "${MOUNTPOINT}" | awk '{print $3}' | sort -r)
518 for i in ${MOUNTED[@]}; do
519 umount $i >/dev/null 2>>/tmp/.errlog
526 # Revised to deal with partion sizes now being displayed to the user
528 if [[ $(mount | grep $1) ]]; then
529 dialog --backtitle "$VERSION - $SYSTEM ($ARCHI)" --title " $_MntStatusTitle " --infobox "$_MntStatusSucc" 0 0
531 PARTITIONS=$(echo $PARTITIONS | sed "s~${PARTITION} [0-9]*[G-M]~~" | sed "s~${PARTITION} [0-9]*\.[0-9]*[G-M]~~" | sed s~${PARTITION}$' -'~~)
532 NUMBER_PARTITIONS=$(( NUMBER_PARTITIONS - 1 ))
534 dialog --backtitle "$VERSION - $SYSTEM ($ARCHI)" --title " $_MntStatusTitle " --infobox "$_MntStatusFail" 0 0
540 # This function does not assume that the formatted device is the Root installation device as
541 # more than one device may be formatted. Root is set in the mount_partitions function.
545 devices_list=$(lsblk -lno NAME,SIZE,TYPE | grep 'disk' | awk '{print "/dev/" $1 " " $2}' | sort -u);
547 for i in ${devices_list[@]}; do
548 DEVICE="${DEVICE} ${i}"
551 dialog --backtitle "$VERSION - $SYSTEM ($ARCHI)" --title " $_DevSelTitle " --menu "$_DevSelBody" 0 0 4 ${DEVICE} 2>${ANSWER} || prep_menu
552 DEVICE=$(cat ${ANSWER})
556 # Finds all available partitions according to type(s) specified and generates a list
557 # of them. This also includes partitions on different devices.
562 partition_list=$(lsblk -lno NAME,SIZE,TYPE | grep $INCLUDE_PART | sed 's/part$/\/dev\//g' | sed 's/lvm$\|crypt$/\/dev\/mapper\//g' | awk '{print $3$1 " " $2}' | sort -u)
564 for i in ${partition_list}; do
565 PARTITIONS="${PARTITIONS} ${i}"
566 NUMBER_PARTITIONS=$(( NUMBER_PARTITIONS + 1 ))
569 # Double-partitions will be counted due to counting sizes, so fix
570 NUMBER_PARTITIONS=$(( NUMBER_PARTITIONS / 2 ))
572 # Deal with partitioning schemes appropriate to mounting, lvm, and/or luks.
573 case $INCLUDE_PART in
574 'part\|lvm\|crypt') # Deal with incorrect partitioning for main mounting function
576 if ([[ $SYSTEM == "UEFI" ]] && [[ $NUMBER_PARTITIONS -lt 2 ]]) || ([[ $SYSTEM == "BIOS" ]] && [[ $NUMBER_PARTITIONS -eq 0 ]]); then
577 dialog --backtitle "$VERSION - $SYSTEM ($ARCHI)" --title " $_ErrTitle " --msgbox "$_PartErrBody" 0 0
581 'part\|crypt') # Ensure there is at least one partition for LVM
582 if [[ $NUMBER_PARTITIONS -eq 0 ]]; then
583 dialog --backtitle "$VERSION - $SYSTEM ($ARCHI)" --title " $_ErrTitle " --msgbox "$_LvmPartErrBody" 0 0
587 'part\|lvm') # Ensure there are at least two partitions for LUKS
588 if [[ $NUMBER_PARTITIONS -lt 2 ]]; then
589 dialog --backtitle "$VERSION - $SYSTEM ($ARCHI)" --title " $_ErrTitle " --msgbox "$_LuksPartErrBody" 0 0
601 # Securely destroy all data on a given device.
604 # Warn the user. If they proceed, wipe the selected device.
605 dialog --backtitle "$VERSION - $SYSTEM ($ARCHI)" --title " $_PartOptWipe " --yesno "$_AutoPartWipeBody1 ${DEVICE} $_AutoPartWipeBody2" 0 0
606 if [[ $? -eq 0 ]]; then
611 # Alternate dd command - requires pv to be installed
612 #dd if=/dev/zero | pv | dd of=${DEVICE} iflag=nocache oflag=direct bs=4096 2>/tmp/.errlog
622 # Provide warning to user
623 dialog --backtitle "$VERSION - $SYSTEM ($ARCHI)" --title " $_PrepPartDisk " --yesno "$_AutoPartBody1 $DEVICE $_AutoPartBody2 $_AutoPartBody3" 0 0
625 if [[ $? -eq 0 ]]; then
627 # Find existing partitions (if any) to remove
628 parted -s ${DEVICE} print | awk '/^ / {print $1}' > /tmp/.del_parts
630 for del_part in $(tac /tmp/.del_parts); do
631 parted -s ${DEVICE} rm ${del_part} 2>/tmp/.errlog
635 # Identify the partition table
636 part_table=$(parted -s ${DEVICE} print | grep -i 'partition table' | awk '{print $3}')
638 # Create partition table if one does not already exist
639 ([[ $SYSTEM == "BIOS" ]] && [[ $part_table != "msdos" ]]) && parted -s ${DEVICE} mklabel msdos 2>/tmp/.errlog
640 ([[ $SYSTEM == "UEFI" ]] && [[ $part_table != "gpt" ]]) && parted -s ${DEVICE} mklabel gpt 2>/tmp/.errlog
643 # Create partitions (same basic partitioning scheme for BIOS and UEFI)
644 if [[ $SYSTEM == "BIOS" ]]; then
645 parted -s ${DEVICE} mkpart primary ext3 1MiB 513MiB 2>/tmp/.errlog
646 parted -s ${DEVICE} set 1 boot on 2>>/tmp/.errlog
648 parted -s ${DEVICE} mkpart primary fat32 1MiB 513MiB 2>/tmp/.errlog
649 parted -s ${DEVICE} set 1 esp on 2>>/tmp/.errlog
652 # Create root partition
653 parted -s ${DEVICE} mkpart primary ext3 513MiB 100% 2>>/tmp/.errlog
657 # Show created partitions
658 lsblk ${DEVICE} -o NAME,TYPE,FSTYPE,SIZE > /tmp/.devlist
659 dialog --backtitle "$VERSION - $SYSTEM ($ARCHI)" --title "" --textbox /tmp/.devlist 0 0
666 dialog --backtitle "$VERSION - $SYSTEM ($ARCHI)" --title "$_PartToolTitle" --menu "$_PartToolBody" 0 0 5 \
667 "$_PartOptWipe" "BIOS & UEFI" \
668 "$_PartOptAuto" "BIOS & UEFI" \
669 "gparted" "BIOS & UEFI" \
670 "cfdisk" "BIOS/MBR" \
671 "parted" "UEFI/GPT" 2>${ANSWER}
674 # If something selected
675 if [[ $(cat ${ANSWER}) != "" ]]; then
676 if ([[ $(cat ${ANSWER}) != "$_PartOptWipe" ]] && [[ $(cat ${ANSWER}) != "$_PartOptAuto" ]]); then
677 $(cat ${ANSWER}) ${DEVICE}
679 [[ $(cat ${ANSWER}) == "$_PartOptWipe" ]] && secure_wipe && create_partitions
680 [[ $(cat ${ANSWER}) == "$_PartOptAuto" ]] && auto_partition
687 # Set static list of filesystems rather than on-the-fly. Partially as most require additional flags, and
688 # partially because some don't seem to be viable.
689 # Set static list of filesystems rather than on-the-fly.
696 dialog --backtitle "$VERSION - $SYSTEM ($ARCHI)" --title " $_FSTitle " --menu "$_FSBody" 0 0 12 \
698 "btrfs" "mkfs.btrfs -f" \
699 "ext2" "mkfs.ext2 -q" \
700 "ext3" "mkfs.ext3 -q" \
701 "ext4" "mkfs.ext4 -q" \
702 "f2fs" "mkfs.f2fs -f" \
703 "jfs" "mkfs.jfs -q" \
704 "nilfs2" "mkfs.nilfs2 -q" \
705 "ntfs" "mkfs.ntfs -q" \
706 "reiserfs" "mkfs.reiserfs -q" \
707 "vfat" "mkfs.vfat -F32" \
708 "xfs" "mkfs.xfs -f" 2>${ANSWER}
710 case $(cat ${ANSWER}) in
711 "$_FSSkip") FILESYSTEM="$_FSSkip" ;;
712 "btrfs") FILESYSTEM="mkfs.btrfs -f"
714 fs_opts="autodefrag compress=zlib compress=lzo compress=no compress-force=zlib compress-force=lzo discard noacl noatime nodatasum nospace_cache recovery skip_balance space_cache ssd ssd_spread"
717 "ext2") FILESYSTEM="mkfs.ext2 -q" ;;
718 "ext3") FILESYSTEM="mkfs.ext3 -q" ;;
719 "ext4") FILESYSTEM="mkfs.ext4 -q"
721 fs_opts="data=journal data=writeback dealloc discard noacl noatime nobarrier nodelalloc"
723 "f2fs") FILESYSTEM="mkfs.f2fs -f"
724 fs_opts="data_flush disable_roll_forward disable_ext_identify discard fastboot flush_merge inline_xattr inline_data inline_dentry no_heap noacl nobarrier noextent_cache noinline_data norecovery"
728 "jfs") FILESYSTEM="mkfs.jfs -q"
730 fs_opts="discard errors=continue errors=panic nointegrity"
732 "nilfs2") FILESYSTEM="mkfs.nilfs2 -q"
734 fs_opts="discard nobarrier errors=continue errors=panic order=relaxed order=strict norecovery"
736 "ntfs") FILESYSTEM="mkfs.ntfs -q" ;;
737 "reiserfs") FILESYSTEM="mkfs.reiserfs -q"
739 fs_opts="acl nolog notail replayonly user_xattr"
741 "vfat") FILESYSTEM="mkfs.vfat -F32" ;;
742 "xfs") FILESYSTEM="mkfs.xfs -f"
744 fs_opts="discard filestreams ikeep largeio noalign nobarrier norecovery noquota wsync"
749 # Warn about formatting!
750 if [[ $FILESYSTEM != $_FSSkip ]]; then
751 dialog --backtitle "$VERSION - $SYSTEM ($ARCHI)" --title " $_FSTitle " --yesno "\n$FILESYSTEM $PARTITION\n\n" 0 0
752 if [[ $? -eq 0 ]]; then
753 ${FILESYSTEM} ${PARTITION} >/dev/null 2>/tmp/.errlog
765 # This subfunction allows for special mounting options to be applied for relevant fs's.
766 # Seperate subfunction for neatness.
770 echo "" > ${MOUNT_OPTS}
772 for i in ${fs_opts}; do
773 FS_OPTS="${FS_OPTS} ${i} - off"
776 dialog --backtitle "$VERSION - $SYSTEM ($ARCHI)" --title " $(echo $FILESYSTEM | sed "s/.*\.//g" | sed "s/-.*//g") " --checklist "$_btrfsMntBody" 0 0 $CHK_NUM \
777 $FS_OPTS 2>${MOUNT_OPTS}
779 # Now clean up the file
780 sed -i 's/ /,/g' ${MOUNT_OPTS}
781 sed -i '$s/,$//' ${MOUNT_OPTS}
783 # If mount options selected, confirm choice
784 if [[ $(cat ${MOUNT_OPTS}) != "" ]]; then
785 dialog --backtitle "$VERSION - $SYSTEM ($ARCHI)" --title " $_MntStatusTitle " --yesno "\n${_btrfsMntConfBody}$(cat ${MOUNT_OPTS})\n" 10 75
786 [[ $? -eq 1 ]] && mount_opts
791 # Subfunction to save repetition of code
792 mount_current_partition(){
794 # Make the mount directory
795 mkdir -p ${MOUNTPOINT}${MOUNT} 2>/tmp/.errlog
797 # Get mounting options for appropriate filesystems
798 [[ $fs_opts != "" ]] && mount_opts
800 # Use special mounting options if selected, else standard mount
801 if [[ $(cat ${MOUNT_OPTS}) != "" ]]; then
802 mount -o $(cat ${MOUNT_OPTS}) ${PARTITION} ${MOUNTPOINT}${MOUNT} 2>>/tmp/.errlog
804 mount ${PARTITION} ${MOUNTPOINT}${MOUNT} 2>>/tmp/.errlog
808 confirm_mount ${MOUNTPOINT}${MOUNT}
810 # Identify if mounted partition is type "crypt" (LUKS on LVM, or LUKS alone)
811 if [[ $(lsblk -lno TYPE ${PARTITION} | grep "crypt") != "" ]]; then
813 # cryptname for bootloader configuration either way
815 LUKS_NAME=$(echo ${PARTITION} | sed "s~^/dev/mapper/~~g")
817 # Check if LUKS on LVM (parent = lvm /dev/mapper/...)
818 cryptparts=$(lsblk -lno NAME,FSTYPE,TYPE | grep "lvm" | grep -i "crypto_luks" | uniq | awk '{print "/dev/mapper/"$1}')
819 for i in ${cryptparts}; do
820 if [[ $(lsblk -lno NAME ${i} | grep $LUKS_NAME) != "" ]]; then
821 LUKS_DEV="$LUKS_DEV cryptdevice=${i}:$LUKS_NAME"
827 # Check if LUKS alone (parent = part /dev/...)
828 cryptparts=$(lsblk -lno NAME,FSTYPE,TYPE | grep "part" | grep -i "crypto_luks" | uniq | awk '{print "/dev/"$1}')
829 for i in ${cryptparts}; do
830 if [[ $(lsblk -lno NAME ${i} | grep $LUKS_NAME) != "" ]]; then
831 LUKS_UUID=$(lsblk -lno UUID,TYPE,FSTYPE ${i} | grep "part" | grep -i "crypto_luks" | awk '{print $1}')
832 LUKS_DEV="$LUKS_DEV cryptdevice=UUID=$LUKS_UUID:$LUKS_NAME"
837 # If LVM logical volume....
838 elif [[ $(lsblk -lno TYPE ${PARTITION} | grep "lvm") != "" ]]; then
841 # First get crypt name (code above would get lv name)
842 cryptparts=$(lsblk -lno NAME,TYPE,FSTYPE | grep "crypt" | grep -i "lvm2_member" | uniq | awk '{print "/dev/mapper/"$1}')
843 for i in ${cryptparts}; do
844 if [[ $(lsblk -lno NAME ${i} | grep $(echo $PARTITION | sed "s~^/dev/mapper/~~g")) != "" ]]; then
845 LUKS_NAME=$(echo ${i} | sed s~/dev/mapper/~~g)
850 # Now get the device (/dev/...) for the crypt name
851 cryptparts=$(lsblk -lno NAME,FSTYPE,TYPE | grep "part" | grep -i "crypto_luks" | uniq | awk '{print "/dev/"$1}')
852 for i in ${cryptparts}; do
853 if [[ $(lsblk -lno NAME ${i} | grep $LUKS_NAME) != "" ]]; then
854 # Create UUID for comparison
855 LUKS_UUID=$(lsblk -lno UUID,TYPE,FSTYPE ${i} | grep "part" | grep -i "crypto_luks" | awk '{print $1}')
857 # Check if not already added as a LUKS DEVICE (i.e. multiple LVs on one crypt). If not, add.
858 if [[ $(echo $LUKS_DEV | grep $LUKS_UUID) == "" ]]; then
859 LUKS_DEV="$LUKS_DEV cryptdevice=UUID=$LUKS_UUID:$LUKS_NAME"
871 # Seperate function due to ability to cancel
874 # Ask user to select partition or create swapfile
875 dialog --backtitle "$VERSION - $SYSTEM ($ARCHI)" --title " $_PrepMntPart " --menu "$_SelSwpBody" 0 0 7 "$_SelSwpNone" $"-" "$_SelSwpFile" $"-" ${PARTITIONS} 2>${ANSWER} || prep_menu
877 if [[ $(cat ${ANSWER}) != "$_SelSwpNone" ]]; then
878 PARTITION=$(cat ${ANSWER})
880 if [[ $PARTITION == "$_SelSwpFile" ]]; then
881 total_memory=$(grep MemTotal /proc/meminfo | awk '{print $2/1024}' | sed 's/\..*//')
882 dialog --backtitle "$VERSION - $SYSTEM ($ARCHI)" --title " $_SelSwpFile " --inputbox "\nM = MB, G = GB\n" 9 30 "${total_memory}M" 2>${ANSWER} || make_swap
883 m_or_g=$(cat ${ANSWER})
885 while [[ $(echo ${m_or_g: -1} | grep "M\|G") == "" ]]; do
886 dialog --backtitle "$VERSION - $SYSTEM ($ARCHI)" --title " $_SelSwpFile " --msgbox "\n$_SelSwpFile $_ErrTitle: M = MB, G = GB\n\n" 0 0
887 dialog --backtitle "$VERSION - $SYSTEM ($ARCHI)" --title " $_SelSwpFile " --inputbox "\nM = MB, G = GB\n" 9 30 "${total_memory}M" 2>${ANSWER} || make_swap
888 m_or_g=$(cat ${ANSWER})
891 fallocate -l ${m_or_g} ${MOUNTPOINT}/swapfile 2>/tmp/.errlog
892 chmod 600 ${MOUNTPOINT}/swapfile 2>>/tmp/.errlog
893 mkswap ${MOUNTPOINT}/swapfile 2>>/tmp/.errlog
894 swapon ${MOUNTPOINT}/swapfile 2>>/tmp/.errlog
897 else # Swap Partition
898 # Warn user if creating a new swap
899 if [[ $(lsblk -o FSTYPE ${PARTITION} | grep -i "swap") != "swap" ]]; then
900 dialog --backtitle "$VERSION - $SYSTEM ($ARCHI)" --title " $_PrepMntPart " --yesno "\nmkswap ${PARTITION}\n\n" 0 0
901 [[ $? -eq 0 ]] && mkswap ${PARTITION} >/dev/null 2>/tmp/.errlog || mount_partitions
903 # Whether existing to newly created, activate swap
904 swapon ${PARTITION} >/dev/null 2>>/tmp/.errlog
906 # Since a partition was used, remove that partition from the list
907 PARTITIONS=$(echo $PARTITIONS | sed "s~${PARTITION} [0-9]*[G-M]~~" | sed "s~${PARTITION} [0-9]*\.[0-9]*[G-M]~~" | sed s~${PARTITION}$' -'~~)
908 NUMBER_PARTITIONS=$(( NUMBER_PARTITIONS - 1 ))
915 #### MOUNTING FUNCTION BEGINS HERE ####
926 # Warn users that they CAN mount partitions without formatting them!
927 dialog --backtitle "$VERSION - $SYSTEM ($ARCHI)" --title " $_PrepMntPart " --msgbox "$_WarnMount1 '$_FSSkip' $_WarnMount2" 0 0
929 # LVM Detection. If detected, activate.
932 # Ensure partitions are unmounted (i.e. where mounted previously), and then list available partitions
933 INCLUDE_PART='part\|lvm\|crypt'
937 # Identify and mount root
938 dialog --backtitle "$VERSION - $SYSTEM ($ARCHI)" --title " $_PrepMntPart " --menu "$_SelRootBody" 0 0 7 ${PARTITIONS} 2>${ANSWER} || prep_menu
939 PARTITION=$(cat ${ANSWER})
940 ROOT_PART=${PARTITION}
942 # Format with FS (or skip)
945 # Make the directory and mount. Also identify LUKS and/or LVM
946 mount_current_partition
948 # Identify and create swap, if applicable
951 # Extra Step for VFAT UEFI Partition. This cannot be in an LVM container.
952 if [[ $SYSTEM == "UEFI" ]]; then
954 dialog --backtitle "$VERSION - $SYSTEM ($ARCHI)" --title " $_PrepMntPart " --menu "$_SelUefiBody" 0 0 7 ${PARTITIONS} 2>${ANSWER} || prep_menu
955 PARTITION=$(cat ${ANSWER})
956 UEFI_PART=${PARTITION}
958 # If it is already a fat/vfat partition...
959 if [[ $(fsck -N $PARTITION | grep fat) ]]; then
960 dialog --backtitle "$VERSION - $SYSTEM ($ARCHI)" --title " $_PrepMntPart " --yesno "$_FormUefiBody $PARTITION $_FormUefiBody2" 0 0 && mkfs.vfat -F32 ${PARTITION} >/dev/null 2>/tmp/.errlog
962 mkfs.vfat -F32 ${PARTITION} >/dev/null 2>/tmp/.errlog
966 # Inform users of the mountpoint options and consequences
967 dialog --backtitle "$VERSION - $SYSTEM ($ARCHI)" --title " $_PrepMntPart " --menu "$_MntUefiBody" 0 0 2 \
968 "/boot" "systemd-boot"\
969 "/boot/efi" "-" 2>${ANSWER}
971 [[ $(cat ${ANSWER}) != "" ]] && UEFI_MOUNT=$(cat ${ANSWER}) || prep_menu
973 mkdir -p ${MOUNTPOINT}${UEFI_MOUNT} 2>/tmp/.errlog
974 mount ${PARTITION} ${MOUNTPOINT}${UEFI_MOUNT} 2>>/tmp/.errlog
976 confirm_mount ${MOUNTPOINT}${UEFI_MOUNT}
979 # All other partitions
980 while [[ $NUMBER_PARTITIONS > 0 ]]; do
981 dialog --backtitle "$VERSION - $SYSTEM ($ARCHI)" --title " $_PrepMntPart " --menu "$_ExtPartBody" 0 0 7 "$_Done" $"-" ${PARTITIONS} 2>${ANSWER} || prep_menu
982 PARTITION=$(cat ${ANSWER})
984 if [[ $PARTITION == $_Done ]]; then
990 # Ask user for mountpoint. Don't give /boot as an example for UEFI systems!
991 [[ $SYSTEM == "UEFI" ]] && MNT_EXAMPLES="/home\n/var" || MNT_EXAMPLES="/boot\n/home\n/var"
992 dialog --backtitle "$VERSION - $SYSTEM ($ARCHI)" --title " $_PrepMntPart $PARTITON " --inputbox "$_ExtPartBody1$MNT_EXAMPLES\n" 0 0 "/" 2>${ANSWER} || prep_menu
993 MOUNT=$(cat ${ANSWER})
995 # loop while the mountpoint specified is incorrect (is only '/', is blank, or has spaces).
996 while [[ ${MOUNT:0:1} != "/" ]] || [[ ${#MOUNT} -le 1 ]] || [[ $MOUNT =~ \ |\' ]]; do
997 # Warn user about naming convention
998 dialog --backtitle "$VERSION - $SYSTEM ($ARCHI)" --title " $_ErrTitle " --msgbox "$_ExtErrBody" 0 0
999 # Ask user for mountpoint again
1000 dialog --backtitle "$VERSION - $SYSTEM ($ARCHI)" --title " $_PrepMntPart $PARTITON " --inputbox "$_ExtPartBody1$MNT_EXAMPLES\n" 0 0 "/" 2>${ANSWER} || prep_menu
1001 MOUNT=$(cat ${ANSWER})
1004 # Create directory and mount.
1005 mount_current_partition
1007 # Determine if a seperate /boot is used. 0 = no seperate boot, 1 = seperate non-lvm boot,
1008 # 2 = seperate lvm boot. For Grub configuration
1009 if [[ $MOUNT == "/boot" ]]; then
1010 [[ $(lsblk -lno TYPE ${PARTITION} | grep "lvm") != "" ]] && LVM_SEP_BOOT=2 || LVM_SEP_BOOT=1
1017 ######################################################################
1019 ## Encryption (dm_crypt) Functions ##
1021 ######################################################################
1023 # Had to write it in this way due to (bash?) bug(?), as if/then statements in a single
1024 # "create LUKS" function for default and "advanced" modes were interpreted as commands,
1025 # not mere string statements. Not happy with it, but it works...
1027 # Save repetition of code.
1030 dialog --backtitle "$VERSION - $SYSTEM ($ARCHI)" --title " $_PrepLUKS " --clear --insecure --passwordbox "$_LuksPassBody" 0 0 2> ${ANSWER} || prep_menu
1031 PASSWD=$(cat ${ANSWER})
1033 dialog --backtitle "$VERSION - $SYSTEM ($ARCHI)" --title " $_PrepLUKS " --clear --insecure --passwordbox "$_PassReEntBody" 0 0 2> ${ANSWER} || prep_menu
1034 PASSWD2=$(cat ${ANSWER})
1036 if [[ $PASSWD != $PASSWD2 ]]; then
1037 dialog --backtitle "$VERSION - $SYSTEM ($ARCHI)" --title " $_ErrTitle " --msgbox "$_PassErrBody" 0 0
1046 INCLUDE_PART='part\|crypt\|lvm'
1050 # Select encrypted partition to open
1051 dialog --backtitle "$VERSION - $SYSTEM ($ARCHI)" --title " $_LuksOpen " --menu "$_LuksMenuBody" 0 0 7 ${PARTITIONS} 2>${ANSWER} || luks_menu
1052 PARTITION=$(cat ${ANSWER})
1054 # Enter name of the Luks partition and get password to open it
1055 dialog --backtitle "$VERSION - $SYSTEM ($ARCHI)" --title " $_LuksOpen " --inputbox "$_LuksOpenBody" 10 50 "cryptroot" 2>${ANSWER} || luks_menu
1056 LUKS_ROOT_NAME=$(cat ${ANSWER})
1059 # Try to open the luks partition with the credentials given. If successful show this, otherwise
1061 dialog --backtitle "$VERSION - $SYSTEM ($ARCHI)" --title " $_LuksOpen " --infobox "$_PlsWaitBody" 0 0
1062 echo $PASSWD | cryptsetup open --type luks ${PARTITION} ${LUKS_ROOT_NAME} 2>/tmp/.errlog
1065 lsblk -o NAME,TYPE,FSTYPE,SIZE,MOUNTPOINT ${PARTITION} | grep "crypt\|NAME\|MODEL\|TYPE\|FSTYPE\|SIZE" > /tmp/.devlist
1066 dialog --backtitle "$VERSION - $SYSTEM ($ARCHI)" --title " $_DevShowOpt " --textbox /tmp/.devlist 0 0
1073 modprobe -a dm-mod dm_crypt
1074 INCLUDE_PART='part\|lvm'
1078 # Select partition to encrypt
1079 dialog --backtitle "$VERSION - $SYSTEM ($ARCHI)" --title " $_LuksEncrypt " --menu "$_LuksCreateBody" 0 0 7 ${PARTITIONS} 2>${ANSWER} || luks_menu
1080 PARTITION=$(cat ${ANSWER})
1082 # Enter name of the Luks partition and get password to create it
1083 dialog --backtitle "$VERSION - $SYSTEM ($ARCHI)" --title " $_LuksEncrypt " --inputbox "$_LuksOpenBody" 10 50 "cryptroot" 2>${ANSWER} || luks_menu
1084 LUKS_ROOT_NAME=$(cat ${ANSWER})
1090 # Encrypt selected partition or LV with credentials given
1091 dialog --backtitle "$VERSION - $SYSTEM ($ARCHI)" --title " $_LuksEncrypt " --infobox "$_PlsWaitBody" 0 0
1093 echo $PASSWD | cryptsetup -q luksFormat ${PARTITION} 2>/tmp/.errlog
1095 # Now open the encrypted partition or LV
1096 echo $PASSWD | cryptsetup open ${PARTITION} ${LUKS_ROOT_NAME} 2>/tmp/.errlog
1102 dialog --backtitle "$VERSION - $SYSTEM ($ARCHI)" --title " $_PrepLUKS " --inputbox "$_LuksCipherKey" 0 0 "-s 512 -c aes-xts-plain64" 2>${ANSWER} || luks_menu
1104 # Encrypt selected partition or LV with credentials given
1105 dialog --backtitle "$VERSION - $SYSTEM ($ARCHI)" --title " $_LuksEncryptAdv " --infobox "$_PlsWaitBody" 0 0
1108 echo $PASSWD | cryptsetup -q $(cat ${ANSWER}) luksFormat ${PARTITION} 2>/tmp/.errlog
1111 # Now open the encrypted partition or LV
1112 echo $PASSWD | cryptsetup open ${PARTITION} ${LUKS_ROOT_NAME} 2>/tmp/.errlog
1119 echo -e ${_LuksEncruptSucc} > /tmp/.devlist
1120 lsblk -o NAME,TYPE,FSTYPE,SIZE ${PARTITION} | grep "part\|crypt\|NAME\|TYPE\|FSTYPE\|SIZE" >> /tmp/.devlist
1121 dialog --backtitle "$VERSION - $SYSTEM ($ARCHI)" --title " $_LuksEncrypt " --textbox /tmp/.devlist 0 0
1130 dialog --backtitle "$VERSION - $SYSTEM ($ARCHI)" --title " $_PrepLUKS " --menu "$_LuksMenuBody$_LuksMenuBody2$_LuksMenuBody3" 0 0 4 \
1131 "$_LuksOpen" "cryptsetup open --type luks" \
1132 "$_LuksEncrypt" "cryptsetup -q luksFormat" \
1133 "$_LuksEncryptAdv" "cryptsetup -q -s -c luksFormat" \
1134 "$_Back" "-" 2>${ANSWER}
1136 case $(cat ${ANSWER}) in
1137 "$_LuksOpen") luks_open ;;
1138 "$_LuksEncrypt") luks_setup
1141 "$_LuksEncryptAdv") luks_setup
1152 ######################################################################
1154 ## Logical Volume Management Functions ##
1156 ######################################################################
1161 LVM_PV=$(pvs -o pv_name --noheading 2>/dev/null)
1162 LVM_VG=$(vgs -o vg_name --noheading 2>/dev/null)
1163 LVM_LV=$(lvs -o vg_name,lv_name --noheading --separator - 2>/dev/null)
1165 if [[ $LVM_LV != "" ]] && [[ $LVM_VG != "" ]] && [[ $LVM_PV != "" ]]; then
1166 dialog --backtitle "$VERSION - $SYSTEM ($ARCHI)" --title " $_PrepLVM " --infobox "$_LvmDetBody" 0 0
1167 modprobe dm-mod 2>/tmp/.errlog
1169 vgscan >/dev/null 2>&1
1170 vgchange -ay >/dev/null 2>&1
1177 vg_list=$(lvs --noheadings | awk '{print $2}' | uniq)
1179 for i in ${vg_list}; do
1180 VG_LIST="${VG_LIST} ${i} $(vgdisplay ${i} | grep -i "vg size" | awk '{print $3$4}')"
1183 # If no VGs, no point in continuing
1184 if [[ $VG_LIST == "" ]]; then
1185 dialog --backtitle "$VERSION - $SYSTEM ($ARCHI)" --title " $_ErrTitle " --msgbox "$_LvmVGErr" 0 0
1190 dialog --backtitle "$VERSION - $SYSTEM ($ARCHI)" --title " $_PrepLVM " --menu "$_LvmSelVGBody" 0 0 5 \
1191 ${VG_LIST} 2>${ANSWER} || lvm_menu
1194 # Create Volume Group and Logical Volumes
1197 # subroutine to save a lot of repetition.
1203 # Check to see if anything was actually entered and if first character is '0'
1204 ([[ ${#LVM_LV_SIZE} -eq 0 ]] || [[ ${LVM_LV_SIZE:0:1} -eq "0" ]]) && LV_SIZE_INVALID=1
1206 # If not invalid so far, check for non numberic characters other than the last character
1207 if [[ $LV_SIZE_INVALID -eq 0 ]]; then
1208 while [[ $chars -lt $(( ${#LVM_LV_SIZE} - 1 )) ]]; do
1209 [[ ${LVM_LV_SIZE:chars:1} != [0-9] ]] && LV_SIZE_INVALID=1 && break;
1210 chars=$(( chars + 1 ))
1214 # If not invalid so far, check that last character is a M/m or G/g
1215 if [[ $LV_SIZE_INVALID -eq 0 ]]; then
1216 LV_SIZE_TYPE=$(echo ${LVM_LV_SIZE:$(( ${#LVM_LV_SIZE} - 1 )):1})
1218 case $LV_SIZE_TYPE in
1219 "m"|"M"|"g"|"G") LV_SIZE_INVALID=0 ;;
1220 *) LV_SIZE_INVALID=1 ;;
1225 # If not invalid so far, check whether the value is greater than or equal to the LV remaining Size.
1226 # If not, convert into MB for VG space remaining.
1227 if [[ ${LV_SIZE_INVALID} -eq 0 ]]; then
1229 case ${LV_SIZE_TYPE} in
1230 "G"|"g") if [[ $(( $(echo ${LVM_LV_SIZE:0:$(( ${#LVM_LV_SIZE} - 1 ))}) * 1000 )) -ge ${LVM_VG_MB} ]]; then
1233 LVM_VG_MB=$(( LVM_VG_MB - $(( $(echo ${LVM_LV_SIZE:0:$(( ${#LVM_LV_SIZE} - 1 ))}) * 1000 )) ))
1236 "M"|"m") if [[ $(echo ${LVM_LV_SIZE:0:$(( ${#LVM_LV_SIZE} - 1 ))}) -ge ${LVM_VG_MB} ]]; then
1239 LVM_VG_MB=$(( LVM_VG_MB - $(echo ${LVM_LV_SIZE:0:$(( ${#LVM_LV_SIZE} - 1 ))}) ))
1242 *) LV_SIZE_INVALID=1
1251 # LVM Create Starts Here #
1259 # Find LVM appropriate partitions.
1260 INCLUDE_PART='part\|crypt'
1263 # Amend partition(s) found for use in check list
1264 PARTITIONS=$(echo $PARTITIONS | sed 's/M\|G\|T/& off/g')
1266 # Name the Volume Group
1267 dialog --backtitle "$VERSION - $SYSTEM ($ARCHI)" --title " $_LvmCreateVG " --inputbox "$_LvmNameVgBody" 0 0 "" 2>${ANSWER} || prep_menu
1268 LVM_VG=$(cat ${ANSWER})
1270 # Loop while the Volume Group name starts with a "/", is blank, has spaces, or is already being used
1271 while [[ ${LVM_VG:0:1} == "/" ]] || [[ ${#LVM_VG} -eq 0 ]] || [[ $LVM_VG =~ \ |\' ]] || [[ $(lsblk | grep ${LVM_VG}) != "" ]]; do
1272 dialog --backtitle "$VERSION - $SYSTEM ($ARCHI)" --title "$_ErrTitle" --msgbox "$_LvmNameVgErr" 0 0
1274 dialog --backtitle "$VERSION - $SYSTEM ($ARCHI)" --title " $_LvmCreateVG " --inputbox "$_LvmNameVgBody" 0 0 "" 2>${ANSWER} || prep_menu
1275 LVM_VG=$(cat ${ANSWER})
1278 # Select the partition(s) for the Volume Group
1279 dialog --backtitle "$VERSION - $SYSTEM ($ARCHI)" --title " $_LvmCreateVG " --checklist "$_LvmPvSelBody $_UseSpaceBar" 0 0 7 ${PARTITIONS} 2>${ANSWER} || prep_menu
1280 [[ $(cat ${ANSWER}) != "" ]] && VG_PARTS=$(cat ${ANSWER}) || prep_menu
1282 # Once all the partitions have been selected, show user. On confirmation, use it/them in 'vgcreate' command.
1283 # Also determine the size of the VG, to use for creating LVs for it.
1284 dialog --backtitle "$VERSION - $SYSTEM ($ARCHI)" --title " $_LvmCreateVG " --yesno "$_LvmPvConfBody1${LVM_VG} $_LvmPvConfBody2${VG_PARTS}" 0 0
1286 if [[ $? -eq 0 ]]; then
1287 dialog --backtitle "$VERSION - $SYSTEM ($ARCHI)" --title " $_LvmCreateVG " --infobox "$_LvmPvActBody1${LVM_VG}.$_PlsWaitBody" 0 0
1289 vgcreate -f ${LVM_VG} ${VG_PARTS} >/dev/null 2>/tmp/.errlog
1292 # Once created, get size and size type for display and later number-crunching for lv creation
1293 VG_SIZE=$(vgdisplay $LVM_VG | grep 'VG Size' | awk '{print $3}' | sed 's/\..*//')
1294 VG_SIZE_TYPE=$(vgdisplay $LVM_VG | grep 'VG Size' | awk '{print $4}')
1296 # Convert the VG size into GB and MB. These variables are used to keep tabs on space available and remaining
1297 [[ ${VG_SIZE_TYPE:0:1} == "G" ]] && LVM_VG_MB=$(( VG_SIZE * 1000 )) || LVM_VG_MB=$VG_SIZE
1299 dialog --backtitle "$VERSION - $SYSTEM ($ARCHI)" --title " $_LvmCreateVG " --msgbox "$_LvmPvDoneBody1 '${LVM_VG}' $_LvmPvDoneBody2 (${VG_SIZE} ${VG_SIZE_TYPE}).\n\n" 0 0
1305 # Once VG created, create Logical Volumes
1308 # Specify number of Logical volumes to create.
1309 dialog --backtitle "$VERSION - $SYSTEM ($ARCHI)" --title " $_LvmCreateVG " --radiolist "$_LvmLvNumBody1 ${LVM_VG}. $_LvmLvNumBody2" 0 0 9 \
1310 "1" "-" off "2" "-" off "3" "-" off "4" "-" off "5" "-" off "6" "-" off "7" "-" off "8" "-" off "9 " "-" off 2>${ANSWER}
1312 [[ $(cat ${ANSWER}) == "" ]] && lvm_menu || NUMBER_LOGICAL_VOLUMES=$(cat ${ANSWER})
1314 # Loop while the number of LVs is greater than 1. This is because the size of the last LV is automatic.
1315 while [[ $NUMBER_LOGICAL_VOLUMES -gt 1 ]]; do
1316 dialog --backtitle "$VERSION - $SYSTEM ($ARCHI)" --title " $_LvmCreateVG (LV:$NUMBER_LOGICAL_VOLUMES) " --inputbox "$_LvmLvNameBody1" 0 0 "lvol" 2>${ANSWER} || prep_menu
1317 LVM_LV_NAME=$(cat ${ANSWER})
1319 # Loop if preceeded with a "/", if nothing is entered, if there is a space, or if that name already exists.
1320 while [[ ${LVM_LV_NAME:0:1} == "/" ]] || [[ ${#LVM_LV_NAME} -eq 0 ]] || [[ ${LVM_LV_NAME} =~ \ |\' ]] || [[ $(lsblk | grep ${LVM_LV_NAME}) != "" ]]; do
1321 dialog --backtitle "$VERSION - $SYSTEM ($ARCHI)" --title " $_ErrTitle " --msgbox "$_LvmLvNameErrBody" 0 0
1322 dialog --backtitle "$VERSION - $SYSTEM ($ARCHI)" --title " $_LvmCreateVG (LV:$NUMBER_LOGICAL_VOLUMES) " --inputbox "$_LvmLvNameBody1" 0 0 "lvol" 2>${ANSWER} || prep_menu
1323 LVM_LV_NAME=$(cat ${ANSWER})
1326 dialog --backtitle "$VERSION - $SYSTEM ($ARCHI)" --title " $_LvmCreateVG (LV:$NUMBER_LOGICAL_VOLUMES) " --inputbox "\n${LVM_VG}: ${VG_SIZE}${VG_SIZE_TYPE} (${LVM_VG_MB}MB $_LvmLvSizeBody1).$_LvmLvSizeBody2" 0 0 "" 2>${ANSWER} || prep_menu
1327 LVM_LV_SIZE=$(cat ${ANSWER})
1330 # Loop while an invalid value is entered.
1331 while [[ $LV_SIZE_INVALID -eq 1 ]]; do
1332 dialog --backtitle "$VERSION - $SYSTEM ($ARCHI)" --title " $_ErrTitle " --msgbox "$_LvmLvSizeErrBody" 0 0
1333 dialog --backtitle "$VERSION - $SYSTEM ($ARCHI)" --title " $_LvmCreateVG (LV:$NUMBER_LOGICAL_VOLUMES) " --inputbox "\n${LVM_VG}: ${VG_SIZE}${VG_SIZE_TYPE} (${LVM_VG_MB}MB $_LvmLvSizeBody1).$_LvmLvSizeBody2" 0 0 "" 2>${ANSWER} || prep_menu
1334 LVM_LV_SIZE=$(cat ${ANSWER})
1339 lvcreate -L ${LVM_LV_SIZE} ${LVM_VG} -n ${LVM_LV_NAME} 2>/tmp/.errlog
1341 dialog --backtitle "$VERSION - $SYSTEM ($ARCHI)" --title " $_LvmCreateVG (LV:$NUMBER_LOGICAL_VOLUMES) " --msgbox "\n$_Done\n\nLV ${LVM_LV_NAME} (${LVM_LV_SIZE}) $_LvmPvDoneBody2.\n\n" 0 0
1342 NUMBER_LOGICAL_VOLUMES=$(( NUMBER_LOGICAL_VOLUMES - 1 ))
1345 # Now the final LV. Size is automatic.
1346 dialog --backtitle "$VERSION - $SYSTEM ($ARCHI)" --title " $_LvmCreateVG (LV:$NUMBER_LOGICAL_VOLUMES) " --inputbox "$_LvmLvNameBody1 $_LvmLvNameBody2 (${LVM_VG_MB}MB)." 0 0 "lvol" 2>${ANSWER} || prep_menu
1347 LVM_LV_NAME=$(cat ${ANSWER})
1349 # Loop if preceeded with a "/", if nothing is entered, if there is a space, or if that name already exists.
1350 while [[ ${LVM_LV_NAME:0:1} == "/" ]] || [[ ${#LVM_LV_NAME} -eq 0 ]] || [[ ${LVM_LV_NAME} =~ \ |\' ]] || [[ $(lsblk | grep ${LVM_LV_NAME}) != "" ]]; do
1351 dialog --backtitle "$VERSION - $SYSTEM ($ARCHI)" --title " $_ErrTitle " --msgbox "$_LvmLvNameErrBody" 0 0
1352 dialog --backtitle "$VERSION - $SYSTEM ($ARCHI)" --title " $_LvmCreateVG (LV:$NUMBER_LOGICAL_VOLUMES) " --inputbox "$_LvmLvNameBody1 $_LvmLvNameBody2 (${LVM_VG_MB}MB)." 0 0 "lvol" 2>${ANSWER} || prep_menu
1353 LVM_LV_NAME=$(cat ${ANSWER})
1356 # Create the final LV
1357 lvcreate -l +100%FREE ${LVM_VG} -n ${LVM_LV_NAME} 2>/tmp/.errlog
1359 NUMBER_LOGICAL_VOLUMES=$(( NUMBER_LOGICAL_VOLUMES - 1 ))
1361 dialog --backtitle "$VERSION - $SYSTEM ($ARCHI)" --title " $_LvmCreateVG " --yesno "$_LvmCompBody" 0 0 \
1362 && show_devices || lvm_menu
1368 # Generate list of VGs for selection
1371 # Ask for confirmation
1372 dialog --backtitle "$VERSION - $SYSTEM ($ARCHI)" --title " $_LvmDelVG " --yesno "$_LvmDelQ" 0 0
1374 # if confirmation given, delete
1375 if [[ $? -eq 0 ]]; then
1376 vgremove -f $(cat ${ANSWER}) >/dev/null 2>&1
1384 LVM_PV=$(pvs -o pv_name --noheading 2>/dev/null)
1385 LVM_VG=$(vgs -o vg_name --noheading 2>/dev/null)
1386 LVM_LV=$(lvs -o vg_name,lv_name --noheading --separator - 2>/dev/null)
1388 # Ask for confirmation
1389 dialog --backtitle "$VERSION - $SYSTEM ($ARCHI)" --title " $_LvmDelLV " --yesno "$_LvmDelQ" 0 0
1391 # if confirmation given, delete
1392 if [[ $? -eq 0 ]]; then
1394 for i in ${LVM_LV}; do
1395 lvremove -f /dev/mapper/${i} >/dev/null 2>&1
1398 for i in ${LVM_VG}; do
1399 vgremove -f ${i} >/dev/null 2>&1
1402 for i in ${LV_PV}; do
1403 pvremove -f ${i} >/dev/null 2>&1
1413 dialog --backtitle "$VERSION - $SYSTEM ($ARCHI)" --title " $_PrepLVM $_PrepLVM2 " --infobox "$_PlsWaitBody" 0 0
1417 dialog --backtitle "$VERSION - $SYSTEM ($ARCHI)" --title " $_PrepLVM $_PrepLVM2 " --menu "$_LvmMenu" 0 0 4 \
1418 "$_LvmCreateVG" "vgcreate -f, lvcreate -L -n" \
1419 "$_LvmDelVG" "vgremove -f" \
1420 "$_LvMDelAll" "lvrmeove, vgremove, pvremove -f" \
1421 "$_Back" "-" 2>${ANSWER}
1423 case $(cat ${ANSWER}) in
1424 "$_LvmCreateVG") lvm_create ;;
1425 "$_LvmDelVG") lvm_del_vg ;;
1426 "$_LvMDelAll") lvm_del_all ;;
1433 ######################################################################
1435 ## Installation Functions ##
1437 ######################################################################
1443 # Change installation method depending on use of img or sfs
1444 if [[ -e /run/archiso/sfs/airootfs/airootfs.img ]]; then
1445 AIROOTIMG="/run/archiso/sfs/airootfs/airootfs.img"
1446 mkdir -p ${BYPASS} 2>/tmp/.errlog
1447 mount ${AIROOTIMG} ${BYPASS} 2>>/tmp/.errlog
1448 rsync -a --progress ${BYPASS} ${MOUNTPOINT}/ 2>>/tmp/.errlog
1451 AIROOTIMG="/run/archiso/sfs/airootfs/"
1452 rsync -a --progress ${AIROOTIMG} ${MOUNTPOINT}/ 2>/tmp/.errlog
1457 # Keyboard config for vc and x11
1458 [[ -e /tmp/vconsole.conf ]] && cp /tmp/vconsole.conf ${MOUNTPOINT}/etc/vconsole.conf 2>>/tmp/.errlog
1459 [[ -e /tmp/01-keyboard-layout.conf ]] && cp -f /tmp/01-keyboard-layout.conf ${MOUNTPOINT}/etc/X11/xorg.conf.d/$(ls ${MOUNTPOINT}/etc/X11/xorg.conf.d/ | grep "keyboard") 2>>/tmp/.errlog
1461 # set up kernel for mkiniticpio
1462 cp /run/archiso/bootmnt/arch/boot/${ARCHI}/vmlinuz ${MOUNTPOINT}/boot/vmlinuz-linux 2>>/tmp/.errlog
1464 # copy over new mirrorlist
1465 cp /etc/pacman.d/mirrorlist ${MOUNTPOINT}/etc/pacman.d/mirrorlist 2>>/tmp/.errlog
1467 # Clean up installation
1468 [[ -d ${MOUNTPOINT}${TRANS_SRC} ]] && rm -R ${MOUNTPOINT}${TRANS_SRC}>>/tmp/.errlog
1469 rm -rf ${MOUNTPOINT}/vomi 2>>/tmp/.errlog
1470 rm -rf ${BYPASS} 2>>/tmp/.errlog
1471 rm -rf ${MOUNTPOINT}/source 2>>/tmp/.errlog
1472 rm -rf ${MOUNTPOINT}/src 2>>/tmp/.errlog
1473 rmdir ${MOUNTPOINT}/bypass 2>>/tmp/.errlog
1474 rmdir ${MOUNTPOINT}/src 2>>/tmp/.errlog
1475 rmdir ${MOUNTPOINT}/source 2>>/tmp/.errlog
1476 rm -f ${MOUNTPOINT}/etc/sudoers.d/g_wheel 2>>/tmp/.errlog
1477 rm -f ${MOUNTPOINT}/var/lib/NetworkManager/NetworkManager.state 2>>/tmp/.errlog
1478 rm -f ${MOUNTPOINT}/update-pbif 2>>/tmp/.errlog
1479 sed -i 's/.*pam_wheel\.so/#&/' ${MOUNTPOINT}/etc/pam.d/su 2>>/tmp/.errlog
1481 # clean out archiso files from install
1482 find ${MOUNTPOINT}/usr/lib/initcpio -name archiso* -type f -exec rm '{}' \;
1485 rm -R ${MOUNTPOINT}/etc/systemd/system/getty@tty1.service.d 2>>/tmp/.errlog
1486 rm ${MOUNTPOINT}/etc/systemd/system/default.target 2>>/tmp/.errlog
1489 sed -i 's/volatile/auto/g' ${MOUNTPOINT}/etc/systemd/journald.conf 2>>/tmp/.errlog
1491 # Stop pacman complaining
1492 arch_chroot "mkdir -p /var/lib/pacman/sync" 2>>/tmp/.errlog
1493 arch_chroot "touch /var/lib/pacman/sync/{core.db,extra.db,community.db}" 2>>/tmp/.errlog
1495 # Fix NetworkManager
1496 arch_chroot "systemctl enable NetworkManager -f" 2>>/tmp/.errlog
1498 # Keyboard config for vc and x11
1499 [[ -e /tmp/vconsole.conf ]] && cp /tmp/vconsole.conf ${MOUNTPOINT}/etc/vconsole.conf 2>>/tmp/.errlog
1500 [[ -e /tmp/01-keyboard-layout.conf ]] && cp -f /tmp/01-keyboard-layout.conf ${MOUNTPOINT}/etc/X11/xorg.conf.d/$(ls ${MOUNTPOINT}/etc/X11/xorg.conf.d/ | grep "keyboard") 2>>/tmp/.errlog
1503 arch_chroot "systemctl enable lxdm" 2>>/tmp/.errlog
1505 # Copy our predefined lxdm.conf
1506 cp -f /inst/lxdm.conf ${MOUNTPOINT}/etc/lxdm/lxdm.conf 2>>/tmp/.errlog
1508 # Clean install files
1509 [[ -d ${MOUNTPOINT}/inst ]] && rm -R ${MOUNTPOINT}/inst &> /dev/null 2>>/tmp/.errlog
1514 [[ $(lspci | grep -i "vga" | sed 's/.*://' | sed 's/(.*//' | sed 's/^[ \t]*//' | grep -i "virtualbox") != "" ]] && arch_chroot "systemctl enable vboxservice"
1518 # Install Bootloader
1519 install_bootloader() {
1523 dialog --backtitle "$VERSION - $SYSTEM ($ARCHI)" --title "$_InstBiosBtTitle" --menu "$_InstBiosBtBody" 0 0 3 \
1524 "grub" "-" "syslinux [MBR]" "-" "syslinux [/]" "-" 2>${ANSWER}
1526 if [[ $(cat ${ANSWER}) == "grub" ]];then
1528 dialog --backtitle "$VERSION - $SYSTEM ($ARCHI)" --title " Grub-install " --infobox "$_PlsWaitBody" 0 0
1529 arch_chroot "grub-install --target=i386-pc --recheck $DEVICE" 2>/tmp/.errlog
1532 arch_chroot "grub-mkconfig -o /boot/grub/grub.cfg" 2>/tmp/.errlog
1535 # if /boot is LVM (whether using a seperate /boot mount or not), amend grub
1536 if ( [[ $LVM -eq 1 ]] && [[ $LVM_SEP_BOOT -eq 0 ]] ) || [[ $LVM_SEP_BOOT -eq 2 ]]; then
1537 sed -i "s/GRUB_PRELOAD_MODULES=\"\"/GRUB_PRELOAD_MODULES=\"lvm\"/g" ${MOUNTPOINT}/etc/default/grub
1540 # If encryption used amend grub
1541 [[ $LUKS_DEV != "" ]] && sed -i "s~GRUB_CMDLINE_LINUX=.*~GRUB_CMDLINE_LINUX=\"$LUKS_DEV\"~g" ${MOUNTPOINT}/etc/default/grub
1543 arch_chroot "grub-mkconfig -o /boot/grub/grub.cfg" 2>>/tmp/.errlog
1547 elif ([[ $(cat ${ANSWER}) == "syslinux [MBR]" ]] || [[ $(cat ${ANSWER}) == "syslinux [/]" ]]);then
1548 [[ $(cat ${ANSWER}) == "syslinux [MBR]" ]] && arch_chroot "syslinux-install_update -iam" 2>/tmp/.errlog
1549 [[ $(cat ${ANSWER}) == "syslinux [/]" ]] && arch_chroot "syslinux-install_update -i" 2>/tmp/.errlog
1552 # Amend configuration file. First remove all existing entries, then input new ones.
1553 sed -i '/^LABEL.*$/,$d' ${MOUNTPOINT}/boot/syslinux/syslinux.cfg
1555 # First the "main" entries
1556 [[ -e ${MOUNTPOINT}/boot/initramfs-linux.img ]] && echo -e "\n\nLABEL arch\n\tMENU LABEL $ISO_HOST Linux\n\tLINUX ../vmlinuz-linux\n\tAPPEND root=${ROOT_PART} rw\n\tINITRD ../initramfs-linux.img" >> ${MOUNTPOINT}/boot/syslinux/syslinux.cfg
1557 [[ -e ${MOUNTPOINT}/boot/initramfs-linux-lts.img ]] && echo -e "\n\nLABEL arch\n\tMENU LABEL $ISO_HOST Linux LTS\n\tLINUX ../vmlinuz-linux-lts\n\tAPPEND root=${ROOT_PART} rw\n\tINITRD ../initramfs-linux-lts.img" >> ${MOUNTPOINT}/boot/syslinux/syslinux.cfg
1558 [[ -e ${MOUNTPOINT}/boot/initramfs-linux-grsec.img ]] && echo -e "\n\nLABEL arch\n\tMENU LABEL $ISO_HOST Linux Grsec\n\tLINUX ../vmlinuz-linux-grsec\n\tAPPEND root=${ROOT_PART} rw\n\tINITRD ../initramfs-linux-grsec.img" >> ${MOUNTPOINT}/boot/syslinux/syslinux.cfg
1559 [[ -e ${MOUNTPOINT}/boot/initramfs-linux-zen.img ]] && echo -e "\n\nLABEL arch\n\tMENU LABEL $ISO_HOST Linux Zen\n\tLINUX ../vmlinuz-linux-zen\n\tAPPEND root=${ROOT_PART} rw\n\tINITRD ../initramfs-linux-zen.img" >> ${MOUNTPOINT}/boot/syslinux/syslinux.cfg
1561 # Second the "fallback" entries
1562 [[ -e ${MOUNTPOINT}/boot/initramfs-linux.img ]] && echo -e "\n\nLABEL arch\n\tMENU LABEL $ISO_HOST Linux Fallback\n\tLINUX ../vmlinuz-linux\n\tAPPEND root=${ROOT_PART} rw\n\tINITRD ../initramfs-linux-fallback.img" >> ${MOUNTPOINT}/boot/syslinux/syslinux.cfg
1563 [[ -e ${MOUNTPOINT}/boot/initramfs-linux-lts.img ]] && echo -e "\n\nLABEL arch\n\tMENU LABEL $ISO_HOST Linux Fallback LTS\n\tLINUX ../vmlinuz-linux-lts\n\tAPPEND root=${ROOT_PART} rw\n\tINITRD ../initramfs-linux-lts-fallback.img" >> ${MOUNTPOINT}/boot/syslinux/syslinux.cfg
1564 [[ -e ${MOUNTPOINT}/boot/initramfs-linux-grsec.img ]] && echo -e "\n\nLABEL arch\n\tMENU LABEL $ISO_HOST Linux Fallback Grsec\n\tLINUX ../vmlinuz-linux-grsec\n\tAPPEND root=${ROOT_PART} rw\n\tINITRD ../initramfs-linux-grsec-fallback.img" >> ${MOUNTPOINT}/boot/syslinux/syslinux.cfg
1565 [[ -e ${MOUNTPOINT}/boot/initramfs-linux-zen.img ]] && echo -e "\n\nLABEL arch\n\tMENU LABEL $ISO_HOST Linux Fallbacl Zen\n\tLINUX ../vmlinuz-linux-zen\n\tAPPEND root=${ROOT_PART} rw\n\tINITRD ../initramfs-linux-zen-fallback.img" >> ${MOUNTPOINT}/boot/syslinux/syslinux.cfg
1567 # Third, amend for LUKS
1568 [[ $LUKS_DEV != "" ]] && sed -i "s~rw~$LUKS_DEV rw~g" ${MOUNTPOINT}/boot/syslinux/syslinux.cfg
1570 # Finally, re-add the "default" entries
1571 echo -e "\n\nLABEL hdt\n\tMENU LABEL HDT (Hardware Detection Tool)\n\tCOM32 hdt.c32" >> ${MOUNTPOINT}/boot/syslinux/syslinux.cfg
1572 echo -e "\n\nLABEL reboot\n\tMENU LABEL Reboot\n\tCOM32 reboot.c32" >> ${MOUNTPOINT}/boot/syslinux/syslinux.cfg
1573 echo -e "\n\n#LABEL windows\n\t#MENU LABEL Windows\n\t#COM32 chain.c32\n\t#APPEND root=/dev/sda2 rw" >> ${MOUNTPOINT}/boot/syslinux/syslinux.cfg
1574 echo -e "\n\nLABEL poweroff\n\tMENU LABEL Poweroff\n\tCOM32 poweroff.c32" ${MOUNTPOINT}/boot/syslinux/syslinux.cfg
1576 BOOTLOADER="syslinux"
1583 #Ensure again that efivarfs is mounted
1584 [[ -z $(mount | grep /sys/firmware/efi/efivars) ]] && mount -t efivarfs efivarfs /sys/firmware/efi/efivars
1586 dialog --backtitle "$VERSION - $SYSTEM ($ARCHI)" --title " $_InstUefiBtTitle " --menu "$_InstUefiBtBody" 0 0 2 \
1587 "grub" "-" "systemd-boot" "/boot" 2>${ANSWER}
1589 if [[ $(cat ${ANSWER}) == "grub" ]];then
1591 dialog --backtitle "$VERSION - $SYSTEM ($ARCHI)" --title " Grub-install " --infobox "$_PlsWaitBody" 0 0
1592 arch_chroot "grub-install --target=x86_64-efi --efi-directory=${UEFI_MOUNT} --bootloader-id=arch_grub --recheck" 2>/tmp/.errlog
1594 # If encryption used amend grub
1595 [[ $LUKS_DEV != "" ]] && sed -i "s~GRUB_CMDLINE_LINUX=.*~GRUB_CMDLINE_LINUX=\"$LUKS_DEV\"~g" ${MOUNTPOINT}/etc/default/grub
1597 # Generate config file
1598 arch_chroot "grub-mkconfig -o /boot/grub/grub.cfg" 2>>/tmp/.errlog
1601 # Ask if user wishes to set Grub as the default bootloader and act accordingly
1602 dialog --backtitle "$VERSION - $SYSTEM ($ARCHI)" --title " $_InstUefiBtTitle " --yesno "$_SetBootDefBody ${UEFI_MOUNT}/EFI/boot $_SetBootDefBody2" 0 0
1604 if [[ $? -eq 0 ]]; then
1605 arch_chroot "mkdir ${UEFI_MOUNT}/EFI/boot" 2>/tmp/.errlog
1606 arch_chroot "cp -r ${UEFI_MOUNT}/EFI/arch_grub/grubx64.efi ${UEFI_MOUNT}/EFI/boot/bootx64.efi" 2>>/tmp/.errlog
1608 dialog --backtitle "$VERSION - $SYSTEM ($ARCHI)" --title " $_InstUefiBtTitle " --infobox "\nGrub $_SetDefDoneBody" 0 0
1614 elif [[ $(cat ${ANSWER}) == "systemd-boot" ]];then
1617 #arch_chroot "bootctl --path=${UEFI_MOUNT} install" 2>/tmp/.errlog
1618 bootctl --path=${MOUNTPOINT}${UEFI_MOUNT} install 2>/tmp/.errlog
1621 # Deal with LVM Root
1622 [[ $(echo $ROOT_PART | grep "/dev/mapper/") != "" ]] && bl_root=$ROOT_PART \
1623 || bl_root=$"PARTUUID="$(blkid -s PARTUUID ${ROOT_PART} | sed 's/.*=//g' | sed 's/"//g')
1625 # Create default config files. First the loader
1626 echo -e "default $ISO_HOST\ntimeout 10" > ${MOUNTPOINT}${UEFI_MOUNT}/loader/loader.conf 2>/tmp/.errlog
1628 # Second, the kernel conf files
1629 [[ -e ${MOUNTPOINT}/boot/initramfs-linux.img ]] && echo -e "title\t$ISO_HOST Linux\nlinux\t/vmlinuz-linux\ninitrd\t/initramfs-linux.img\noptions\troot=${bl_root} rw" > ${MOUNTPOINT}${UEFI_MOUNT}/loader/entries/$ISO_HOST.conf
1630 [[ -e ${MOUNTPOINT}/boot/initramfs-linux-lts.img ]] && echo -e "title\t$ISO_HOST Linux LTS\nlinux\t/vmlinuz-linux-lts\ninitrd\t/initramfs-linux-lts.img\noptions\troot=${bl_root} rw" > ${MOUNTPOINT}${UEFI_MOUNT}/loader/entries/$ISO_HOST-lts.conf
1631 [[ -e ${MOUNTPOINT}/boot/initramfs-linux-grsec.img ]] && echo -e "title\t$ISO_HOST Linux Grsec\nlinux\t/vmlinuz-linux-grsec\ninitrd\t/initramfs-linux-grsec.img\noptions\troot=${bl_root} rw" > ${MOUNTPOINT}${UEFI_MOUNT}/loader/entries/$ISO_HOST-grsec.conf
1632 [[ -e ${MOUNTPOINT}/boot/initramfs-linux-zen.img ]] && echo -e "title\t$ISO_HOST Linux Zen\nlinux\t/vmlinuz-linux-zen\ninitrd\t/initramfs-linux-zen.img\noptions\troot=${bl_root} rw" > ${MOUNTPOINT}${UEFI_MOUNT}/loader/entries/$ISO_HOST-zen.conf
1634 # Finally, amend kernel conf files for LUKS
1635 sysdconf=$(ls ${MOUNTPOINT}${UEFI_MOUNT}/loader/entries/$ISO_HOST*.conf)
1636 for i in ${sysdconf}; do
1637 [[ $LUKS_DEV != "" ]] && sed -i "s~rw~$LUKS_DEV rw~g" ${i}
1640 BOOTLOADER="systemd-boot"
1645 # Bootloader function begins here #
1648 # Set the default PATH variable
1649 arch_chroot "PATH=/usr/local/sbin:/usr/local/bin:/usr/bin:/usr/bin/core_perl" 2>/tmp/.errlog
1652 if [[ $SYSTEM == "BIOS" ]]; then
1659 ######################################################################
1661 ## Main Interfaces ##
1663 ######################################################################
1667 if [[ $SUB_MENU != "security_menu" ]]; then
1668 SUB_MENU="security_menu"
1671 if [[ $HIGHLIGHT_SUB != 4 ]]; then
1672 HIGHLIGHT_SUB=$(( HIGHLIGHT_SUB + 1 ))
1676 dialog --default-item ${HIGHLIGHT_SUB} --backtitle "$VERSION - $SYSTEM ($ARCHI)" --title " $_SecMenuTitle " --menu "$_SecMenuBody" 0 0 4 \
1677 "1" "$_SecJournTitle" \
1678 "2" "$_SecCoreTitle" \
1679 "3" "$_SecKernTitle" \
1680 "4" "$_Back" 2>${ANSWER}
1682 HIGHLIGHT_SUB=$(cat ${ANSWER})
1683 case $(cat ${ANSWER}) in
1684 "1") # systemd-journald
1685 dialog --backtitle "$VERSION - $SYSTEM ($ARCHI)" --title " $_SecJournTitle " --menu "$_SecJournBody" 0 0 7 \
1686 "$_Edit" "/etc/systemd/journald.conf" \
1687 "10M" "SystemMaxUse=10M" \
1688 "20M" "SystemMaxUse=20M" \
1689 "50M" "SystemMaxUse=50M" \
1690 "100M" "SystemMaxUse=100M" \
1691 "200M" "SystemMaxUse=200M" \
1692 "$_Disable" "Storage=none" 2>${ANSWER}
1694 if [[ $(cat ${ANSWER}) != "" ]]; then
1695 if [[ $(cat ${ANSWER}) == "$_Disable" ]]; then
1696 sed -i "s/#Storage.*\|Storage.*/Storage=none/g" ${MOUNTPOINT}/etc/systemd/journald.conf
1697 sed -i "s/SystemMaxUse.*/#&/g" ${MOUNTPOINT}/etc/systemd/journald.conf
1698 dialog --backtitle "$VERSION - $SYSTEM ($ARCHI)" --title " $_SecJournTitle " --infobox "\n$_Done!\n\n" 0 0
1700 elif [[ $(cat ${ANSWER}) == "$_Edit" ]]; then
1701 nano ${MOUNTPOINT}/etc/systemd/journald.conf
1703 sed -i "s/#SystemMaxUse.*\|SystemMaxUse.*/SystemMaxUse=$(cat ${ANSWER})/g" ${MOUNTPOINT}/etc/systemd/journald.conf
1704 sed -i "s/Storage.*/#&/g" ${MOUNTPOINT}/etc/systemd/journald.conf
1705 dialog --backtitle "$VERSION - $SYSTEM ($ARCHI)" --title " $_SecJournTitle " --infobox "\n$_Done!\n\n" 0 0
1711 dialog --backtitle "$VERSION - $SYSTEM ($ARCHI)" --title " $_SecCoreTitle " --menu "$_SecCoreBody" 0 0 2 \
1712 "$_Disable" "Storage=none" "$_Edit" "/etc/systemd/coredump.conf" 2>${ANSWER}
1714 if [[ $(cat ${ANSWER}) == "$_Disable" ]]; then
1715 sed -i "s/#Storage.*\|Storage.*/Storage=none/g" ${MOUNTPOINT}/etc/systemd/coredump.conf
1716 dialog --backtitle "$VERSION - $SYSTEM ($ARCHI)" --title " $_SecCoreTitle " --infobox "\n$_Done!\n\n" 0 0
1718 elif [[ $(cat ${ANSWER}) == "$_Edit" ]]; then
1719 nano ${MOUNTPOINT}/etc/systemd/coredump.conf
1722 "3") # Kernel log access
1723 dialog --backtitle "$VERSION - $SYSTEM ($ARCHI)" --title " $_SecKernTitle " --menu "\nKernel logs may contain information an attacker can use to identify and exploit kernel vulnerabilities, including sensitive memory addresses.\n\nIf systemd-journald logging has not been disabled, it is possible to create a rule in /etc/sysctl.d/ to disable access to these logs unless using root privilages (e.g. via sudo).\n" 0 0 2 \
1724 "$_Disable" "kernel.dmesg_restrict = 1" "$_Edit" "/etc/systemd/coredump.conf.d/custom.conf" 2>${ANSWER}
1726 case $(cat ${ANSWER}) in
1727 "$_Disable") echo "kernel.dmesg_restrict = 1" > ${MOUNTPOINT}/etc/sysctl.d/50-dmesg-restrict.conf
1728 dialog --backtitle "$VERSION - $SYSTEM ($ARCHI)" --title " $_SecKernTitle " --infobox "\n$_Done!\n\n" 0 0
1730 "$_Edit") [[ -e ${MOUNTPOINT}/etc/sysctl.d/50-dmesg-restrict.conf ]] && nano ${MOUNTPOINT}/etc/sysctl.d/50-dmesg-restrict.conf \
1731 || dialog --backtitle "$VERSION - $SYSTEM ($ARCHI)" --title " $_SeeConfErrTitle " --msgbox "$_SeeConfErrBody1" 0 0 ;;
1742 # Greet the user when first starting the installer
1745 dialog --backtitle "$VERSION - $SYSTEM ($ARCHI)" --title " $_WelTitle $VERSION " --msgbox "$_WelBody" 0 0
1752 if [[ $SUB_MENU != "prep_menu" ]]; then
1753 SUB_MENU="prep_menu"
1756 if [[ $HIGHLIGHT_SUB != 8 ]]; then
1757 HIGHLIGHT_SUB=$(( HIGHLIGHT_SUB + 1 ))
1761 dialog --default-item ${HIGHLIGHT_SUB} --backtitle "$VERSION - $SYSTEM ($ARCHI)" --title " $_PrepMenuTitle " --menu "$_PrepMenuBody" 0 0 8 \
1762 "1" "$_VCKeymapTitle" \
1763 "2" "$_PrepKBLayout" \
1764 "3" "$_DevShowOpt" \
1765 "4" "$_PrepPartDisk" \
1767 "6" "$_PrepLVM $_PrepLVM2" \
1768 "7" "$_PrepMntPart" \
1769 "8" "$_Back" 2>${ANSWER}
1771 HIGHLIGHT_SUB=$(cat ${ANSWER})
1772 case $(cat ${ANSWER}) in
1779 "4") umount_partitions
1787 "7") mount_partitions
1798 install_root_menu() {
1800 if [[ $SUB_MENU != "install_base_menu" ]]; then
1801 SUB_MENU="install_base_menu"
1804 if [[ $HIGHLIGHT_SUB != 4 ]]; then
1805 HIGHLIGHT_SUB=$(( HIGHLIGHT_SUB + 1 ))
1809 dialog --default-item ${HIGHLIGHT_SUB} --backtitle "$VERSION - $SYSTEM ($ARCHI)" --title "$_InstBsMenuTitle" --menu "$_InstBseMenuBody" 0 0 4 \
1811 "2" "$_MMRunMkinit" \
1812 "3" "$_InstBootldr" \
1813 "4" "$_Back" 2>${ANSWER}
1815 HIGHLIGHT_SUB=$(cat ${ANSWER})
1816 case $(cat ${ANSWER}) in
1821 "3") install_bootloader
1830 # Base Configuration
1831 config_base_menu() {
1833 # Set the default PATH variable
1834 arch_chroot "PATH=/usr/local/sbin:/usr/local/bin:/usr/bin:/usr/bin/core_perl" 2>/tmp/.errlog
1837 if [[ $SUB_MENU != "config_base_menu" ]]; then
1838 SUB_MENU="config_base_menu"
1841 if [[ $HIGHLIGHT_SUB != 8 ]]; then
1842 HIGHLIGHT_SUB=$(( HIGHLIGHT_SUB + 1 ))
1846 dialog --default-item ${HIGHLIGHT_SUB} --backtitle "$VERSION - $SYSTEM ($ARCHI)" --title " $_ConfBseMenuTitle " --menu "$_ConfBseBody" 0 0 8 \
1847 "1" "$_ConfBseFstab" \
1848 "2" "$_ConfBseHost" \
1849 "3" "$_ConfBseSysLoc" \
1850 "4" "$_ConfBseTimeHC" \
1851 "5" "$_ConfUsrRoot" \
1852 "6" "$_ConfUsrNew" \
1853 "7" "$_SecMenuTitle" \
1854 "8" "$_Back" 2>${ANSWER}
1856 HIGHLIGHT_SUB=$(cat ${ANSWER})
1857 case $(cat ${ANSWER}) in
1867 "5") set_root_password
1869 "6") create_new_user
1881 # Edit configs of installed system
1884 # Clear the file variables
1888 if [[ $SUB_MENU != "edit configs" ]]; then
1889 SUB_MENU="edit configs"
1892 if [[ $HIGHLIGHT_SUB != 12 ]]; then
1893 HIGHLIGHT_SUB=$(( HIGHLIGHT_SUB + 1 ))
1897 dialog --default-item ${HIGHLIGHT_SUB} --backtitle "$VERSION - $SYSTEM ($ARCHI)" --title " $_SeeConfOptTitle " --menu "$_SeeConfOptBody" 0 0 12 \
1898 "1" "/etc/vconsole.conf" \
1899 "2" "/etc/locale.conf" \
1900 "3" "/etc/hostname" \
1902 "5" "/etc/sudoers" \
1903 "6" "/etc/mkinitcpio.conf" \
1905 "8" "/etc/crypttab" \
1906 "9" "grub/syslinux/systemd-boot" \
1907 "10" "/etc/lxdm/lxdm.conf" \
1908 "11" "/etc/pacman.conf" \
1909 "12" "$_Back" 2>${ANSWER}
1911 HIGHLIGHT_SUB=$(cat ${ANSWER})
1912 case $(cat ${ANSWER}) in
1913 "1") [[ -e ${MOUNTPOINT}/etc/vconsole.conf ]] && FILE="${MOUNTPOINT}/etc/vconsole.conf"
1915 "2") [[ -e ${MOUNTPOINT}/etc/locale.conf ]] && FILE="${MOUNTPOINT}/etc/locale.conf"
1917 "3") [[ -e ${MOUNTPOINT}/etc/hostname ]] && FILE="${MOUNTPOINT}/etc/hostname"
1919 "4") [[ -e ${MOUNTPOINT}/etc/hosts ]] && FILE="${MOUNTPOINT}/etc/hosts"
1921 "5") [[ -e ${MOUNTPOINT}/etc/sudoers ]] && FILE="${MOUNTPOINT}/etc/sudoers"
1923 "6") [[ -e ${MOUNTPOINT}/etc/mkinitcpio.conf ]] && FILE="${MOUNTPOINT}/etc/mkinitcpio.conf"
1925 "7") [[ -e ${MOUNTPOINT}/etc/fstab ]] && FILE="${MOUNTPOINT}/etc/fstab"
1927 "8") [[ -e ${MOUNTPOINT}/etc/crypttab ]] && FILE="${MOUNTPOINT}/etc/crypttab"
1929 "9") [[ $BOOTLOADER == "grub" ]] && FILE="${MOUNTPOINT}/etc/default/grub"
1930 [[ $BOOTLOADER == "syslinux" ]] && FILE="${MOUNTPOINT}/boot/syslinux/syslinux.cfg"
1931 if [[ $BOOTLOADER == "systemd-boot" ]]; then
1932 FILE="${MOUNTPOINT}${UEFI_MOUNT}/loader/loader.conf"
1933 files=$(ls ${MOUNTPOINT}${UEFI_MOUNT}/loader/entries/*.conf)
1934 for i in ${files}; do
1939 "10") [[ -e ${MOUNTPOINT}/etc/lxdm/lxdm.conf ]] && FILE="${MOUNTPOINT}/etc/lxdm/lxdm.conf"
1941 "11") [[ -e ${MOUNTPOINT}/etc/pacman.conf ]] && FILE="${MOUNTPOINT}/etc/pacman.conf"
1947 [[ $FILE != "" ]] && ${TEXTEDITOR} $FILE \
1948 || dialog --backtitle "$VERSION - $SYSTEM ($ARCHI)" --title " $_ErrTitle " --msgbox "$_SeeConfErrBody" 0 0
1955 if [[ $HIGHLIGHT != 5 ]]; then
1956 HIGHLIGHT=$(( HIGHLIGHT + 1 ))
1959 dialog --default-item ${HIGHLIGHT} --backtitle "$VERSION - $SYSTEM ($ARCHI)" --title " $_MMTitle " \
1960 --menu "$_MMBody" 0 0 5 \
1961 "1" "$_PrepMenuTitle" \
1962 "2" "$_InstBsMenuTitle" \
1963 "3" "$_ConfBseMenuTitle" \
1964 "4" "$_SeeConfOptTitle" \
1965 "5" "$_Done" 2>${ANSWER}
1967 HIGHLIGHT=$(cat ${ANSWER})
1969 # Depending on the answer, first check whether partition(s) are mounted and whether base has been installed
1970 if [[ $(cat ${ANSWER}) -eq 2 ]]; then
1974 if [[ $(cat ${ANSWER}) -ge 3 ]] && [[ $(cat ${ANSWER}) -le 4 ]]; then
1979 case $(cat ${ANSWER}) in
1982 "2") install_root_menu
1984 "3") config_base_menu
1988 *) dialog --backtitle "$VERSION - $SYSTEM ($ARCHI)" --yesno "$_CloseInstBody" 0 0
1990 if [[ $? -eq 0 ]]; then
2005 ######################################################################
2009 ######################################################################