Update network connection test

This commit is contained in:
natemaia 2019-01-18 00:01:52 -08:00
parent 34dbe9bc10
commit b3ff098262

View File

@ -8,7 +8,7 @@
# Some ideas and code has been taken from other installers # Some ideas and code has been taken from other installers
# AIF, Cnichi, Calamares, The Arch Wiki.. Credit where credit is due # AIF, Cnichi, Calamares, The Arch Wiki.. Credit where credit is due
VER="1.8.33" # version VER="1.8.34" # version
DIST="ArchLabs" # distributor DIST="ArchLabs" # distributor
MNT="/mnt" # install mountpoint MNT="/mnt" # install mountpoint
@ -44,18 +44,19 @@ LUKS_UUID="" # encrypted partition UUID
LUKS_NAME="" # name used for encryption LUKS_NAME="" # name used for encryption
LVM="" # empty when not using lvm LVM="" # empty when not using lvm
GROUP_PARTS=() # partitions used for volume group VGROUP_MB=0 # available space in volume group
VOL_GROUP_MB=0 # available space in volume group LVM_PARTS=() # partitions used for volume group
WARN=false # issued mounting/partitioning warning WARN=false # issued mounting/partitioning warning
SEP_BOOT=false # separate boot partition for BIOS SEP_BOOT=false # separate boot partition for BIOS
AUTOLOGIN=false # enable autologin for xinit AUTOLOGIN=false # enable autologin for xinit
CONFIG_DONE=false # basic configuration is finished CONFIG_DONE=false # basic configuration is finished
BROADCOM_WL=false # fixes for broadcom cards eg. BCM4352 BROADCOM_WL=false # fixes for broadcom cards eg. BCM4352
CHECKED_NET=false # have we checked the network connection already
# sane baseline # sane baseline
BASE_PKGS="archlabs-scripts archlabs-skel-base archlabs-themes archlabs-dARK archlabs-icons archlabs-wallpapers " BASE_PKGS="archlabs-scripts archlabs-skel-base archlabs-themes archlabs-dARK archlabs-icons archlabs-wallpapers "
BASE_PKGS+="base-devel xorg xorg-drivers sudo git gtk3 gtk-engines gtk-engine-murrine pavucontrol tumbler " BASE_PKGS+="base-devel xorg xorg-drivers sudo git gvfs gtk3 gtk-engines gtk-engine-murrine pavucontrol tumbler "
BASE_PKGS+="playerctl ffmpeg gstreamer libmad libmatroska gst-libav gst-plugins-base gst-plugins-good" BASE_PKGS+="playerctl ffmpeg gstreamer libmad libmatroska gst-libav gst-plugins-base gst-plugins-good"
# sane extras for window managers # sane extras for window managers
@ -932,9 +933,7 @@ select_device()
DEVICE="$(awk '{print $1}' <<< "$SYS_DEVS")" DEVICE="$(awk '{print $1}' <<< "$SYS_DEVS")"
elif (( DEV_COUNT > 1 )); then elif (( DEV_COUNT > 1 )); then
tput civis tput civis
if ! DEVICE="$(menubox "$_DevSelTitle " "${msg}$_DevSelBody" $SYS_DEVS)"; then DEVICE="$(menubox "$_DevSelTitle " "${msg}$_DevSelBody" $SYS_DEVS)" || return 1
return 1
fi
elif [[ $DEV_COUNT -lt 1 && $1 != 'boot' ]]; then elif [[ $DEV_COUNT -lt 1 && $1 != 'boot' ]]; then
msgbox "$_ErrTitle" "\nNo available devices to use.\n$_Exit"; die 1 msgbox "$_ErrTitle" "\nNo available devices to use.\n$_Exit"; die 1
fi fi
@ -1969,7 +1968,7 @@ get_lv_size()
{ {
tput cnorm tput cnorm
local ttl=" $_LvmCreateVG (LV:$VOL_COUNT) " local ttl=" $_LvmCreateVG (LV:$VOL_COUNT) "
local msg="${VOLUME_GROUP}: ${GROUP_SIZE}$GROUP_SIZE_TYPE (${VOL_GROUP_MB}MB $_LvmLvSizeBody1).$_LvmLvSizeBody2" local msg="${VOLUME_GROUP}: ${GROUP_SIZE}$GROUP_SIZE_TYPE (${VGROUP_MB}MB $_LvmLvSizeBody1).$_LvmLvSizeBody2"
if ! VOLUME_SIZE="$(getinput "$ttl" "$msg" "")"; then if ! VOLUME_SIZE="$(getinput "$ttl" "$msg" "")"; then
return 1 return 1
fi fi
@ -1995,17 +1994,17 @@ get_lv_size()
local m=$((s * 1000)) local m=$((s * 1000))
case ${VOLUME_SIZE:$lv:1} in case ${VOLUME_SIZE:$lv:1} in
[Gg]) [Gg])
if (( m >= VOL_GROUP_MB )); then if (( m >= VGROUP_MB )); then
ERR_SIZE=1 ERR_SIZE=1
else else
VOL_GROUP_MB=$((VOL_GROUP_MB - m)) VGROUP_MB=$((VGROUP_MB - m))
fi fi
;; ;;
[Mm]) [Mm])
if (( ${VOLUME_SIZE:0:$lv} >= VOL_GROUP_MB )); then if (( ${VOLUME_SIZE:0:$lv} >= VGROUP_MB )); then
ERR_SIZE=1 ERR_SIZE=1
else else
VOL_GROUP_MB=$((VOL_GROUP_MB - s)) VGROUP_MB=$((VGROUP_MB - s))
fi fi
;; ;;
*) *)
@ -2093,10 +2092,10 @@ lvm_partitions()
PARTS="$(awk 'NF > 0 {print $0 " off"}' <<< "$PARTS")" PARTS="$(awk 'NF > 0 {print $0 " off"}' <<< "$PARTS")"
tput civis tput civis
GROUP_PARTS=($(dialog --cr-wrap --no-cancel --stdout --backtitle "$BT" \ LVM_PARTS=($(dialog --cr-wrap --no-cancel --stdout --backtitle "$BT" \
--title " $_LvmCreateVG " --checklist "$_LvmPvSelBody" 0 0 0 $PARTS)) --title " $_LvmCreateVG " --checklist "$_LvmPvSelBody" 0 0 0 $PARTS))
(( ${#GROUP_PARTS[@]} >= 1 )) (( ${#LVM_PARTS[@]} >= 1 ))
} }
lvm_create_group() lvm_create_group()
@ -2104,13 +2103,13 @@ lvm_create_group()
lvm_group_name || return 1 lvm_group_name || return 1
local msg="$_LvmPvConfBody1 $VOLUME_GROUP\n\n$_LvmPvConfBody2" local msg="$_LvmPvConfBody1 $VOLUME_GROUP\n\n$_LvmPvConfBody2"
while ! yesno "$_LvmCreateVG" "$msg ${GROUP_PARTS[*]}\n"; do while ! yesno "$_LvmCreateVG" "$msg ${LVM_PARTS[*]}\n"; do
lvm_partitions || { break; return 1; } lvm_partitions || { break; return 1; }
lvm_group_name || { break; return 1; } lvm_group_name || { break; return 1; }
done done
vgcreate -f "$VOLUME_GROUP" "${GROUP_PARTS[@]}" >/dev/null 2>$ERR vgcreate -f "$VOLUME_GROUP" "${LVM_PARTS[@]}" >/dev/null 2>$ERR
errshow "vgcreate -f $VOLUME_GROUP ${GROUP_PARTS[*]}" errshow "vgcreate -f $VOLUME_GROUP ${LVM_PARTS[*]}"
GROUP_SIZE=$(vgdisplay "$VOLUME_GROUP" | awk '/VG Size/ { GROUP_SIZE=$(vgdisplay "$VOLUME_GROUP" | awk '/VG Size/ {
gsub(/[^0-9.]/, "") gsub(/[^0-9.]/, "")
@ -2122,9 +2121,9 @@ lvm_create_group()
}')" }')"
if [[ $GROUP_SIZE_TYPE == 'G' ]]; then if [[ $GROUP_SIZE_TYPE == 'G' ]]; then
VOL_GROUP_MB=$((GROUP_SIZE * 1000)) VGROUP_MB=$((GROUP_SIZE * 1000))
else else
VOL_GROUP_MB=$GROUP_SIZE VGROUP_MB=$GROUP_SIZE
fi fi
local msg="$_LvmPvDoneBody1 $VOLUME_GROUP ($GROUP_SIZE $GROUP_SIZE_TYPE)" local msg="$_LvmPvDoneBody1 $VOLUME_GROUP ($GROUP_SIZE $GROUP_SIZE_TYPE)"
@ -2135,21 +2134,21 @@ lvm_create_group()
lvm_create() lvm_create()
{ {
VOLUME_GROUP="" VOLUME_GROUP=""
GROUP_PARTS=() LVM_PARTS=()
VOL_GROUP_MB=0 VGROUP_MB=0
umount_dir $MNT umount_dir $MNT
lvm_partitions || return 1 lvm_partitions || return 1
lvm_create_group || return 1 lvm_create_group || return 1
lvm_volume_count || return 1 lvm_volume_count || return 1
lvm_extra_lvs || return 1 lvm_extra_lvs || return 1
lvm_volume_name "$_LvmLvNameBody1 $_LvmLvNameBody2 (${VOL_GROUP_MB}MB)" || return 1 lvm_volume_name "$_LvmLvNameBody1 $_LvmLvNameBody2 (${VGROUP_MB}MB)" || return 1
lvcreate -l +100%FREE "$VOLUME_GROUP" -n "$VOLUME_NAME" >/dev/null 2>$ERR lvcreate -l +100%FREE "$VOLUME_GROUP" -n "$VOLUME_NAME" >/dev/null 2>$ERR
errshow "lvcreate -l +100%FREE $VOLUME_GROUP -n $VOLUME_NAME" errshow "lvcreate -l +100%FREE $VOLUME_GROUP -n $VOLUME_NAME"
LVM='logical volume' LVM='logical volume'
tput civis tput civis
sleep 0.5 sleep 0.5
local msg="${_Done}$_LvmPvDoneBody1 $VOLUME_GROUP-$VOLUME_NAME (${VOLUME_SIZE:-${VOL_GROUP_MB}MB}) $_LvmPvDoneBody2." local msg="${_Done}$_LvmPvDoneBody1 $VOLUME_GROUP-$VOLUME_NAME (${VOLUME_SIZE:-${VGROUP_MB}MB}) $_LvmPvDoneBody2."
msgbox "$_LvmCreateVG (LV:$VOL_COUNT)" "$msg\n$(lsblk -o NAME,MODEL,TYPE,FSTYPE,SIZE "${GROUP_PARTS[@]}")" msgbox "$_LvmCreateVG (LV:$VOL_COUNT)" "$msg\n$(lsblk -o NAME,MODEL,TYPE,FSTYPE,SIZE "${LVM_PARTS[@]}")"
return 0 return 0
} }
@ -2382,8 +2381,8 @@ ssd()
# check for LVM and or LUKS for their origin devices # check for LVM and or LUKS for their origin devices
if [[ $LUKS && ! $LVM && $dev =~ $LUKS_NAME ]]; then if [[ $LUKS && ! $LVM && $dev =~ $LUKS_NAME ]]; then
dev="${LUKS_PART}" dev="${LUKS_PART}"
elif [[ $LVM && ! $LUKS && ${#GROUP_PARTS[@]} -eq 1 && ${GROUP_PARTS[*]} =~ $dev ]]; then elif [[ $LVM && ! $LUKS && ${#LVM_PARTS[@]} -eq 1 && ${LVM_PARTS[*]} =~ $dev ]]; then
dev="${GROUP_PARTS[*]}" dev="${LVM_PARTS[*]}"
fi fi
dev=${dev#/dev/} dev=${dev#/dev/}
@ -2507,7 +2506,12 @@ load_bcm()
chk_connect() chk_connect()
{ {
infobox "Network Connect" "\nVerifying connection to https://www.archlinux.org\n" if [[ $CHECKED_NET == true ]]; then
infobox "Network Connect" "\nVerifying connection to https://www.archlinux.org\n" 0
else
infobox "Network Connect" "\nChecking connection to https://www.archlinux.org\n" 0
CHECKED_NET=true
fi
curl -sI --connect-timeout 5 'https://www.archlinux.org/' | sed '1q' | grep -q '200' curl -sI --connect-timeout 5 'https://www.archlinux.org/' | sed '1q' | grep -q '200'
} }
@ -2605,8 +2609,7 @@ menubox()
local body="$2" local body="$2"
shift 2 shift 2
local response local response
if ! response="$(dialog --cr-wrap --stdout --backtitle "$BT" --title " $title " --menu "$body" 0 0 0 "$@")" if ! response="$(dialog --cr-wrap --stdout --backtitle "$BT" --title " $title " --menu "$body" 0 0 0 "$@")"; then
then
return 1 return 1
fi fi
printf "%s" "$response" printf "%s" "$response"
@ -2618,8 +2621,7 @@ checkbox()
local body="$2" local body="$2"
shift 2 shift 2
local response local response
if ! response="$(dialog --cr-wrap --stdout --backtitle "$BT" --title " $title " --checklist "$body" 0 0 0 "$@")" if ! response="$(dialog --cr-wrap --stdout --backtitle "$BT" --title " $title " --checklist "$body" 0 0 0 "$@")"; then
then
return 1 return 1
fi fi
printf "%s" "$response" printf "%s" "$response"