Check for user creation before allowing config

This commit is contained in:
natemaia 2019-01-11 16:37:14 -08:00
parent d6e930cea2
commit 425a26d88a

View File

@ -8,7 +8,7 @@
# Some ideas and code has been taken from other installers # Some ideas and code has been taken from other installers
# AIF, Cnichi, Calamares, The Arch Wiki.. Credit where credit is due # AIF, Cnichi, Calamares, The Arch Wiki.. Credit where credit is due
VER="1.8.9" # version VER="1.8.11" # version
DIST="ArchLabs" # distributor DIST="ArchLabs" # distributor
MNT="/mnt" # mountpoint MNT="/mnt" # mountpoint
@ -52,12 +52,12 @@ main()
3) luks_menu || SELECTED=$((SELECTED - 1)) ;; 3) luks_menu || SELECTED=$((SELECTED - 1)) ;;
4) lvm_menu || SELECTED=$((SELECTED - 1)) ;; 4) lvm_menu || SELECTED=$((SELECTED - 1)) ;;
5) mnt_menu || SELECTED=$((SELECTED - 1)) ;; 5) mnt_menu || SELECTED=$((SELECTED - 1)) ;;
6) prechecks && { mkuser || SELECTED=$((SELECTED - 1)); } ;; 6) prechecks 0 && { mkuser || SELECTED=$((SELECTED - 1)); } ;;
7) prechecks && { cfg_menu || SELECTED=$((SELECTED - 1)); } ;; 7) prechecks 1 && { cfg_menu || SELECTED=$((SELECTED - 1)); } ;;
8) prechecks 1 && { select_wm_or_de || SELECTED=$((SELECTED - 1)); } ;; 8) prechecks 2 && { select_wm_or_de || SELECTED=$((SELECTED - 1)); } ;;
9) prechecks 1 && { select_packages || SELECTED=$((SELECTED - 1)); } ;; 9) prechecks 2 && { select_packages || SELECTED=$((SELECTED - 1)); } ;;
10) prechecks 1 && show_cfg ;; 10) prechecks 2 && show_cfg ;;
11) prechecks 1 && install ;; 11) prechecks 2 && install ;;
*) yesno "$_CloseInst" "$_CloseInstBody" "Exit" "Back" && die *) yesno "$_CloseInst" "$_CloseInstBody" "Exit" "Back" && die
esac esac
} }
@ -2415,15 +2415,15 @@ system_checks()
prechecks() prechecks()
{ {
if ! [[ $(lsblk -o MOUNTPOINT) =~ $MNT ]]; then if [[ $1 -ge 0 ]] && ! [[ $(lsblk -o MOUNTPOINT) =~ $MNT ]]; then
msgbox "$_ErrTitle" "$_ErrNoMount" msgbox "$_ErrTitle" "$_ErrNoMount"
SELECTED=4 SELECTED=4
return 1 return 1
elif [[ $# -eq 1 && ! $NEWUSER ]]; then elif [[ $1 -ge 1 && ! $NEWUSER ]]; then
msgbox "$_ErrTitle" "\nYou need to create a user first.\n" msgbox "$_ErrTitle" "\nYou need to create a user first.\n"
SELECTED=5 SELECTED=5
return 1 return 1
elif [[ $# -eq 1 && $CONFIG_DONE != true ]]; then elif [[ $1 -ge 2 && $CONFIG_DONE != true ]]; then
msgbox "$_ErrTitle" "$_ErrNoConfig" msgbox "$_ErrTitle" "$_ErrNoConfig"
SELECTED=6 SELECTED=6
return 1 return 1