diff options
author | JozanLeClerc <bousset.rudy@gmail.com> | 2019-11-28 17:29:32 +0100 |
---|---|---|
committer | JozanLeClerc <bousset.rudy@gmail.com> | 2019-11-28 17:29:32 +0100 |
commit | 333a39a812cc18698f0e4627871a689018f68e98 (patch) | |
tree | c46cdf3784e31c0bc757792c94461271ce30cc1e | |
parent | Whiptail experiment (diff) | |
download | arch-installer-333a39a812cc18698f0e4627871a689018f68e98.tar.gz arch-installer-333a39a812cc18698f0e4627871a689018f68e98.tar.bz2 arch-installer-333a39a812cc18698f0e4627871a689018f68e98.tar.xz arch-installer-333a39a812cc18698f0e4627871a689018f68e98.tar.zst arch-installer-333a39a812cc18698f0e4627871a689018f68e98.zip |
Better code
-rwxr-xr-x | joes-arch-install.sh | 96 |
1 files changed, 48 insertions, 48 deletions
diff --git a/joes-arch-install.sh b/joes-arch-install.sh index 1d2bf03..50b5e4d 100755 --- a/joes-arch-install.sh +++ b/joes-arch-install.sh @@ -226,58 +226,54 @@ jo_get_root_config() { } jo_get_usr_config() { - if whiptail --title "$1"\ - --yesno "Would you like to add a user to the system?"\ - 6 45; then - gogogo=false - while [ "$gogogo" = false ]; do - usr=$(whiptail\ - --nocancel --title "$1"\ - --inputbox "Enter your desired username:"\ - 7 40\ - 3>&1 1>&2 2>&3 3>&-) - if [ "$usr" = "" ]; then - whiptail --msgbox "Username can't be empty" 5 28 - gogogo=false - else - usr=$(echo "$usr" | tr '[:upper:]' '[:lower:]') - gogogo=true - fi - done - isusr=true - gogogo=false - while [ "$gogogo" = false ]; do - usrpwd=$(whiptail --title "$1"\ - --passwordbox "Enter your desired password for $usr:"\ - 7 50\ - 3>&1 1>&2 2>&3 3>&-) - usrusrpwd=$(whiptail --title "$1"\ + gogogo=false + while [ "$gogogo" = false ]; do + usr=$(whiptail\ + --nocancel --title "$1"\ + --inputbox "Enter your desired username:"\ + 7 40\ + 3>&1 1>&2 2>&3 3>&-) + if [ "$usr" = "" ]; then + whiptail --msgbox "Username can't be empty" 5 28 + gogogo=false + else + usr=$(echo "$usr" | tr '[:upper:]' '[:lower:]') + gogogo=true + fi + done + isusr=true + gogogo=false + while [ "$gogogo" = false ]; do + usrpwd=$(whiptail --title "$1"\ + --passwordbox "Enter your desired password for $usr:"\ + 7 50\ + 3>&1 1>&2 2>&3 3>&-) + usrusrpwd=$(whiptail --title "$1"\ --passwordbox "Confirm $usr password:"\ 7 50\ 3>&1 1>&2 2>&3 3>&-) - if ! [ "$usrusrpwd" = "$usrpwd" ]; then - whiptail --msgbox "Password mismatch" 5 22 - gogogo=false - elif [ "$usrpwd" = "" ]; then - whiptail --msgbox "Password can't be empty" 5 28 - gogogo=false - else - gogogo=true - fi - done - if whiptail --title "$1"\ - --yesno "Should $usr be sudo?"\ - 6 45; then - isusrsudo=true + if ! [ "$usrusrpwd" = "$usrpwd" ]; then + whiptail --msgbox "Password mismatch" 5 22 + gogogo=false + elif [ "$usrpwd" = "" ]; then + whiptail --msgbox "Password can't be empty" 5 28 + gogogo=false + else + gogogo=true fi - usrshell=$(whiptail --title "$1"\ - --menu "Choose a shell for $usr:"\ - 10 40 3\ - "zsh" "The z shell"\ - "bash" "The bourne-against shell"\ - "sh" "The OG shell"\ - 3>&1 1>&2 2>&3 3>&-) + done + if whiptail --title "$1"\ + --yesno "Should $usr be sudo?"\ + 6 45; then + isusrsudo=true fi + usrshell=$(whiptail --title "$1"\ + --menu "Choose a shell for $usr:"\ + 10 40 3\ + "zsh" "The z shell"\ + "bash" "The bourne-against shell"\ + "sh" "The OG shell"\ + 3>&1 1>&2 2>&3 3>&-) } jo_pacstrap() { @@ -315,7 +311,11 @@ jo_warn_wiping #------------------------------------ USERS AND ROOT SETUP ----------------------------------------# #==================================================================================================# jo_get_root_config "III. USERS SETUP" -jo_get_usr_config "III. USERS SETUP" +if whiptail --title "III. USERS SETUP"\ + --yesno "Would you like to add a user to the system?"\ + 6 45; then + jo_get_usr_config "III. USERS SETUP" +fi #==================================================================================================# #-------------------------------------- THE ACTUAL INSTALL ----------------------------------------# #==================================================================================================# |