#!/usr/bin/bash # shellcheck disable=2154,2034,2153 # vim:fdm=marker:fmr={,} # 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.39" # Installer version readonly DIST="ArchLabs" # Linux distributor readonly MNT="/mnt" # 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" if [[ $SAVED ]]; then SELECTED=$((SAVED + 1)) unset SAVED fi elif (( SELECTED < 8 )); then ((SELECTED++)) # increment the highlighted menu item fi tput civis SELECTED=$(dialog --cr-wrap --stdout --backtitle "$BT" \ --title " $_PrepTitle " --default-item $SELECTED \ --cancel-label "Exit" --menu "$_PrepBody" 0 0 0 \ "1" "$_PrepShowDev" "2" "$_PrepParts" \ "3" "$_PrepLUKS" "4" "$_PrepLVM" \ "5" "$_PrepMount" "6" "$_PrepConfig" \ "7" "Check Choices" "8" "$_PrepInstall") if [[ $SELECTED ]]; then if (( SELECTED == 8 )); then preinstall_checks 1 || return 1 elif (( SELECTED == 6 )); then preinstall_checks || return 1 elif [[ $WARN != true ]] && (( SELECTED == 2 || SELECTED == 5 )); then msgbox "$_PrepTitle" "$_WarnMount" WARN=true fi fi case $SELECTED in 1) device_tree ;; 2) partition || SELECTED=$((SELECTED - 1)) ;; 3) luks_menu || SELECTED=$((SELECTED - 1)) ;; 4) lvm_menu || SELECTED=$((SELECTED - 1)) ;; 5) mnt_menu || SELECTED=$((SELECTED - 1)) ;; 6) cfg_menu || SELECTED=$((SELECTED - 1)) ;; 7) show_cfg ;; 8) install ;; *) yesno "$_CloseInst" "$_CloseInstBody" "Exit" "Back" && die esac } # source all the lib files for i in /usr/share/archlabs/installer/lib/?*.sh; do if ! . "$i" 2>/dev/null; then printf "\nFailed to source library file %s\n" "$i" die 1 fi done # trap Ctrl-C to properly exit trap sigint INT for arg in "$@"; do [[ $arg =~ (--debug|-d) ]] && debug 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