This repository has been archived on 2024-09-01. You can view files and clone it, but cannot push or open issues or pull requests.
al-installer/src/archlabs-installer
2019-03-16 21:21:48 -07:00

91 lines
2.7 KiB
Bash
Executable File

#!/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.25" # 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
if [[ $SAVED ]]; then
SELECTED=$((SAVED + 1))
unset SAVED
else
SELECTED=1
fi
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_checks 1 || preinstall_checks; } || 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 failing keeps the highlight
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
[[ $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