diff options
author | JozanLeClerc <bousset.rudy@gmail.com> | 2019-11-27 02:11:09 +0100 |
---|---|---|
committer | JozanLeClerc <bousset.rudy@gmail.com> | 2019-11-27 02:11:09 +0100 |
commit | 191881e0304ae382ea098c371f0fb33d3690f4ee (patch) | |
tree | d3fb134b9802cad8df278a40dd761d14ae2087f6 /joes-arch-install.sh | |
parent | Few dialog boxes now (diff) | |
download | arch-installer-191881e0304ae382ea098c371f0fb33d3690f4ee.tar.gz arch-installer-191881e0304ae382ea098c371f0fb33d3690f4ee.tar.bz2 arch-installer-191881e0304ae382ea098c371f0fb33d3690f4ee.tar.xz arch-installer-191881e0304ae382ea098c371f0fb33d3690f4ee.tar.zst arch-installer-191881e0304ae382ea098c371f0fb33d3690f4ee.zip |
Better functions arrangement
Diffstat (limited to 'joes-arch-install.sh')
-rwxr-xr-x | joes-arch-install.sh | 58 |
1 files changed, 34 insertions, 24 deletions
diff --git a/joes-arch-install.sh b/joes-arch-install.sh index 50d1193..8ddb6ae 100755 --- a/joes-arch-install.sh +++ b/joes-arch-install.sh @@ -58,6 +58,37 @@ jo_goodbye() { exit } +jo_chk_internet() { + clear + dialog --infobox "Verifying that you are connected to the Internet, please wait..." 4 40 + sleep 2 + if ! wget -q --spider https://www.archlinux.org/; then + dialog --title "ERROR"\ + --msgbox "Critical error:\n\nIt seems that you are not connected to the internet,\ +therefore Joe's installer is forced to abort.\nPlease connect to the Internet and retry."\ + 12 30 + jo_goodbye + else + dialog --msgbox "Success\!" 5 12 + fi +} + +jo_set_hstnm() { + while [ $hstnm = "" ]; do + hstnm=$(dialog\ + --nocancel --title "$1"\ + --inputbox "Please choose a hostname for this machine.\ +\n\nIf you are running on a managed network,\ +please ask your network administrator for an appropriate name."\ + 12 55\ + 3>&1 1>&2 2>&3 3>&-) + if [ "$hstnm" = "" ]; then + dialog --infobox "Hostname is empty, retrying..." 3 34 + sleep 2 + fi + done +} + jo_pacstrap() { echo echo -e "${BCYAN}Installing ${BYELLOW}$1${END}" @@ -65,6 +96,7 @@ jo_pacstrap() { echo -e "${BGREEN}$1 installed${END}" fi } + #==================================================================================================# #--------------------------------------------- START ----------------------------------------------# #==================================================================================================# @@ -72,33 +104,11 @@ dialog --title "Welcome" --msgbox "Welcome to Joe's Arch Linux installation util #==================================================================================================# #--------------------------------------- INTERNET CHECK -------------------------------------------# #==================================================================================================# -clear -dialog --infobox "Verifying that you are connected to the Internet, please wait..." 4 40 -if ! wget -q --spider https://www.archlinux.org/; then - dialog --title "ERROR"\ - --msgbox "Critical error:\n\nIt seems that you are not connected to the internet,\ -therefore Joe's installer is forced to abort.\nPlease connect to the Internet and retry."\ - 12 30 - jo_goodbye -else - dialog --msgbox "Success\!" 5 12 -fi +jo_chk_internet #==================================================================================================# #---------------------------------------- HOSTNAME SETUP ------------------------------------------# #==================================================================================================# -while [ $hstnm = "" ]; do - hstnm=$(dialog\ - --nocancel --title "I. CORE SETUP"\ - --inputbox "Please choose a hostname for this machine.\ -\n\nIf you are running on a managed network,\ -please ask your network administrator for an appropriate name."\ - 12 55\ - 3>&1 1>&2 2>&3 3>&-) - if [ "$hstnm" = "" ]; then - dialog --infobox "Hostname is empty, retrying..." 3 34 - sleep 2 - fi -done +jo_set_hstnm "I. CORE SETUP" answr="n" clear #==================================================================================================# |