Clean up some case statements, error when running live with no session.

This commit is contained in:
natemaia 2019-10-10 20:00:22 -07:00
parent 3f4484ee7b
commit 1827c7be1a

View File

@ -5,7 +5,7 @@
# Some ideas and code reworked from other resources # Some ideas and code reworked from other resources
# AIF, Cnichi, Calamares, Arch Wiki.. Credit where credit is due # AIF, Cnichi, Calamares, Arch Wiki.. Credit where credit is due
VER=2.0.76 VER=2.0.77
# bulk default values { # bulk default values {
@ -326,7 +326,11 @@ select_config()
(( i++ )) # progress through to the next choice (( i++ )) # progress through to the next choice
done done
case $MYSHELL in bash) LOGINRC='.bash_profile' ;; zsh) LOGINRC='.zprofile' ;; mksh) LOGINRC='.profile' ;; esac case $MYSHELL in
bash) LOGINRC='.bash_profile' ;;
zsh) LOGINRC='.zprofile' ;;
mksh) LOGINRC='.profile' ;;
esac
return 0 return 0
} }
@ -665,7 +669,7 @@ part_shrink()
part_find "${device##*/}[^ ]" || return 1 part_find "${device##*/}[^ ]" || return 1
(( COUNT == 1 )) && part="$(awk '{print $1}' <<< "${PARTS[@]}" )" (( 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 if (( COUNT == 1 )) || dlg part menu "Resize" "\nWhich partition on $device do you want to resize?" $PARTS; then
fs=$(lsblk -lno FSTYPE "$part") fs=$(lsblk -lno FSTYPE "$part")
case "$fs" in case "$fs" in
@ -1365,7 +1369,7 @@ install_user()
# create user home directories (Music, Documents, Downloads, etc..) # create user home directories (Music, Documents, Downloads, etc..)
chrun 'xdg-user-dirs-update' chrun 'xdg-user-dirs-update'
return 0 return 0
} }
@ -2087,7 +2091,7 @@ dlg()
# adjust n when passed a large list # adjust n when passed a large list
local l=$((LINES - 20)) local l=$((LINES - 20))
(( ($# / 2) > l )) && n=$l (( ($# / 2) > l )) && n=$l
tput civis tput civis
case "$dlg_t" in case "$dlg_t" in
menu) dialog --backtitle "$DIST Installer - $SYS - v$VER" --title " $title " --menu "$body" 0 0 $n "$@" 2>"$ANS" || return 1 ;; menu) dialog --backtitle "$DIST Installer - $SYS - v$VER" --title " $title " --menu "$body" 0 0 $n "$@" 2>"$ANS" || return 1 ;;
@ -2126,6 +2130,10 @@ live()
{ {
local e=0 local e=0
if (( $# == 0 )); then
msg "No Session" "\nRunning live requires a session to use.\n\nExiting..\n" 2
clear
die 1
if ! select_keymap; then if ! select_keymap; then
clear clear
die 0 die 0
@ -2387,7 +2395,11 @@ elif ! grep -qwm 1 'lm' /proc/cpuinfo; then
msg "Not x86_64 Architecture" "\nThis installer only supports x86_64 architectures.\n\nExiting..\n" 2 msg "Not x86_64 Architecture" "\nThis installer only supports x86_64 architectures.\n\nExiting..\n" 2
die 1 die 1
else else
case "$1" in -d|--debug) debug ;; -h|--help) usage "$0" ;; -l|--live) shift; live "$@" ;; esac case "$1" in
-d|--debug) debug ;;
-h|--help) usage "$0" ;;
-l|--live) shift; live "$@" ;;
esac
fi fi
# trap ^C to perform cleanup # trap ^C to perform cleanup