#!/usr/bin/bash # shellcheck disable=2154,2034,2153 # This program is free software, provided under the GNU GPL # Written by Nathaniel Maia for use in Archlabs # Some ideas and code has been taken from other installers # AIF, Cnichi, Calamares, The Arch Wiki.. Credit where credit is due # immutable globals readonly VER="1.7.18" # Installer version readonly DIST="ArchLabs" # Linux distributor readonly MNT="/mnt/install" # Install mountpoint readonly ERR="/tmp/errlog" # Built-in error log readonly DBG="/tmp/debuglog" # Built-in error log main() { if [[ $CURRENT_MENU != "main" ]]; then SELECTED=1 CURRENT_MENU="main" elif (( SELECTED < 9 )); then ((SELECTED++)) # increment the highlighted menu item fi tput civis SELECTED=$(dialog --cr-wrap --stdout --backtitle "$BT" \ --title " $_PrepTitle " --default-item $SELECTED --menu "$_PrepBody" 0 0 0 \ "1" "$_PrepShowDev" "2" "$_PrepParts" "3" "$_PrepLUKS" "4" "$_PrepLVM" \ "5" "$_PrepMount" "6" "$_PrepConfig" "7" "Check Choices" "8" "$_PrepInstall" \ "9" "$_Done") # if trying to install the system, make sure the partitions are mounted # and that the needed config variables and user variables have been set up if [[ $SELECTED ]]; then if [[ $SELECTED -eq 8 || $SELECTED -eq 6 ]]; then { [[ $SELECTED -eq 8 ]] && preinstall_check 1 || preinstall_check; } || return 1 elif [[ ($SELECTED -eq 2 || $SELECTED -eq 5) && $WARN != true ]]; then msgbox "$_PrepTitle" "$_WarnMount" && WARN=true fi fi # setting $SELECTED to $SELECTED - 1 when a step fails retains the highlighted menu item case $SELECTED in 1) device_tree ;; 2) partition || SELECTED=1 ;; 3) luks_menu || SELECTED=2 ;; 4) lvm_menu || SELECTED=3 ;; 5) mount_install_partitions || SELECTED=4 ;; 6) configure_system_settings || SELECTED=5 ;; 7) display_system_settings ;; 8) install ;; *) yesno "$_CloseInst" "$_CloseInstBody" "Exit" "Back" && die esac } # source all the lib files for i in /usr/share/archlabs/installer/lib/?*.sh; do . "$i" || { printf "\nFailed to source library file %s\n" "$i"; die 1; } done # trap Ctrl-C to properly exit trap sigint INT for arg in "$@"; do case $arg in --debug|-d) debug ;; esac done # initial prep select_language select_keymap # call checks before identify so we can try mounting efivarfs system_checks system_identify system_devices # welcome message msgbox "$_WelTitle $DIST Installer" "$_WelBody" while true; do main done