OSDN Git Service

Clean up some case statements, error when running live with no session.
authornatemaia <natemaia10@gmail.com>
Fri, 11 Oct 2019 03:00:22 +0000 (20:00 -0700)
committernatemaia <natemaia10@gmail.com>
Fri, 11 Oct 2019 03:00:22 +0000 (20:00 -0700)
archlabs-installer

index 5a965d4..632f617 100755 (executable)
@@ -5,7 +5,7 @@
 # Some ideas and code reworked from other resources
 # AIF, Cnichi, Calamares, Arch Wiki.. Credit where credit is due
 
-VER=2.0.76
+VER=2.0.77
 
 # bulk default values {
 
@@ -326,7 +326,11 @@ select_config()
                (( i++ )) # progress through to the next choice
        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
 }
@@ -665,7 +669,7 @@ part_shrink()
 
        part_find "${device##*/}[^ ]" || return 1
        (( 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
                fs=$(lsblk -lno FSTYPE "$part")
                case "$fs" in
@@ -1365,7 +1369,7 @@ install_user()
 
        # create user home directories (Music, Documents, Downloads, etc..)
        chrun 'xdg-user-dirs-update'
-       
+
        return 0
 }
 
@@ -2087,7 +2091,7 @@ dlg()
        # adjust n when passed a large list
        local l=$((LINES - 20))
        (( ($# / 2) > l )) && n=$l
-       
+
        tput civis
        case "$dlg_t" in
                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
 
+       if (( $# == 0 )); then
+               msg "No Session" "\nRunning live requires a session to use.\n\nExiting..\n" 2
+               clear
+               die 1
        if ! select_keymap; then
                clear
                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
        die 1
 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
 
 # trap ^C to perform cleanup