Simplify network check by just checking https://www.archlinux.org/mirrorlist for a 200 response

This commit is contained in:
natemaia 2018-10-20 03:49:42 -07:00
parent ad8af90d43
commit 0702dc69a4
2 changed files with 5 additions and 6 deletions

View File

@ -20,19 +20,18 @@ readonly EFI="/sys/firmware/efi/efivars"
readonly TRN="/usr/share/archlabs/installer/lang"
readonly RUN="/run/archiso/bootmnt/arch/boot"
readonly SALT="$(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 32 | head -n 1)"
readonly VM="$(dmesg | grep -i "hypervisor")"
readonly SALT="$(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 32 | head -n 1)"
readonly SYS_MEM=$(grep 'MemTotal' /proc/meminfo | awk '{print int($2 / 1024)"M"}')
readonly LOCALES="$(awk '/\.UTF-8/ {gsub(/# .*|#/, ""); if($1) print $1 " -"}' /etc/locale.gen)"
readonly CONSOLE_MAPS="$(find /usr/share/kbd/keymaps -name '*.map.gz' | awk '{gsub(/\.map\.gz|.*\//, ""); print $1 " -"}')"
readonly SYS_MEM=$(grep 'MemTotal' /proc/meminfo | awk '{print int($2 / 1024)"M"}')
readonly IGNORE_DEV="$(lsblk -lno NAME,MOUNTPOINT | awk '/\/run\/archiso\/bootmnt/ {sub(/[1-9]/, ""); print $1}')"
readonly IGNORE_DEV="$(lsblk -lno NAME,MOUNTPOINT | awk '/\/run\/archiso\/bootmnt/ {sub(/[1-9]/, ""); print $1}')"
if [[ $IGNORE_DEV ]]; then
readonly SYS_DEVS="$(lsblk -lno NAME,SIZE,TYPE | awk '/disk/ && !'"/$IGNORE_DEV/"' {print "/dev/" $1 " " $2}')"
else
readonly SYS_DEVS="$(lsblk -lno NAME,SIZE,TYPE | awk '/disk/ {print "/dev/" $1 " " $2}')"
fi
readonly DEV_COUNT="$(wc -l <<< "$SYS_DEVS")"
if grep -q 'GenuineIntel' /proc/cpuinfo; then

View File

@ -39,9 +39,9 @@ check_requirements() {
infobox "$_ErrTitle" "$_NotRoot\n$_Exit" && die 1
elif ! grep -qw 'lm' /proc/cpuinfo; then
infobox "$_ErrTitle" "$_Not64Bit\n$_Exit" && die 1
elif ! (ping -c 1 archlinux.org || ping -c 1 archlabslinux.com || ping -c 1 google.com || ping -c 1 bitbucket.org || ping -c 1 github.com || ping -c 1 sourceforge.net) >/dev/null 2>&1; then
elif ! (curl -s --head 'https://www.archlinux.org/mirrorlist/all/' | head -n 1 | grep -q '200'); then
([[ $(systemctl is-active NetworkManager) == "active" ]] && hash nmtui >/dev/null 2>&1) && { tput civis; nmtui; }
if ! (ping -c 1 archlinux.org || ping -c 1 archlabslinux.com || ping -c 1 google.com || ping -c 1 bitbucket.org || ping -c 1 github.com || ping -c 1 sourceforge.net) >/dev/null 2>&1; then
if ! (curl -s --head 'https://www.archlinux.org/mirrorlist/all/' | head -n 1 | grep -q '200'); then
infobox "$_ErrTitle" "$_NoNetwork\n"
fi
fi