OSDN Git Service

Fix: wm/de count error
[pacbang-linux/installer-arch.git] / archlabs-installer
index 0382ca6..12574a1 100755 (executable)
@@ -5,12 +5,11 @@
 # Some ideas and code reworked from other resources
 # AIF, Cnichi, Calamares, Arch Wiki.. Credit where credit is due
 
-VER="2.0.49"     # installer version
+VER="2.0.53"     # installer version
 DIST="ArchLabs"  # linux distributor
 MNT="/mnt"       # install mountpoint
 ANS="/tmp/ans"   # dialog answer file
 
-
 # ------------------------------------------------------ #
 # When manually mounting your partitions, you need
 # to set these values to avoid using the mount menu.
@@ -60,7 +59,7 @@ LOGINRC=''        # login shell rc file, eg. .zprofile, .bash_profile, .profile
 
 INSTALL_WMS=''    # space separated list of chosen wm/de
 
-WM_PKGS=''        # full list of packages added during wm/de choice (not user edited)
+WM_PKGS=''        # list of packages added during wm/de choice (not user edited)
 PACKAGES=''       # list of all packages to install including WM_PKGS (not user edited)
 USER_PKGS=''      # packages selected by the user during install
 
@@ -121,16 +120,16 @@ export DIALOGOPTS="--cr-wrap"
 
 # giant ugly variable container :P {
 
-# RAM in the system in MB
+# system RAM in MB
 SYS_MEM="$(awk '/MemTotal/ {print int($2 / 1024) "M"}' /proc/meminfo)"
 
 # locales from /etc/locale.gen
 LOCALES="$(awk '/\.UTF-8/ {gsub(/# .*|#/, ""); if ($1) {print $1 " - "}}' /etc/locale.gen)"
 
-# linux console keyboard mappings
+# console keyboard mappings
 CMAPS="$(find /usr/share/kbd/keymaps -name '*.map.gz' | awk '{gsub(/\.map\.gz|.*\//, ""); print $1 " - "}' | sort)"
 
-# terminal size definitions
+# terminal size
 [[ $LINES ]] || LINES=$(tput lines)
 [[ $COLUMNS ]] || COLUMNS=$(tput cols)
 SHL=$((LINES - 20))
@@ -138,16 +137,16 @@ SHL=$((LINES - 20))
 # associative arrays
 # {
 
-# commands used to install each bootloader (most get modified during runtime) {
+# commands used to install each bootloader, however most get modified during runtime {
 declare -A BCMDS=(
-[refind-efi]='refind-install'
-[grub]='grub-install --recheck --force'
-[syslinux]='syslinux-install_update -i -a -m'
-[efistub]='efibootmgr -v -d /dev/sda -p 1 -c -l'
-[systemd-boot]='bootctl --path=/boot install'
+[refind-efi]='refind-install'                    # minor modification
+[grub]='grub-install --recheck --force'          # heavily modified
+[syslinux]='syslinux-install_update -i -a -m'    # modified on UEFI
+[efistub]='efibootmgr -v -d /dev/sda -p 1 -c -l' # heavily modified
+[systemd-boot]='bootctl --path=/boot install'    # not modified
 ) # }
 
-# executable name for each wm/de {
+# executable name for each wm/de used in ~/.xinitrc {
 declare -A WM_SESSIONS=(
 [dwm]='dwm'
 [i3-gaps]='i3'
@@ -163,20 +162,20 @@ declare -A WM_SESSIONS=(
 
 # packages installed for each wm/de, most are depends of the skel packages {
 declare -A WM_EXT=(
-[dwm]=''
-[gnome]=''
-[awesome]='awesome'
-[plasma]='kdebase-meta'
-[bspwm]=''
-[fluxbox]=''
-[i3-gaps]=''
-[openbox]=''
-[xfce4]='xfce4-goodies'
+[dwm]=''                                    # NA
+[gnome]=''                                  # NA
+[awesome]=''                                # NA
+[plasma]='kdebase-meta'                     # base plasma application set
+[bspwm]='archlabs-skel-bspwm'               # see deps of archlabs-skel-bspwm
+[fluxbox]='archlabs-skel-fluxbox'           # see deps of archlabs-skel-fluxbox
+[i3-gaps]='archlabs-skel-i3-gaps'           # see deps of archlabs-skel-i3-gaps
+[openbox]='archlabs-skel-openbox'           # see deps of archlabs-skel-openbox
+[xfce4]='archlabs-skel-xfce4 xfce4-goodies' # see deps of archlabs-skel-xfce4
 ) # }
 
-# files that can be edited after install is complete {
+# files offered for editing after install is complete {
 declare -A EDIT_FILES=(
-[login]=''
+[login]='' # login is populated once we know the username and shell
 [fstab]='/etc/fstab'
 [sudoers]='/etc/sudoers'
 [crypttab]='/etc/crypttab'
@@ -189,7 +188,7 @@ declare -A EDIT_FILES=(
 [keyboard]='/etc/X11/xorg.conf.d/00-keyboard.conf /etc/default/keyboard'
 ) # }
 
-# mkfs command for formatting each offered filesystem {
+# mkfs command and flags for filesystem formatting {
 declare -A FS_CMDS=(
 [f2fs]='mkfs.f2fs'
 [jfs]='mkfs.jfs -q'
@@ -203,12 +202,12 @@ declare -A FS_CMDS=(
 [reiserfs]='mkfs.reiserfs -q'
 ) # }
 
-# mount options for each offered filesystem (if any {
+# mount options for each filesystem {
 declare -A FS_OPTS=(
-[vfat]=''
-[ntfs]=''
-[ext2]=''
-[ext3]=''
+[vfat]=''  # NA
+[ntfs]=''  # NA
+[ext2]=''  # NA
+[ext3]=''  # NA
 [jfs]='discard errors=continue errors=panic nointegrity'
 [reiserfs]='acl nolog notail replayonly user_xattr off'
 [ext4]='discard dealloc nofail noacl relatime noatime nobarrier nodelalloc'
@@ -217,10 +216,15 @@ declare -A FS_OPTS=(
 [f2fs]='discard fastboot flush_merge data_flush inline_xattr inline_data noinline_data inline_dentry no_heap noacl nobarrier norecovery noextent_cache disable_roll_forward disable_ext_identify'
 ) # }
 
-# PKG_EXT: if you add a package to $PACKAGES in any dialog {
-#          and it uses/requires some additional packages,
-#          you can add them here to keep it simple: [package]="extra"
-#          duplicates are removed with `uniq` before install
+# packages installed for each login option {
+declare -A LOGIN_PKGS=(
+[xinit]='xorg-xinit'
+[lightdm]='lightdm lightdm-gtk-greeter lightdm-gtk-greeter-settings accountsservice'
+) # }
+
+# extras installed for user selected packages {
+# if a package requires additional packages that aren't already dependencies
+# they can be added here eg. [package]="extra"
 declare -A PKG_EXT=(
 [vlc]='qt4'
 [mpd]='mpc'
@@ -238,7 +242,7 @@ declare -A PKG_EXT=(
 
 # }
 
-# text variables
+# dialog text variables
 # {
 
 # Basics (somewhat in order)
@@ -263,6 +267,7 @@ _timez="\nThe time zone is used to set the system clock.\n\nSelect your country
 _timesubz="\nSelect the nearest city to you or one with the same time zone.\n\nTIP: Pressing the first letter of the city name repeatedly will navigate between entries beggining with that letter."
 _sessions="\nUse [Space] to toggle available sessions, use [Enter] to accept the selection and continue.\n\nA basic package set will be installed for compatibility and functionality."
 _login="\nSelect which of your session choices to use for the initial login.\n\nYou can be change this later by editing your ~/.xinitrc"
+_autologin="\nDo you want autologin enabled for USER?\n\nIf so the following two files will be created (disable autologin by removing them):\n\n - /home/USER/RC (run startx when logging in on tty1)\n - /etc/systemd/system/getty@tty1.service.d/autologin.conf (login USER without password)\n"
 _packages="\nUse [Space] to move a package into the selected area and press [Enter] to accept the selection.\n\nPackages may be installed by your DE/WM (if any), or for the packages you select."
 _edit="\nBefore exiting you can select configuration files to review/change.\n\nIf you need to make other changes with the drives still mounted, use Ctrl-z to pause the installer, when finished type 'fg' and [Enter] or Ctrl-z again to resume the installer, if you want to avoid the automatic reboot using Ctrl-c will cleanly exit."
 
@@ -299,8 +304,11 @@ _lvmerrlvsize="\nInvalid value Entered.\n\nMust be a numeric value with 'M' (meg
 
 ###############################################################################
 # selection menus
+# main is the entry point which calls functions including outside of its block
+# once those functions finished they always are returned here with the
+# exception of install_main(), it exits upon completion
 
-select_main()
+main()
 {
        (( SEL < 12 )) && (( SEL++ ))
        tput civis
@@ -325,7 +333,7 @@ select_main()
                2) part_menu || (( SEL-- )) ;;
                3) luks_menu || (( SEL-- )) ;;
                4) lvm_menu || (( SEL-- )) ;;
-               5) select_menu || (( SEL-- )) ;;
+               5) mount_menu || (( SEL-- )) ;;
                6) prechecks 0 && { select_boot || (( SEL-- )); } ;;
                7) prechecks 1 && { select_mkuser || (( SEL-- )); } ;;
                8) prechecks 2 && { select_config || (( SEL-- )); } ;;
@@ -359,6 +367,7 @@ select_show()
        local mnt="none"
        local cmd="${BCMDS[$BOOTLDR]}"
        local pkgs="${USER_PKGS//  / } ${PACKAGES//  / }"
+       local exmnt="${EXMNT:-none}"
        [[ $BOOT_PART ]] && mnt="/$BOOTDIR"
        [[ $INSTALL_WMS == *dwm* ]] && pkgs="dwm st dmenu $pkgs"
        pkgs="${pkgs//  / }"
@@ -368,17 +377,14 @@ select_show()
 
   Root:  ${ROOT_PART:-none}
   Boot:  ${BOOT_PART:-${BOOT_DEV:-none}}
-
   Swap:  ${SWAP_PART:-none}
   Size:  ${SWAP_SIZE:-none}
+  Extra: ${EXMNTS:-$exmnt}
+  Hooks: ${HOOKS:-none}
 
   LVM:   ${LVM:-none}
   LUKS:  ${LUKS:-none}
 
-  Extra: ${EXMNTS:-${EXMNT:-none}}
-  Hooks: ${HOOKS:-none}
-
-
 ---------- BOOTLOADER CONFIGURATION -----------
 
   Bootloader: ${BOOTLDR:-none}
@@ -396,23 +402,25 @@ select_show()
 
 ------------ USER CONFIGURATION --------------
 
-  User:         ${NEWUSER:-none}
-  Shell:        ${MYSHELL:-none}
-  Session:      ${LOGIN_WM:-none}
-  Autologin:    ${AUTOLOGIN:-none}
-  Login Method: ${LOGIN_TYPE:-none}
+  User:        ${NEWUSER:-none}
+  Shell:       ${MYSHELL:-none}
+  Session:     ${LOGIN_WM:-none}
+  Autologin:   ${AUTOLOGIN:-none}
+  DM or xinit: ${LOGIN_TYPE:-none}
 
 
 ------------ PACKAGES AND MIRRORS -------------
 
   Kernel:   ${KERNEL:-none}
   Sessions: ${INSTALL_WMS:-none}
-  Packages: $(print4 "${pkgs:-none}")
+  Packages: ${USER_PKGS//  / } ${PACKAGES//  / }
 "
 }
 
 select_login()
 {
+       [[ $INSTALL_WMS ]] || return 0
+
        if [[ -z $LOGIN_TYPE ]]; then
                dlg LOGIN_TYPE menu "Login Management" "\nSelect what kind of login management to use." \
                        "xinit"   "Console login without a display manager" \
@@ -421,22 +429,18 @@ select_login()
 
        if [[ $LOGIN_TYPE == 'lightdm' ]]; then
                AUTOLOGIN=''
-               LOGIN_PKGS="lightdm lightdm-gtk-greeter lightdm-gtk-greeter-settings accountsservice"
                EDIT_FILES[login]="/etc/lightdm/lightdm.conf /etc/lightdm/lightdm-gtk-greeter.conf"
        else
-               if (( WM_NUM == 1 )); then
-                       LOGIN_WM="${WM_SESSIONS[$INSTALL_WMS]}"
-               else
+               # define what wm/de to use for xinit
+               if (( $(wc -w <<< "$INSTALL_WMS") > 1 )); then
                        dlg LOGIN_WM menu "Login Management" "$_login" $LOGIN_CHOICES || return 1
                        LOGIN_WM="${WM_SESSIONS[$LOGIN_WM]}"
                fi
+               [[ -z $LOGIN_WM ]] && LOGIN_WM="${WM_SESSIONS[${INSTALL_WMS%% *}]}"
+
+               # autologin
+               yesno "Autologin" "$(sed "s|USER|$NEWUSER|g; s|RC|$LOGINRC|g" <<< "$_autologin")" && AUTOLOGIN=true || AUTOLOGIN=''
 
-               local txt="\nDo you want autologin enabled for $NEWUSER?\n\n"
-               txt+="If so the following two files will be created (disable autologin by removing them):\n\n"
-               txt+="- /home/$NEWUSER/$LOGINRC (run startx when logging in on tty1)\n"
-               txt+="- /etc/systemd/system/getty@tty1.service.d/autologin.conf (login $NEWUSER without password)\n"
-               yesno "Autologin" "$txt" && AUTOLOGIN=true || AUTOLOGIN=''
-               LOGIN_PKGS="xorg-xinit"
                EDIT_FILES[login]="/home/$NEWUSER/.xinitrc /home/$NEWUSER/.xprofile"
        fi
 }
@@ -448,12 +452,10 @@ select_config()
 
        until [[ $CONFIG_DONE ]]; do
                case $i in
-                       0)
-                               dlg MYSHELL menu "Shell" "\nChoose which shell to use." \
+                       0) dlg MYSHELL menu "Shell" "\nChoose which shell to use." \
                                        /usr/bin/zsh  'A very advanced and programmable command interpreter (shell) for UNIX' \
                                        /bin/bash     'The GNU Bourne Again shell, standard in many GNU/Linux distributions' \
                                        /usr/bin/mksh 'The MirBSD Korn Shell - an enhanced version of the public domain ksh' || return 1
-
                                ;;
                        1) dlg MYHOST input "Hostname" "$_hostname" "${DIST,,}" limit || { i=0; continue; } ;;
                        2) dlg MYLOCALE menu "Locale" "$_locale" $LOCALES || { i=1; continue; } ;;
@@ -464,13 +466,11 @@ select_config()
                                        yesno "Timezone" "\nConfirm time zone: $ZONE/$SUBZ\n" || unset ZONE
                                done
                                [[ $ZONE && $SUBZ ]] || { i=2; continue; } ;;
-                       4)
-                               dlg KERNEL menu "Kernel" "\nChoose which kernel to use." \
+                       4) dlg KERNEL menu "Kernel" "\nChoose which kernel to use." \
                                        linux          'Vanilla linux kernel and modules, with a few patches applied' \
                                        linux-lts      'Long-term support (LTS) linux kernel and modules' \
                                        linux-zen      'A effort of kernel hackers to provide the best kernel for everyday systems' \
                                        linux-hardened 'A security-focused linux kernel with hardening patches to mitigate exploits' || { i=3; continue; }
-
                                CONFIG_DONE=true
                                ;;
                esac
@@ -503,13 +503,7 @@ select_mkuser()
                        "Password2:" 9 1 ''   9 12 "$COLUMNS" 0 1 2>"$ANS" || return 1
 
                while read -r line; do
-                       case $i in
-                               0) u="$line" ;;
-                               1) p="$line" ;;
-                               2) p2="$line" ;;
-                               3) rp="$line" ;;
-                               4) rp2="$line" ;;
-                       esac
+                       case $i in 0) u="$line" ;; 1) p="$line" ;; 2) p2="$line" ;; 3) rp="$line" ;; 4) rp2="$line" ;; esac
                        (( i++ ))
                done < "$ANS"
 
@@ -587,13 +581,9 @@ select_sessions()
                gnome "A desktop environment that aims to be simple and easy to use" "$(ofn gnome "${INSTALL_WMS[*]}")" \
                cinnamon "A desktop environment combining traditional desktop with modern effects" "$(ofn cinnamon "${INSTALL_WMS[*]}")" \
                plasma "A kde software project currently comprising a full desktop environment" "$(ofn plasma "${INSTALL_WMS[*]}")" \
-               xfce4 "A lightweight and modular desktop environment based on gtk+2/3" "$(ofn xfce4 "${INSTALL_WMS[*]}")" || return 1
-
-       WM_NUM=0
-       while IFS=' ' read -r i; do
-               (( WM_NUM++ ))
-       done <<< "$INSTALL_WMS"
+               xfce4 "A lightweight and modular desktop environment based on gtk+2/3" "$(ofn xfce4 "${INSTALL_WMS[*]}")"
 
+       [[ $INSTALL_WMS ]] || return 0
 
        WM_PKGS="${INSTALL_WMS/dwm/}" # remove dwm from package list
        WM_PKGS="${WM_PKGS//  / }"    # remove double spaces
@@ -608,7 +598,6 @@ select_sessions()
        done
 
        select_login || return 1
-       [[ $WM_PKGS != *"$LOGIN_PKGS"* ]] && WM_PKGS+=" $LOGIN_PKGS"
 
        while IFS=' ' read -r pkg; do
                [[ $PACKAGES != *"$pkg"* ]] && PACKAGES+=" $pkg"
@@ -713,7 +702,9 @@ select_packages()
 }
 
 ###############################################################################
-# partition menus
+# partitioning menus
+# non-essential partitioning helpers called by the user when using the optional
+# partition menu and selecting a device to edit
 
 part_menu()
 {
@@ -724,7 +715,7 @@ part_menu()
        part_device || return 1
        device="$DEVICE"
 
-       while true; do
+       while :; do
                choice=""
                if [[ $DISPLAY && $TERM != 'linux' ]] && hash gparted >/dev/null 2>&1; then
                        dlg choice menu "Edit Partitions" "$_part" \
@@ -849,6 +840,74 @@ part_auto()
        msg "Auto Partition" "\nProcess complete.\n\n$(lsblk -o NAME,MODEL,SIZE,TYPE,FSTYPE "$device")\n"
 }
 
+part_shrink()
+{
+       part=""
+       typeset -i size num
+       local device="$1" fs=""
+
+       part_find "${device##*/}[^ ]" || return 1
+       (( COUNT == 1 )) && part="$(awk '{print $1}' <<< "${PARTS[@]}" )"
+       
+       if (( COUNT == 1 )) || dlg part menu "Resize" "\nWhich partition on $device do you want to resize?" $PARTS; then
+               fs=$(lsblk -lno FSTYPE "$part")
+               case "$fs" in
+                       ext*|ntfs)
+                               msg "Resize" "\nGathering device size info.\n" 0
+                               num="${part: -1}"
+                               end=$(parted -s "$device" unit KiB print | awk '/^\s*'"$num"'/ {print $3}')                    # part size in KiB
+                               devsize=$(parted -s "$device" unit KiB print | awk '/Disk '"${device//\//\\/}"':/ {print $3}') # whole device size in KiB
+                               mount "$part" $MNT >/dev/null 2>&1; sleep 0.5
+                               min=$(df --output=used --block-size=MiB "$part" | awk 'NR == 2 {print int($1) + 256}')
+                               max=$(df --output=avail --block-size=MiB "$part" | awk 'NR == 2 {print int($1)}')
+                               umount_dir $MNT
+                               tput cnorm
+                               if dialog --backtitle "$DIST Installer - $SYS - v$VER" --title " Resize: $part " --rangebox "$_resize" 17 "$COLUMNS" "$min" "$max" $((max / 2)) 2>$ANS; then
+                                       size=$(< "$ANS")
+                                       size=$((size * 1024))
+                               else
+                                       return 1
+                               fi
+                               clear
+                               case "$fs" in
+                                       ntfs)
+                                               if ntfsresize -fc "$part"; then
+                                                       ntfsresize -ff --size $(( (size * 1024) / 1000 ))k "$part" 2>$ERR # k=10^3 bytes
+                                                       errshow "ntfsresize -f -s $(( (size * 1024) / 1000 ))k $part" || return 1
+                                               else
+                                                       msg "Resize" "\nThe ntfs partition $part cannot be resized because it is scheduled for a consistency check.\n\nTo do a consistency check in windows open command prompt as admin and run:\n\n\tchkdsk /f /r /x\n"
+                                                       return 1
+                                               fi
+                                               ;;
+                                       *)
+                                               e2fsck -f "$part"; sleep 0.5
+                                               resize2fs -f "$part" ${size}K 2>$ERR # K=2^10 bytes
+                                               errshow "resize2fs -f $part ${size}K" || return 1
+                                               ;;
+                               esac
+                               sleep 0.5
+                               parted "$device" resizepart "$num" ${size}KiB || return 1
+                               (( size++ ))
+                               sleep 0.5
+                               if [[ $devsize == "$end" ]]; then
+                                       parted -s "$device" mkpart primary ext4 ${size}KiB 100% 2>$ERR
+                                       errshow "parted -s $device mkpart primary ext4 ${size}KiB 100%" || return 1
+                               else
+                                       parted -s "$device" mkpart primary ext4 ${size}KiB ${end}KiB 2>$ERR
+                                       errshow "parted -s $device mkpart primary ext4 ${size}KiB ${end}KiB" || return 1
+                               fi
+                               msg "Resize Complete" "\n$part has been successfully resized to $((size / 1024))M.\n" 1
+                               ;;
+                       "") msg "No Filesystem" "\nFor unformatted partitions, cfdisk can be used in the partition menu.\n" ;;
+                       *) msg "Invalid Filesystem: $fs" "\nResizing only supports ext and ntfs.\n" ;;
+               esac
+       fi
+}
+
+###############################################################################
+# partition management functions
+# these are helpers for use by other functions to do essential setup/teardown
+
 part_find()
 {
        local regexp="$1" err=''
@@ -918,70 +977,6 @@ part_format()
        sleep "${delay:-0}"
 }
 
-part_shrink()
-{
-       part=""
-       typeset -i size num
-       local device="$1" fs=""
-
-       part_find "${device##*/}[^ ]" || return 1
-       (( COUNT == 1 )) && part="$(awk '{print $1}' <<< "${PARTS[@]}" )"
-       
-       if (( COUNT == 1 )) || dlg part menu "Resize" "\nWhich partition on $device do you want to resize?" $PARTS; then
-               fs=$(lsblk -lno FSTYPE "$part")
-               case "$fs" in
-                       ext*|ntfs)
-                               msg "Resize" "\nGathering device size info.\n" 0
-                               num="${part: -1}"
-                               end=$(parted -s "$device" unit KiB print | awk '/^\s*'"$num"'/ {print $3}')                    # part size in KiB
-                               devsize=$(parted -s "$device" unit KiB print | awk '/Disk '"${device//\//\\/}"':/ {print $3}') # whole device size in KiB
-                               mount "$part" $MNT >/dev/null 2>&1; sleep 0.5
-                               min=$(df --output=used --block-size=MiB "$part" | awk 'NR == 2 {print int($1) + 256}')
-                               max=$(df --output=avail --block-size=MiB "$part" | awk 'NR == 2 {print int($1)}')
-                               umount_dir $MNT
-                               tput cnorm
-                               if dialog --backtitle "$DIST Installer - $SYS - v$VER" --title " Resize: $part " --rangebox "$_resize" 17 "$COLUMNS" "$min" "$max" $((max / 2)) 2>$ANS; then
-                                       size=$(< "$ANS")
-                                       size=$((size * 1024))
-                               else
-                                       return 1
-                               fi
-                               clear
-                               case "$fs" in
-                                       ntfs)
-                                               if ntfsresize -fc "$part"; then
-                                                       ntfsresize -ff --size $(( (size * 1024) / 1000 ))k "$part" 2>$ERR # k=10^3 bytes
-                                                       errshow "ntfsresize -f -s $(( (size * 1024) / 1000 ))k $part" || return 1
-                                               else
-                                                       msg "Resize" "\nThe ntfs partition $part cannot be resized because it is scheduled for a consistency check.\n\nTo do a consistency check in windows open command prompt as admin and run:\n\n\tchkdsk /f /r /x\n"
-                                                       return 1
-                                               fi
-                                               ;;
-                                       *)
-                                               e2fsck -f "$part"; sleep 0.5
-                                               resize2fs -f "$part" ${size}K 2>$ERR # K=2^10 bytes
-                                               errshow "resize2fs -f $part ${size}K" || return 1
-                                               ;;
-                               esac
-                               sleep 0.5
-                               parted "$device" resizepart "$num" ${size}KiB || return 1
-                               (( size++ ))
-                               sleep 0.5
-                               if [[ $devsize == "$end" ]]; then
-                                       parted -s "$device" mkpart primary ext4 ${size}KiB 100% 2>$ERR
-                                       errshow "parted -s $device mkpart primary ext4 ${size}KiB 100%" || return 1
-                               else
-                                       parted -s "$device" mkpart primary ext4 ${size}KiB ${end}KiB 2>$ERR
-                                       errshow "parted -s $device mkpart primary ext4 ${size}KiB ${end}KiB" || return 1
-                               fi
-                               msg "Resize Complete" "\n$part has been successfully resized to $((size / 1024))M.\n" 1
-                               ;;
-                       "") msg "No Filesystem" "\nFor unformatted partitions, cfdisk can be used in the partition menu.\n" ;;
-                       *) msg "Invalid Filesystem: $fs" "\nResizing only supports ext and ntfs.\n" ;;
-               esac
-       fi
-}
-
 part_device()
 {
        if [[ $DEV_COUNT -eq 1 && $SYS_DEVS ]]; then
@@ -994,7 +989,8 @@ part_device()
                fi
                [[ $DEVICE ]] || return 1
        elif [[ $DEV_COUNT -lt 1 && ! $1 ]]; then
-               msg "Device Error" "\nNo available devices.\n\nExiting..\n" 2; die 1
+               msg "Device Error" "\nNo available devices.\n\nExiting..\n" 2
+               die 1
        fi
 
        [[ $1 ]] && BOOT_DEV="$DEVICE"
@@ -1065,9 +1061,9 @@ part_cryptlv()
 
 part_countdec()
 {
-       for i in "$@"; do
+       for pt; do
                if (( COUNT > 0 )); then
-                       PARTS="$(sed "/${i//\//\\/}/d" <<< "$PARTS")"
+                       PARTS="$(sed "/${pt//\//\\/}/d" <<< "$PARTS")"
                        (( COUNT-- ))
                fi
        done
@@ -1087,9 +1083,12 @@ part_mountconf()
 
 ###############################################################################
 # mounting menus
+# mount_menu is the entry point which calls all other functions
+# once finished it returns to the main menu: main()
 
-select_menu()
+mount_menu()
 {
+       msg "Info" "\nGathering device info.\n" 0
        is_bg_install || return 0
        lvm_detect
        umount_dir $MNT
@@ -1113,7 +1112,7 @@ select_menu()
 
        select_swap || return 1
        select_extra_partitions || return 1
-       install_background || return 1
+       install_background
 
        return 0
 }
@@ -1200,13 +1199,26 @@ select_filesystem()
 
 select_efi_partition()
 {
-       if (( COUNT == 1 )); then
-               BOOT_PART="$(awk 'NF > 0 {print $1}' <<< "$PARTS")"
-       elif [[ $AUTO_BOOT_PART ]]; then
-               BOOT_PART="$AUTO_BOOT_PART"
-               return 0 # were done here
+       if [[ $AUTO_BOOT_PART ]]; then
+               msg "EFI Boot Partition" "\nUsing partition created during automatic format.\n" 1
+               BOOT_PART="$AUTO_BOOT_PART"; return 0 # were done here
        else
-               dlg BOOT_PART menu "EFI Partition" "$_uefi" $PARTS
+               local pts size dev isize bsize ptcount=0
+
+               # walk partition list and skip ones that are too small/big for boot
+               while read -r dev size; do
+                       size_t="${size: -1:1}"  # size type eg. K, M, G, T
+                       isize=${size:0:-1}      # remove trailing size type character
+                       isize=${isize%.*}       # remove any decimal (round down)
+                       [[ $size_t =~ [KT] || ($size_t == 'G' && $isize -gt 2) || ($size_t == 'M' && $isize -lt 100) ]] || { pts+="$dev $size "; (( ptcount++ )); }
+               done <<< "$PARTS"
+
+               if (( ptcount == 1 )); then
+                       msg "EFI Boot Partition" "\nOnly one partition available that meets size requirements.\n" 1
+                       BOOT_PART="$(awk 'NF > 0 {print $1}' <<< "$pts")"
+               else
+                       dlg BOOT_PART menu "EFI Partition" "$_uefi" $pts
+               fi
        fi
 
        [[ $BOOT_PART ]] || return 1
@@ -1226,13 +1238,26 @@ select_efi_partition()
 select_boot_partition()
 {
        if [[ $AUTO_BOOT_PART && ! $LVM ]]; then
+               msg "BIOS Boot Partition" "\nUsing partition created during automatic format.\n" 1
                BOOT_PART="$AUTO_BOOT_PART"; return 0 # were done here
-       elif [[ $LUKS && ! $LVM ]]; then
-               dlg BOOT_PART menu "Boot Partition" "$_biosluks" $PARTS
-               [[ $BOOT_PART ]] || return 1
        else
-               dlg BOOT_PART menu "Boot Partition" "$_bios" "skip" "don't use a separate boot" $PARTS
-               [[ -z $BOOT_PART || $BOOT_PART == "skip" ]] && { BOOT_PART=''; return 0; }
+               local pts size dev isize bsize ptcount=0
+
+               # walk partition list and skip ones that are too small/big for boot
+               while read -r dev size; do
+                       size_t="${size: -1:1}"  # size type eg. K, M, G, T
+                       isize=${size:0:-1}      # remove trailing size type character
+                       isize=${isize%.*}       # remove any decimal (round down)
+                       [[ $size_t =~ [KT] || ($size_t == 'G' && $isize -gt 2) || ($size_t == 'M' && $isize -lt 100) ]] || { pts+="$dev $size "; (( ptcount++ )); }
+               done <<< "$PARTS"
+
+               if [[ $LUKS && ! $LVM ]]; then
+                       dlg BOOT_PART menu "Boot Partition" "$_biosluks" $pts
+                       [[ $BOOT_PART ]] || return 1
+               else
+                       dlg BOOT_PART menu "Boot Partition" "$_bios" "skip" "don't use a separate boot" $pts
+                       [[ -z $BOOT_PART || $BOOT_PART == "skip" ]] && { BOOT_PART=''; return 0; }
+               fi
        fi
 
        if grep -q 'ext[34]' <<< "$(fsck -N "$BOOT_PART")"; then
@@ -1250,10 +1275,26 @@ select_root_partition()
 {
        if [[ $AUTO_ROOT_PART && -z $LVM && -z $LUKS ]]; then
                ROOT_PART="$AUTO_ROOT_PART"
-       elif (( COUNT == 1 )); then
-               ROOT_PART="$(awk 'NR==1 {print $1}' <<< "$PARTS")"
+               msg "Select Root Partition (/)" "\nUsing partition created during automatic format.\n" 1
+               part_mount "$ROOT_PART" || { ROOT_PART=''; return 1; }
+               return 0  # we're done here
        else
-               dlg ROOT_PART menu "Mount Root" "\nSelect the root (/) partition, this is where $DIST will be installed.\n\nDevices smaller than 8G will not be shown here." $PARTS
+               local pts size dev isize bsize ptcount=0
+
+               # walk partition list and skip ones that are too small for / (root)
+               while read -r dev size; do
+                       size_t="${size: -1:1}"  # size type eg. K, M, G, T
+                       isize=${size:0:-1}      # remove trailing size type character
+                       isize=${isize%.*}       # remove any decimal (round down)
+                       [[ $size_t =~ [MK] || ($size_t == 'G' && $isize -lt 4) ]] || { pts+="$dev $size "; (( ptcount++ )); }
+               done <<< "$PARTS"
+
+               if (( ptcount == 1 )); then  # only one available device
+                       msg "Select Root Partition (/)" "\nOnly one partition available that meets size requirements.\n" 1
+                       ROOT_PART="$(awk 'NR==1 {print $1}' <<< "$pts")"
+               else
+                       dlg ROOT_PART menu "Mount Root" "\nSelect the root (/) partition, this is where $DIST will be installed.\n\nDevices smaller than 8G will not be shown here." $pts
+               fi
        fi
        [[ $ROOT_PART ]] || return 1
 
@@ -1265,7 +1306,13 @@ select_root_partition()
 
 select_extra_partitions()
 {
-       local part
+       local part size dev
+
+       # walk partition list and skip ones that are too small to be usable
+       while read -r dev size; do
+               [[ ${size: -1:1} =~ [KM] ]] && part_countdec "$dev"
+       done <<< "$PARTS"
+
        while (( COUNT > 0 )); do
                part=''
                dlg part menu 'Mount Extra' "$_expart" 'done' 'finish mounting step' $PARTS || break
@@ -1283,6 +1330,8 @@ select_extra_partitions()
 
 ###############################################################################
 # installation
+# main is the entry point which calls all other install functions, once
+# complete it shows a dialog to edit files on the new system before reboot
 
 install_main()
 {
@@ -1301,7 +1350,7 @@ install_main()
        chrun "chown -Rf $NEWUSER:users /home/$NEWUSER"
        sleep 1
 
-       while true; do
+       while :; do
                dlg choice menu "Finalization" "$_edit" \
                        finished   "exit the installer and reboot" \
                        keyboard   "${EDIT_FILES[keyboard]}" \
@@ -1336,28 +1385,24 @@ install_main()
 install_base()
 {
        if [[ $RSYNC_PID || $MIRROR_PID ]]; then
-               clear
+               local oldmsg="" msg=""
                printf "\nOne or more background install processes are still running, grabbing their output...\n"
-               sleep 2
                while kill -0 "$RSYNC_PID" 2>/dev/null || kill -0 "$MIRROR_PID" 2>/dev/null; do
-                       tail -n 1 /tmp/bg_out
-                       sleep 0.5
+                       msg="$(tail -n 1 /tmp/bg_out)"
+                       if [[ "$msg" != "$oldmsg" ]]; then
+                               printf "\n%s" "$msg"
+                               oldmsg="$msg"
+                       else
+                               printf "."
+                       fi
                done
                trap - EXIT
                unset RSYNC_PID MIRROR_PID
-       elif hash rsync >/dev/null 2>&1 && [[ -d /run/archiso/sfs/airootfs/etc/skel ]]; then
+       else
                rsync -ahv /run/archiso/sfs/airootfs/ $MNT/ 2>$ERR
                errshow 1 "rsync -ahv /run/archiso/sfs/airootfs/ $MNT/"
                install_mirrorlist "$MNT/etc/pacman.d/mirrorlist"
                chrun "pacman -Syyu --noconfirm && pacman -S $BASE_PKGS --needed --noconfirm"
-       else
-               mkdir -p /etc/pacman.d/mirrorlist
-               install_mirrorlist "/etc/pacman.d/mirrorlist"
-               pacstrap "$MNT" base $ISO_BASE 2>$ERR
-               errshow 1 "pacstrap $MNT base $KERNEL $ISO_BASE"
-               mkdir -p "$MNT/etc/pacman.d/mirrorlist"
-               cp -f /etc/pacman.d/mirrorlist "$MNT/etc/pacman.d/mirrorlist"
-               chrun "pacman -Syyu --noconfirm && pacman -S $BASE_PKGS --needed --noconfirm"
        fi
 
        rm -rf $MNT/etc/mkinitcpio-archiso.conf
@@ -1368,13 +1413,13 @@ install_base()
        if [[ $VM ]]; then
                find $MNT/etc/X11/xorg.conf.d/ -name '*.conf' -delete
        elif lspci | grep ' VGA ' | grep -q 'Intel'; then
-               cat > $MNT/etc/X11/xorg.conf.d/20-intel.conf << EOF
-Section "Device"
-       Identifier  "Intel Graphics"
-       Driver      "intel"
-       Option      "TearFree" "true"
-EndSection
-EOF
+               cat > $MNT/etc/X11/xorg.conf.d/20-intel.conf <<- EOF
+               Section "Device"
+                   Identifier  "Intel Graphics"
+                   Driver      "intel"
+                   Option      "TearFree" "true"
+               EndSection
+               EOF
        fi
 
        [[ -e /run/archiso/sfs/airootfs && $KERNEL == 'linux' ]] && cp -vf $RUN/x86_64/vmlinuz $MNT/boot/vmlinuz-linux
@@ -1393,32 +1438,33 @@ EOF
                rm -f $MNT/etc/modprobe/
        fi
 
-       cat > $MNT/etc/X11/xorg.conf.d/00-keyboard.conf << EOF
-# Use localectl(1) to instruct systemd-localed to update it.
-Section "InputClass"
-       Identifier      "system-keyboard"
-       MatchIsKeyboard "on"
-       Option          "XkbLayout" "$KEYMAP"
-EndSection
-EOF
-       cat > $MNT/etc/default/keyboard << EOF
-# KEYBOARD CONFIGURATION FILE
-# Consult the keyboard(5) manual page.
-XKBMODEL=""
-XKBLAYOUT="$KEYMAP"
-XKBVARIANT=""
-XKBOPTIONS=""
-BACKSPACE="guess"
-EOF
+       cat > $MNT/etc/X11/xorg.conf.d/00-keyboard.conf <<- EOF
+       # Use localectl(1) to instruct systemd-localed to update it.
+       Section "InputClass"
+           Identifier      "system-keyboard"
+           MatchIsKeyboard "on"
+           Option          "XkbLayout" "$KEYMAP"
+       EndSection
+       EOF
+
+       cat > $MNT/etc/default/keyboard <<- EOF
+       # KEYBOARD CONFIGURATION FILE
+       # Consult the keyboard(5) manual page.
+       XKBMODEL=""
+       XKBLAYOUT="$KEYMAP"
+       XKBVARIANT=""
+       XKBOPTIONS=""
+       BACKSPACE="guess"
+       EOF
        printf "KEYMAP=%s\nFONT=%s\n" "$CMAP" "$FONT" > $MNT/etc/vconsole.conf
        echo "$MYHOST" > $MNT/etc/hostname
-       cat > $MNT/etc/hosts << EOF
-127.0.0.1      localhost
-127.0.1.1      $MYHOST
-::1                    localhost ip6-localhost ip6-loopback
-ff02::1                ip6-allnodes
-ff02::2                ip6-allrouters
-EOF
+       cat > $MNT/etc/hosts <<- EOF
+       127.0.0.1       localhost
+       127.0.1.1       $MYHOST
+       ::1                     localhost ip6-localhost ip6-loopback
+       ff02::1         ip6-allnodes
+       ff02::2         ip6-allrouters
+       EOF
 }
 
 install_boot()
@@ -1467,12 +1513,13 @@ install_boot()
 
 install_user()
 {
+       rm -f $MNT/root/.zshrc  # remove welcome message from root zshrc
        chrun "chpasswd <<< 'root:$ROOT_PASS'" 2>$ERR
        errshow 1 "set root password"
-       if [[ $MYSHELL != "/usr/bin/zsh" ]]; then
-               # root uses zsh by default, change it if something else was chosen
+       if [[ $MYSHELL != "/usr/bin/zsh" ]]; then # root uses zsh by default, change it if something else was chosen
                chrun "usermod -s $MYSHELL root" 2>$ERR
                errshow 1 "usermod -s $MYSHELL root"
+               # copy the default mkshrc to /root if mksh was picked
                [[ $MYSHELL == '/usr/bin/mksh' ]] && cp -fv $MNT/etc/skel/.mkshrc $MNT/root/.mkshrc
        fi
 
@@ -1485,14 +1532,15 @@ install_user()
        chrun "chpasswd <<< '$NEWUSER:$USER_PASS'" 2>$ERR
        errshow 1 "set $NEWUSER password"
 
-       if [[ $USER_PKGS == *neovim* && -d $MNT/home/$NEWUSER/.vim ]]; then
+       # if neovim was picked copy vim configs to ~/.config/nvim
+       if [[ $USER_PKGS == *neovim* ]]; then
                mkdir -p $MNT/home/$NEWUSER/.config/nvim
                cp -fv $MNT/home/$NEWUSER/.vimrc $MNT/home/$NEWUSER/.config/nvim/init.vim
                cp -rfv $MNT/home/$NEWUSER/.vim/colors $MNT/home/$NEWUSER/.config/nvim/colors
        fi
 
-       [[ $INSTALL_WMS == *dwm* ]] && install_suckless
-       [[ $INSTALL_WMS == *awesome* ]] && install_awesome
+       case $INSTALL_WMS in *awesome*) install_awesome ;; *dwm*) install_suckless ;; esac
+
        [[ $WM_PKGS == *xfce* ]] && echo 'volumeicon &' >> $MNT/home/$NEWUSER/.xprofile
 
        # remove some commands from ~/.xprofile when using KDE or Gnome as the login session
@@ -1508,25 +1556,32 @@ install_user()
 
 install_xinit()
 {
-       if [[ -e $MNT/home/$NEWUSER/.xinitrc ]] && grep -q 'exec' $MNT/home/$NEWUSER/.xinitrc; then
-               sed -i "/exec/ c exec ${LOGIN_WM}" $MNT/home/$NEWUSER/.xinitrc
-       else
-               printf "exec %s\n" "$LOGIN_WM" >> $MNT/home/$NEWUSER/.xinitrc
+
+       if [[ $INSTALL_WMS ]]; then
+               if [[ -e $MNT/home/$NEWUSER/.xinitrc ]] && grep -q 'exec' "$MNT/home/$NEWUSER/.xinitrc"; then
+                       sed -i "/exec/ c exec ${LOGIN_WM}" "$MNT/home/$NEWUSER/.xinitrc"
+               elif [[ $INSTALL_WMS ]]; then
+                       printf "exec %s\n" "$LOGIN_WM" >> "$MNT/home/$NEWUSER/.xinitrc"
+               else
+                       printf "exec %s\n" "$LOGIN_WM" >> "$MNT/home/$NEWUSER/.xinitrc"
+               fi
+       elif [[ -e $MNT/home/$NEWUSER/.xinitrc ]]; then
+               # no sessions available so remove the exec from ~/.xinitrc and return
+               sed -i '/exec/d' "$MNT/home/$NEWUSER/.xinitrc"
+               return 0
        fi
 
        [[ ${EDIT_FILES[login]} == *"$LOGINRC"* ]] || EDIT_FILES[login]+=" /home/$NEWUSER/$LOGINRC"
 
        if [[ $AUTOLOGIN ]]; then
                sed -i "s/root/${NEWUSER}/g" $SERVICE/autologin.conf
-               cat > $MNT/home/$NEWUSER/$LOGINRC <<EOF
-# ~/$LOGINRC
-# sourced by ${MYSHELL##*/} when used as a login shell
+               cat > "$MNT/home/$NEWUSER/$LOGINRC" <<- EOF
+               # ~/$LOGINRC
+               # sourced by ${MYSHELL##*/} when used as a login shell
 
-# automatically run startx when logging in on tty1
-if [ -z \$DISPLAY ] && [ \$XDG_VTNR -eq 1 ]; then
-    exec startx
-fi
-EOF
+               # automatically run startx when logging in on tty1
+               [ -z \$DISPLAY ] && [ \$XDG_VTNR -eq 1 ] && exec startx
+               EOF
        else
                rm -rf $SERVICE
        fi
@@ -1535,38 +1590,35 @@ EOF
 install_login()
 {
        SERVICE="$MNT/etc/systemd/system/getty@tty1.service.d"
-       sed -i '/printf/d' $MNT/root/.zshrc
        install_${LOGIN_TYPE:-xinit}
 }
 
 install_lightdm()
 {
-       rm -rf $SERVICE
-       rm -rf $MNT/home/$NEWUSER/.{xinitrc,profile,zprofile,bash_profile}
-       chrun 'systemctl set-default graphical.target && systemctl enable lightdm.service' 2>$ERR
-       errshow 1 "systemctl set-default graphical.target && systemctl enable lightdm.service"
-       cat > $MNT/etc/lightdm/lightdm-gtk-greeter.conf << EOF
-# LightDM GTK+ Configuration
+       rm -rf "$SERVICE" "$MNT/home/$NEWUSER"/.{xinitrc,profile,zprofile,bash_profile}
+       chrun 'systemctl enable lightdm.service' 2>$ERR
+       errshow 1 "systemctl enable lightdm.service"
+       cat > $MNT/etc/lightdm/lightdm-gtk-greeter.conf <<- EOF
+       # LightDM GTK+ Configuration
 
-[greeter]
-default-user-image=/usr/share/icons/ArchLabs-Dark/64x64/places/distributor-logo-archlabs.png
-background=/usr/share/backgrounds/archlabs/archlabs.jpg
-theme-name=Adwaita-dark
-icon-theme-name=Adwaita
-font-name=DejaVu Sans Mono 11
-position=30%,end 50%,end
-EOF
+       [greeter]
+       default-user-image=/usr/share/icons/ArchLabs-Dark/64x64/places/distributor-logo-archlabs.png
+       background=/usr/share/backgrounds/archlabs/archlabs.jpg
+       theme-name=Adwaita-dark
+       icon-theme-name=Adwaita
+       font-name=DejaVu Sans Mono 11
+       position=30%,end 50%,end
+       EOF
 }
 
 install_awesome()
 {
        # downloads and sets up @elenapan's awesome WM config hosted on github
-
        if chrun "git clone https://github.com/elenapan/archlabs-awesome /home/$NEWUSER/archlabs-awesome"; then
                cp -rT "/mnt/home/$NEWUSER/archlabs-awesome" "/mnt/home/$NEWUSER"
                cp -rT "/mnt/home/$NEWUSER/archlabs-awesome" /mnt/etc/skel
                rm -rf "/home/$NEWUSER/"{.git,archlabs-awesome,screenshots}
-               printf "You will need to instal pamac seperately if needed using: 'baph -i pamac-aur'\n"
+               printf "You will need to install pamac separately using: 'baph -i pamac-aur'\n"
                sleep 3
        else
                printf "failed to clone awesome config repo\n"
@@ -1576,56 +1628,53 @@ install_awesome()
 install_packages()
 {
        local rmpkg=""
-       local inpkg="$PACKAGES $USER_PKGS"
-
-       [[ -x $MNT/usr/bin/X ]] || inpkg+=" $BASE_PKGS"
+       local inpkg="$BASE_PKGS ${LOGIN_PKGS[$LOGIN_TYPE]} $PACKAGES $USER_PKGS $UCODE "
 
        if pacman -Qsq 'archlabs-installer' >/dev/null 2>&1; then
-               rmpkg+=" archlabs-installer"
+               rmpkg+="archlabs-installer "
        elif [[ -e "$MNT/usr/bin/archlabs-installer" ]]; then
                rm -f "$MNT/usr/bin/archlabs-installer"
        fi
 
-       # add extras or missed packages gathered throughout the install
-       [[ $UCODE ]] && inpkg+=" $UCODE"
-       [[ $KERNEL == 'linux' ]] || { inpkg+=" $KERNEL"; rmpkg+=" linux"; }
-       [[ $MYSHELL == "/usr/bin/mksh" ]] && inpkg+=" mksh"
+       # add extra packages chosen throughout the install
        if [[ $MYSHELL == '/usr/bin/zsh' ]]; then
-               inpkg+=" zsh-completions"
+               inpkg+="zsh-completions "
        else
-               rmpkg+=" zsh"
+               rmpkg+="zsh "
+               [[ $MYSHELL == '/usr/bin/mksh' ]] && inpkg+="mksh "
        fi
+       if [[ $KERNEL != 'linux' ]]; then
+               inpkg+="$KERNEL "
+               rmpkg+="linux "
+       fi
+
+       # gnome, plasma, and cinnamon have their own superkey bind and ksuperkey conflicts
+       [[ $INSTALL_WMS =~ ^(plasma|gnome|cinnamon)$ ]] || inpkg+="archlabs-ksuperkey "
 
-       # packages only installed for certain WM/DE
-       [[ $INSTALL_WMS =~ ^(plasma|gnome|cinnamon)$ ]] || inpkg+=" archlabs-ksuperkey"
-       [[ $INSTALL_WMS =~ (openbox|bspwm|i3-gaps|dwm|fluxbox) ]] && inpkg+=" $WM_BASE_PKGS"
+       # window manager only packages
+       [[ $INSTALL_WMS =~ (openbox|bspwm|i3-gaps|dwm|fluxbox) ]] && inpkg+="$WM_BASE_PKGS "
 
-       # ensure a terminal gets installed
+       # ensure a terminal gets installed if one wasn't chosen or a DE that installs one
        [[ $inpkg =~ (term|urxvt|tilix|alacritty|sakura|tilda|plasma|cinnamon) || $INSTALL_WMS == *dwm* ]] || inpkg+=" xterm"
 
-       # update fully first to avoid issues
+       # update first to avoid issues
        chrun "pacman -Syyu --noconfirm"
 
-       # remove packages we no longer want
+       # remove the packages we don't want on the installed system
        [[ $rmpkg ]] && chrun "pacman -Rns $rmpkg --noconfirm"
 
-       # for some reason the user has "no network" after install even though the
-       # system is connected, reinstalling iputils fixes it
+       # reinstalling iputils fixes the network issue for non-root users
        chrun "pacman -S iputils --noconfirm"
 
-       # install all the packages chosen throughout the install
+       # install the packages chosen throughout the install
        chrun "pacman -S $inpkg --needed --noconfirm" 2>$ERR
        errshow 1 "pacman -S $inpkg --needed --noconfirm"
 
-       # extras for bootloaders
+       # bootloader packages
        if [[ $BOOTLDR == 'grub' ]]; then
-               if [[ $SYS == 'BIOS' ]]; then
-                       chrun "pacman -S grub os-prober --needed --noconfirm" 2>$ERR
-                       errshow 1 "pacman -S grub os-prober --needed --noconfirm"
-               else
-                       chrun "pacman -S grub os-prober efibootmgr --needed --noconfirm" 2>$ERR
-                       errshow 1 "pacman -S grub os-prober efibootmgr --needed --noconfirm"
-               fi
+               [[ $SYS == 'UEFI' ]] && local efib="efibootmgr"
+               chrun "pacman -S os-prober grub $efib --needed --noconfirm" 2>$ERR
+               errshow 1 "pacman -S os-prober grub $efib --needed --noconfirm"
        elif [[ $BOOTLDR == 'refind-efi' ]]; then
                chrun "pacman -S refind-efi efibootmgr --needed --noconfirm" 2>$ERR
                errshow 1 "pacman -S refind-efi efibootmgr --needed --noconfirm"
@@ -1634,6 +1683,7 @@ install_packages()
                errshow 1 "pacman -S efibootmgr --needed --noconfirm"
        fi
 
+       # allow members of the wheel group to run commands as root
        sed -i "s/# %wheel ALL=(ALL) ALL/%wheel ALL=(ALL) ALL/g" $MNT/etc/sudoers
 
        return 0
@@ -1641,7 +1691,7 @@ install_packages()
 
 install_suckless()
 {
-       mkdir -pv $MNT/home/$NEWUSER/suckless
+       mkdir -pv "$MNT/home/$NEWUSER/suckless"
 
        for i in dwm dmenu st; do
                if chrun "git clone https://git.suckless.org/$i /home/$NEWUSER/suckless/$i"; then
@@ -1651,7 +1701,7 @@ install_suckless()
                fi
        done
 
-       if [[ -d $MNT/home/$NEWUSER/suckless/dwm && -x $MNT/usr/bin/dwm ]]; then
+       if [[ -x $MNT/usr/bin/dwm ]]; then
                printf "To configure dwm edit %s\n" "/home/$NEWUSER/suckless/dwm/config.h"
                printf "You can then recompile it with 'sudo make clean install'\n"
                sleep 2
@@ -1678,24 +1728,24 @@ install_mirrorlist()
        local mfile="$1"  # output mirrorlist file
 
        if hash reflector >/dev/null 2>&1; then
-               reflector --score 120 -l 50 -f 5 --sort rate --save "$mfile"
+               reflector --score 80 -l 40 -f 5 --sort rate --save "$mfile"
        elif hash rankmirrors >/dev/null 2>&1; then
-               ip_add="$(curl -fsSL "http://api.ipstack.com/check&?access_key=5f29642060ab983b31fdf4c2935d8c56&fields=ip" |
-                       python -c "import sys, json; print(json.load(sys.stdin)['ip'])")"
-               country="$(curl -fsSL "http://api.ipstack.com/${ip_add}?access_key=5f29642060ab983b31fdf4c2935d8c56&fields=country_code" |
-                       python -c "import sys, json; print(json.load(sys.stdin)['country_code'])")"
+               local key="access_key=5f29642060ab983b31fdf4c2935d8c56"
+               ip_add="$(curl -fsSL "http://api.ipstack.com/check&?$key&fields=ip" | python -c "import sys, json; print(json.load(sys.stdin)['ip'])")"
+               country="$(curl -fsSL "http://api.ipstack.com/$ip_add?$key&fields=country_code" | python -c "import sys, json; print(json.load(sys.stdin)['country_code'])")"
                if [[ "$country" ]]; then
                        if [[ $country =~ (CA|US) ]]; then
+                               # use both CA and US mirrors for CA or US countries
                                mirror="https://www.archlinux.org/mirrorlist/?country=US&country=CA&use_mirror_status=on"
                        elif [[ $country =~ (AU|NZ) ]]; then
+                               # use both AU and NZ mirrors for AU or NZ countries
                                mirror="https://www.archlinux.org/mirrorlist/?country=AU&country=NZ&use_mirror_status=on"
                        else
                                mirror="https://www.archlinux.org/mirrorlist/?country=${country}&use_mirror_status=on"
                        fi
-               else
+               else # no country code so just grab all mirrors, will be a very slow sort but we don't have other options
                        mirror="https://www.archlinux.org/mirrorlist/?country=all&use_mirror_status=on"
                fi
-
                curl -fsSL "$mirror" | sed -e 's/^#Server/Server/' -e '/^#/d' | rankmirrors -n 6 - >"$mfile"
        fi
 
@@ -1704,20 +1754,24 @@ install_mirrorlist()
 
 install_background()
 {
-       if [[ -d /run/archiso/sfs/airootfs/etc/skel ]] && grep -qw "$MNT" /proc/mounts && (grep -qw "$MNT/$BOOTDIR" /proc/mounts || [[ $SYS == 'BIOS' && -z $LUKS ]]); then
-               yesno "Background Install" "\nBegin install in the background?\n" || return 0
-               rsync -a /run/archiso/sfs/airootfs/ $MNT/ &
-               RSYNC_PID=$!
-               ( install_mirrorlist "$MNT/etc/pacman.d/mirrorlist" && sleep 1 && mkdir -p $MNT/var/lib/pacman && chrun "pacman -Syyu $BASE_PKGS --needed --noconfirm" >> /tmp/bg_out 2>&1 ) &
-               MIRROR_PID=$!
-               # end the background processes before exiting
-               trap "kill $RSYNC_PID $MIRROR_PID 2>/dev/null" EXIT
-       fi
-       return 0
+       yesno "Background Install" "\nBegin install in the background?\n" || return 0
+
+       rsync -a /run/archiso/sfs/airootfs/ $MNT/ &
+       RSYNC_PID=$!
+
+       mkdir -p $MNT/var/lib/pacman # can help with pacman errors
+       ( install_mirrorlist "$MNT/etc/pacman.d/mirrorlist" && sleep 1 && chrun "pacman -Syyu $BASE_PKGS --needed --noconfirm" >> /tmp/bg_out 2>&1 ) &
+       MIRROR_PID=$!
+
+       # end the background processes before exiting
+       trap "kill $RSYNC_PID $MIRROR_PID 2>/dev/null" EXIT
 }
 
 ###############################################################################
 # bootloader setup
+# prerun_* set up the configs needed before actually running the commands
+# setup_* are run after selecting a bootloader and build the command used later
+# they can also be used for further user input as these run before control is taken away
 
 setup_grub()
 {
@@ -1727,6 +1781,7 @@ setup_grub()
                [[ $BOOT_DEV ]] || { part_device 1 || return 1; }
                BCMDS[grub]="grub-install --recheck --force --target=i386-pc $BOOT_DEV"
        else
+               # since we're not using the keyfile this is dead code
                # if [[ $ROOT_PART == */dev/mapper/* && -z $LVM && -z $LUKS_PASS ]]; then
                #       luks_pass "$_luksopen" 1 || return 1
                # fi
@@ -1747,14 +1802,11 @@ setup_grub()
 
 prerun_grub()
 {
-       sed -i "s/GRUB_DISTRIBUTOR=.*/GRUB_DISTRIBUTOR=\"${DIST}\"/g;
-       s/GRUB_CMDLINE_LINUX_DEFAULT=.*/GRUB_CMDLINE_LINUX_DEFAULT=\"\"/g" $MNT/etc/default/grub
+       sed -i "s/GRUB_DISTRIBUTOR=.*/GRUB_DISTRIBUTOR=\"${DIST}\"/g; s/GRUB_CMDLINE_LINUX_DEFAULT=.*/GRUB_CMDLINE_LINUX_DEFAULT=\"\"/g" $MNT/etc/default/grub
 
        if [[ $LUKS_DEV ]]; then
-               sed -i "s~#GRUB_ENABLE_CRYPTODISK~GRUB_ENABLE_CRYPTODISK~g;
-               s~GRUB_CMDLINE_LINUX=.*~GRUB_CMDLINE_LINUX=\"${LUKS_DEV}\"~g" $MNT/etc/default/grub 2>$ERR
-               errshow 1 "sed -i 's~#GRUB_ENABLE_CRYPTODISK~GRUB_ENABLE_CRYPTODISK~g;
-               s~GRUB_CMDLINE_LINUX=.*~GRUB_CMDLINE_LINUX=\"${LUKS_DEV}\"~g' $MNT/etc/default/grub"
+               sed -i "s~#GRUB_ENABLE_CRYPTODISK~GRUB_ENABLE_CRYPTODISK~g; s~GRUB_CMDLINE_LINUX=.*~GRUB_CMDLINE_LINUX=\"${LUKS_DEV}\"~g" $MNT/etc/default/grub 2>$ERR
+               errshow 1 "sed -i 's~#GRUB_ENABLE_CRYPTODISK~GRUB_ENABLE_CRYPTODISK~g; s~GRUB_CMDLINE_LINUX=.*~GRUB_CMDLINE_LINUX=\"${LUKS_DEV}\"~g' $MNT/etc/default/grub"
        fi
 
        if [[ $SYS == 'BIOS' && $LVM && -z $SEP_BOOT ]]; then
@@ -1799,56 +1851,45 @@ prerun_syslinux()
        [[ $SYS == 'UEFI' ]] && { c="$MNT/boot/EFI/syslinux"; s="/usr/lib/syslinux/efi64/"; d=''; }
 
        mkdir -pv "$c" && cp -rfv $s/* "$c/" && cp -f "$RUN/syslinux/splash.png" "$c/"
-       cat > "$c/syslinux.cfg" << EOF
-UI vesamenu.c32
-MENU TITLE $DIST Boot Menu
-MENU BACKGROUND splash.png
-TIMEOUT 50
-DEFAULT $DIST
-
-# see: https://www.syslinux.org/wiki/index.php/Comboot/menu.c32
-MENU WIDTH 78
-MENU MARGIN 4
-MENU ROWS 4
-MENU VSHIFT 10
-MENU TIMEOUTROW 13
-MENU TABMSGROW 14
-MENU CMDLINEROW 14
-MENU HELPMSGROW 16
-MENU HELPMSGENDROW 29
-MENU COLOR border       30;44   #40ffffff #a0000000 std
-MENU COLOR title        1;36;44 #9033ccff #a0000000 std
-MENU COLOR sel          7;37;40 #e0ffffff #20ffffff all
-MENU COLOR unsel        37;44   #50ffffff #a0000000 std
-MENU COLOR help         37;40   #c0ffffff #a0000000 std
-MENU COLOR timeout_msg  37;40   #80ffffff #00000000 std
-MENU COLOR timeout      1;37;40 #c0ffffff #00000000 std
-MENU COLOR msg07        37;40   #90ffffff #a0000000 std
-MENU COLOR tabmsg       31;40   #30ffffff #00000000 std
-
-LABEL $DIST
-MENU LABEL $DIST Linux
-LINUX $d/vmlinuz-$KERNEL
-APPEND root=$ROOT_PART_ID $([[ $LUKS_DEV ]] && printf "%s " "$LUKS_DEV")rw
-INITRD $([[ $UCODE ]] && printf "%s" "$d/$UCODE.img,")$d/initramfs-$KERNEL.img
-
-LABEL ${DIST}fallback
-MENU LABEL $DIST Linux Fallback
-LINUX $d/vmlinuz-$KERNEL
-APPEND root=$ROOT_PART_ID $([[ $LUKS_DEV ]] && printf "%s " "$LUKS_DEV")rw
-INITRD $([[ $UCODE ]] && printf "%s" "$d/$UCODE.img,")$d/initramfs-$KERNEL-fallback.img
-$([[ $SYS == 'BIOS' ]] && printf "\n%s" "# examples of chainloading other bootloaders
-
-#LABEL grub2
-#MENU LABEL Grub2
-#COM32 chain.c32
-#APPEND file=$d/grub/boot.img
-
-#LABEL windows
-#MENU LABEL Windows
-#COM32 chain.c32
-#APPEND hd0 3")
-EOF
+       cat > "$c/syslinux.cfg" <<- EOF
+       UI vesamenu.c32
+       MENU TITLE $DIST Boot Menu
+       MENU BACKGROUND splash.png
+       TIMEOUT 50
+       DEFAULT $DIST
+
+       # see: https://www.syslinux.org/wiki/index.php/Comboot/menu.c32
+       MENU WIDTH 78
+       MENU MARGIN 4
+       MENU ROWS 4
+       MENU VSHIFT 10
+       MENU TIMEOUTROW 13
+       MENU TABMSGROW 14
+       MENU CMDLINEROW 14
+       MENU HELPMSGROW 16
+       MENU HELPMSGENDROW 29
+       MENU COLOR border       30;44   #40ffffff #a0000000 std
+       MENU COLOR title        1;36;44 #9033ccff #a0000000 std
+       MENU COLOR sel          7;37;40 #e0ffffff #20ffffff all
+       MENU COLOR unsel        37;44   #50ffffff #a0000000 std
+       MENU COLOR help         37;40   #c0ffffff #a0000000 std
+       MENU COLOR timeout_msg  37;40   #80ffffff #00000000 std
+       MENU COLOR timeout      1;37;40 #c0ffffff #00000000 std
+       MENU COLOR msg07        37;40   #90ffffff #a0000000 std
+       MENU COLOR tabmsg       31;40   #30ffffff #00000000 std
+
+       LABEL $DIST
+       MENU LABEL $DIST Linux
+       LINUX $d/vmlinuz-$KERNEL
+       APPEND root=$ROOT_PART_ID $([[ $LUKS_DEV ]] && printf "%s " "$LUKS_DEV")rw
+       INITRD $([[ $UCODE ]] && printf "%s" "$d/$UCODE.img,")$d/initramfs-$KERNEL.img
+
+       LABEL ${DIST}fallback
+       MENU LABEL $DIST Linux Fallback
+       LINUX $d/vmlinuz-$KERNEL
+       APPEND root=$ROOT_PART_ID $([[ $LUKS_DEV ]] && printf "%s " "$LUKS_DEV")rw
+       INITRD $([[ $UCODE ]] && printf "%s" "$d/$UCODE.img,")$d/initramfs-$KERNEL-fallback.img
+       EOF
        return 0
 }
 
@@ -1861,26 +1902,26 @@ setup_refind-efi()
 
 prerun_refind-efi()
 {
-       cat > $MNT/boot/refind_linux.conf << EOF
-"$DIST Linux"          "root=$ROOT_PART_ID $([[ $LUKS_DEV ]] &&
-                        printf "%s " "$LUKS_DEV")rw add_efi_memmap $([[ $UCODE ]] &&
-                        printf "initrd=%s " "/$UCODE.img")initrd=/initramfs-$KERNEL.img"
-"$DIST Linux Fallback" "root=$ROOT_PART_ID $([[ $LUKS_DEV ]] &&
-                        printf "%s " "$LUKS_DEV")rw add_efi_memmap $([[ $UCODE ]] &&
-                        printf "initrd=%s " "/$UCODE.img")initrd=/initramfs-$KERNEL-fallback.img"
-EOF
+       cat > $MNT/boot/refind_linux.conf <<- EOF
+       "$DIST Linux"          "root=$ROOT_PART_ID $([[ $LUKS_DEV ]] &&
+                                               printf "%s " "$LUKS_DEV")rw add_efi_memmap $([[ $UCODE ]] &&
+                                               printf "initrd=%s " "/$UCODE.img")initrd=/initramfs-$KERNEL.img"
+       "$DIST Linux Fallback" "root=$ROOT_PART_ID $([[ $LUKS_DEV ]] &&
+                                               printf "%s " "$LUKS_DEV")rw add_efi_memmap $([[ $UCODE ]] &&
+                                               printf "initrd=%s " "/$UCODE.img")initrd=/initramfs-$KERNEL-fallback.img"
+       EOF
        mkdir -p $MNT/etc/pacman.d/hooks
-       cat > $MNT/etc/pacman.d/hooks/refind.hook << EOF
-[Trigger]
-Operation = Upgrade
-Type = Package
-Target = refind-efi
+       cat > $MNT/etc/pacman.d/hooks/refind.hook <<- EOF
+       [Trigger]
+       Operation = Upgrade
+       Type = Package
+       Target = refind-efi
 
-[Action]
-Description = Updating rEFInd on ESP
-When = PostTransaction
-Exec = /usr/bin/refind-install
-EOF
+       [Action]
+       Description = Updating rEFInd on ESP
+       When = PostTransaction
+       Exec = /usr/bin/refind-install
+       EOF
 }
 
 setup_systemd-boot()
@@ -1893,35 +1934,35 @@ setup_systemd-boot()
 prerun_systemd-boot()
 {
        mkdir -p $MNT/boot/loader/entries
-       cat > $MNT/boot/loader/loader.conf << EOF
-default  $DIST
-timeout  5
-editor   no
-EOF
-       cat > $MNT/boot/loader/entries/$DIST.conf << EOF
-title   $DIST Linux
-linux   /vmlinuz-${KERNEL}$([[ $UCODE ]] && printf "\ninitrd  %s" "/$UCODE.img")
-initrd  /initramfs-$KERNEL.img
-options root=$ROOT_PART_ID $([[ $LUKS_DEV ]] && printf "%s " "$LUKS_DEV")rw
-EOF
-       cat > $MNT/boot/loader/entries/$DIST-fallback.conf << EOF
-title   $DIST Linux Fallback
-linux   /vmlinuz-${KERNEL}$([[ $UCODE ]] && printf "\ninitrd  %s" "/$UCODE.img")
-initrd  /initramfs-$KERNEL-fallback.img
-options root=$ROOT_PART_ID $([[ $LUKS_DEV ]] && printf "%s " "$LUKS_DEV")rw
-EOF
+       cat > $MNT/boot/loader/loader.conf <<- EOF
+       default  $DIST
+       timeout  5
+       editor   no
+       EOF
+       cat > $MNT/boot/loader/entries/$DIST.conf <<- EOF
+       title   $DIST Linux
+       linux   /vmlinuz-${KERNEL}$([[ $UCODE ]] && printf "\ninitrd  %s" "/$UCODE.img")
+       initrd  /initramfs-$KERNEL.img
+       options root=$ROOT_PART_ID $([[ $LUKS_DEV ]] && printf "%s " "$LUKS_DEV")rw
+       EOF
+       cat > $MNT/boot/loader/entries/$DIST-fallback.conf <<- EOF
+       title   $DIST Linux Fallback
+       linux   /vmlinuz-${KERNEL}$([[ $UCODE ]] && printf "\ninitrd  %s" "/$UCODE.img")
+       initrd  /initramfs-$KERNEL-fallback.img
+       options root=$ROOT_PART_ID $([[ $LUKS_DEV ]] && printf "%s " "$LUKS_DEV")rw
+       EOF
        mkdir -p $MNT/etc/pacman.d/hooks
-       cat > $MNT/etc/pacman.d/hooks/systemd-boot.hook << EOF
-[Trigger]
-Type = Package
-Operation = Upgrade
-Target = systemd
-
-[Action]
-Description = Updating systemd-boot
-When = PostTransaction
-Exec = /usr/bin/bootctl update
-EOF
+       cat > $MNT/etc/pacman.d/hooks/systemd-boot.hook <<- EOF
+       [Trigger]
+       Type = Package
+       Operation = Upgrade
+       Target = systemd
+
+       [Action]
+       Description = Updating systemd-boot
+       When = PostTransaction
+       Exec = /usr/bin/bootctl update
+       EOF
        systemd-machine-id-setup --root="$MNT"
        return 0
 }
@@ -1987,7 +2028,7 @@ get_lv_size()
 {
        local txt="${VGROUP}: ${SIZE}$SIZE_UNIT (${VGROUP_MB}MB remaining).$_lvmlvsize"
 
-       while true; do
+       while :; do
                ERR_SIZE=0
                dlg VOLUME_SIZE input "$_lvmnew (LV:$VOL_COUNT)" "$txt" ''
                if [[ -z $VOLUME_SIZE ]]; then
@@ -2302,15 +2343,20 @@ luks_advanced()
 }
 
 ###############################################################################
-# helper functions
+# simple functions
+# some help avoid repetition and improve usability of some commands
+# others are initial setup functions used before reaching the main loop
 
 ofn()
 {
+       # does $2 contain $1
        [[ "$2" == *"$1"* ]] && printf "on" || printf "off"
 }
 
 die()
 {
+       # cleanup and exit the installer cleanly with exit code $1
+       # when ecode is 127 unmount /run/archiso/bootmnt and reboot
        local ecode="$1"
 
        trap - INT
@@ -2329,17 +2375,24 @@ die()
 
 dlg()
 {
-       local var="$1" dialog_type="$2" title="$3" body="$4" n=0
-       shift 4
+       local var="$1"   # assign output from dialog to var
+       local dlg_t="$2" # display a dialog of type dlg_t (menu, check, input)
+       local title="$3" # dialog title
+       local body="$4"  # dialog message
+       local n=0        # number of items to display
+
+       shift 4  # shift off args assigned above
+
+       # when passed a large amount of arguments (menu list) adjust menu height
        (( ($# / 2) > SHL )) && n=$SHL
        
        tput civis
-       case "$dialog_type" in
+       case "$dlg_t" in
                menu) dialog --backtitle "$DIST Installer - $SYS - v$VER" --title " $title " --menu "$body" 0 0 $n "$@" 2>"$ANS" || return 1 ;;
                check) dialog --backtitle "$DIST Installer - $SYS - v$VER" --title " $title " --checklist "$body" 0 0 $n "$@" 2>"$ANS" || return 1 ;;
                input)
                        tput cnorm
-                       local def="$1"
+                       local def="$1" # assign default value for input
                        shift
                        if [[ $1 == 'limit' ]]; then
                                dialog --backtitle "$DIST Installer - $SYS - v$VER" --max-input 63 --title " $title " --inputbox "$body" 0 0 "$def" 2>"$ANS" || return 1
@@ -2348,15 +2401,20 @@ dlg()
                        fi
                        ;;
        esac
+       # if answer file isn't empty read from it into $var
        [[ -s "$ANS" ]] && printf -v "$var" "%s" "$(< "$ANS")"
 }
 
 msg()
 {
-       local title="$1" body="$2"
+       # displays a message dialog
+       # when more than 2 args the message will disappear after sleep time ($3)
+       local title="$1"
+       local body="$2"
+       shift 2
        tput civis
-       if (( $# == 3 )); then
-               dialog --backtitle "$DIST Installer - $SYS - v$VER" --sleep "$3" --title " $title " --infobox "$body\n" 0 0
+       if (( $# )); then
+               dialog --backtitle "$DIST Installer - $SYS - v$VER" --sleep "$1" --title " $title " --infobox "$body\n" 0 0
        else
                dialog --backtitle "$DIST Installer - $SYS - v$VER" --title " $title " --msgbox "$body\n" 0 0
        fi
@@ -2395,25 +2453,6 @@ sigint()
        die 1
 }
 
-print4()
-{
-       local str="$*"
-
-       if [[ $COLUMNS -ge 110 && ${#str} -gt $((COLUMNS - 30)) ]]; then
-               str="$(awk '{
-                       i = 2; p1 = p2 = p3 = p4 = ""; p1 = $1; q = int(NF / 4)
-                       for (; i <= q; i++) { p1 = p1 " " $i }
-                       for (; i <= q * 2; i++) { p2 = p2 " " $i }
-                       for (; i <= q * 3; i++) { p3 = p3 " " $i }
-                       for (; i <= NF; i++) { p4 = p4 " " $i }
-                       printf "%s\n           %s\n           %s\n           %s", p1, p2, p3, p4
-               }' <<< "$str")"
-               printf "%s\n" "$str"
-       elif [[ $str ]]; then
-               printf "%s\n" "$str"
-       fi
-}
-
 termcol()
 {
        local colors=(
@@ -2501,7 +2540,7 @@ umount_dir()
 {
        mount | grep -q 'swap' && swapoff -a
        for dir; do
-               [[ -d $dir ]] || continue
+               [[ -d $dir && "$(mount | grep "on $dir ")" ]] || continue
                umount "$dir" 2>/dev/null || { sleep 0.5; umount -f "$dir" 2>/dev/null || umount -l "$dir"; }
        done
 }
@@ -2612,17 +2651,13 @@ msg "Welcome to the $DIST Installer" "\nThis will help you get $DIST setup on yo
 
 select_keymap || { clear; die 0; }
 
-if lspci -vnn -d 14e4: | grep -q 'BCM4352'; then
-       load_bcm
-fi
+# try to fix problematic broadcom wireless chipset before network check
+lspci -vnn -d 14e4: | grep -q 'BCM4352' && load_bcm
 
-if ! net_connect; then
-       msg "Not Connected" "\nThis installer requires an active internet connection.\n\nExiting..\n" 2
-       die 1
-fi
+net_connect || { msg "Not Connected" "\nThis installer requires an active internet connection.\n\nExiting..\n" 2; die 1; }
 
-while true; do
-       select_main
+while :; do
+       main
 done
 
 # vim:fdm=marker:fmr={,}