Update network connection test
This commit is contained in:
parent
34dbe9bc10
commit
b3ff098262
@ -8,7 +8,7 @@
|
||||
# Some ideas and code has been taken from other installers
|
||||
# AIF, Cnichi, Calamares, The Arch Wiki.. Credit where credit is due
|
||||
|
||||
VER="1.8.33" # version
|
||||
VER="1.8.34" # version
|
||||
DIST="ArchLabs" # distributor
|
||||
MNT="/mnt" # install mountpoint
|
||||
|
||||
@ -44,18 +44,19 @@ LUKS_UUID="" # encrypted partition UUID
|
||||
LUKS_NAME="" # name used for encryption
|
||||
|
||||
LVM="" # empty when not using lvm
|
||||
GROUP_PARTS=() # partitions used for volume group
|
||||
VOL_GROUP_MB=0 # available space in volume group
|
||||
VGROUP_MB=0 # available space in volume group
|
||||
LVM_PARTS=() # partitions used for volume group
|
||||
|
||||
WARN=false # issued mounting/partitioning warning
|
||||
SEP_BOOT=false # separate boot partition for BIOS
|
||||
AUTOLOGIN=false # enable autologin for xinit
|
||||
CONFIG_DONE=false # basic configuration is finished
|
||||
BROADCOM_WL=false # fixes for broadcom cards eg. BCM4352
|
||||
CHECKED_NET=false # have we checked the network connection already
|
||||
|
||||
# sane baseline
|
||||
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"
|
||||
|
||||
# sane extras for window managers
|
||||
@ -932,9 +933,7 @@ select_device()
|
||||
DEVICE="$(awk '{print $1}' <<< "$SYS_DEVS")"
|
||||
elif (( DEV_COUNT > 1 )); then
|
||||
tput civis
|
||||
if ! DEVICE="$(menubox "$_DevSelTitle " "${msg}$_DevSelBody" $SYS_DEVS)"; then
|
||||
return 1
|
||||
fi
|
||||
DEVICE="$(menubox "$_DevSelTitle " "${msg}$_DevSelBody" $SYS_DEVS)" || return 1
|
||||
elif [[ $DEV_COUNT -lt 1 && $1 != 'boot' ]]; then
|
||||
msgbox "$_ErrTitle" "\nNo available devices to use.\n$_Exit"; die 1
|
||||
fi
|
||||
@ -1969,7 +1968,7 @@ get_lv_size()
|
||||
{
|
||||
tput cnorm
|
||||
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
|
||||
return 1
|
||||
fi
|
||||
@ -1995,17 +1994,17 @@ get_lv_size()
|
||||
local m=$((s * 1000))
|
||||
case ${VOLUME_SIZE:$lv:1} in
|
||||
[Gg])
|
||||
if (( m >= VOL_GROUP_MB )); then
|
||||
if (( m >= VGROUP_MB )); then
|
||||
ERR_SIZE=1
|
||||
else
|
||||
VOL_GROUP_MB=$((VOL_GROUP_MB - m))
|
||||
VGROUP_MB=$((VGROUP_MB - m))
|
||||
fi
|
||||
;;
|
||||
[Mm])
|
||||
if (( ${VOLUME_SIZE:0:$lv} >= VOL_GROUP_MB )); then
|
||||
if (( ${VOLUME_SIZE:0:$lv} >= VGROUP_MB )); then
|
||||
ERR_SIZE=1
|
||||
else
|
||||
VOL_GROUP_MB=$((VOL_GROUP_MB - s))
|
||||
VGROUP_MB=$((VGROUP_MB - s))
|
||||
fi
|
||||
;;
|
||||
*)
|
||||
@ -2093,10 +2092,10 @@ lvm_partitions()
|
||||
PARTS="$(awk 'NF > 0 {print $0 " off"}' <<< "$PARTS")"
|
||||
|
||||
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))
|
||||
|
||||
(( ${#GROUP_PARTS[@]} >= 1 ))
|
||||
(( ${#LVM_PARTS[@]} >= 1 ))
|
||||
}
|
||||
|
||||
lvm_create_group()
|
||||
@ -2104,13 +2103,13 @@ lvm_create_group()
|
||||
lvm_group_name || return 1
|
||||
|
||||
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_group_name || { break; return 1; }
|
||||
done
|
||||
|
||||
vgcreate -f "$VOLUME_GROUP" "${GROUP_PARTS[@]}" >/dev/null 2>$ERR
|
||||
errshow "vgcreate -f $VOLUME_GROUP ${GROUP_PARTS[*]}"
|
||||
vgcreate -f "$VOLUME_GROUP" "${LVM_PARTS[@]}" >/dev/null 2>$ERR
|
||||
errshow "vgcreate -f $VOLUME_GROUP ${LVM_PARTS[*]}"
|
||||
|
||||
GROUP_SIZE=$(vgdisplay "$VOLUME_GROUP" | awk '/VG Size/ {
|
||||
gsub(/[^0-9.]/, "")
|
||||
@ -2122,9 +2121,9 @@ lvm_create_group()
|
||||
}')"
|
||||
|
||||
if [[ $GROUP_SIZE_TYPE == 'G' ]]; then
|
||||
VOL_GROUP_MB=$((GROUP_SIZE * 1000))
|
||||
VGROUP_MB=$((GROUP_SIZE * 1000))
|
||||
else
|
||||
VOL_GROUP_MB=$GROUP_SIZE
|
||||
VGROUP_MB=$GROUP_SIZE
|
||||
fi
|
||||
|
||||
local msg="$_LvmPvDoneBody1 $VOLUME_GROUP ($GROUP_SIZE $GROUP_SIZE_TYPE)"
|
||||
@ -2135,21 +2134,21 @@ lvm_create_group()
|
||||
lvm_create()
|
||||
{
|
||||
VOLUME_GROUP=""
|
||||
GROUP_PARTS=()
|
||||
VOL_GROUP_MB=0
|
||||
LVM_PARTS=()
|
||||
VGROUP_MB=0
|
||||
umount_dir $MNT
|
||||
lvm_partitions || return 1
|
||||
lvm_create_group || return 1
|
||||
lvm_volume_count || 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
|
||||
errshow "lvcreate -l +100%FREE $VOLUME_GROUP -n $VOLUME_NAME"
|
||||
LVM='logical volume'
|
||||
tput civis
|
||||
sleep 0.5
|
||||
local msg="${_Done}$_LvmPvDoneBody1 $VOLUME_GROUP-$VOLUME_NAME (${VOLUME_SIZE:-${VOL_GROUP_MB}MB}) $_LvmPvDoneBody2."
|
||||
msgbox "$_LvmCreateVG (LV:$VOL_COUNT)" "$msg\n$(lsblk -o NAME,MODEL,TYPE,FSTYPE,SIZE "${GROUP_PARTS[@]}")"
|
||||
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 "${LVM_PARTS[@]}")"
|
||||
|
||||
return 0
|
||||
}
|
||||
@ -2382,8 +2381,8 @@ ssd()
|
||||
# check for LVM and or LUKS for their origin devices
|
||||
if [[ $LUKS && ! $LVM && $dev =~ $LUKS_NAME ]]; then
|
||||
dev="${LUKS_PART}"
|
||||
elif [[ $LVM && ! $LUKS && ${#GROUP_PARTS[@]} -eq 1 && ${GROUP_PARTS[*]} =~ $dev ]]; then
|
||||
dev="${GROUP_PARTS[*]}"
|
||||
elif [[ $LVM && ! $LUKS && ${#LVM_PARTS[@]} -eq 1 && ${LVM_PARTS[*]} =~ $dev ]]; then
|
||||
dev="${LVM_PARTS[*]}"
|
||||
fi
|
||||
|
||||
dev=${dev#/dev/}
|
||||
@ -2507,7 +2506,12 @@ load_bcm()
|
||||
|
||||
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'
|
||||
}
|
||||
|
||||
@ -2605,8 +2609,7 @@ menubox()
|
||||
local body="$2"
|
||||
shift 2
|
||||
local response
|
||||
if ! response="$(dialog --cr-wrap --stdout --backtitle "$BT" --title " $title " --menu "$body" 0 0 0 "$@")"
|
||||
then
|
||||
if ! response="$(dialog --cr-wrap --stdout --backtitle "$BT" --title " $title " --menu "$body" 0 0 0 "$@")"; then
|
||||
return 1
|
||||
fi
|
||||
printf "%s" "$response"
|
||||
@ -2618,8 +2621,7 @@ checkbox()
|
||||
local body="$2"
|
||||
shift 2
|
||||
local response
|
||||
if ! response="$(dialog --cr-wrap --stdout --backtitle "$BT" --title " $title " --checklist "$body" 0 0 0 "$@")"
|
||||
then
|
||||
if ! response="$(dialog --cr-wrap --stdout --backtitle "$BT" --title " $title " --checklist "$body" 0 0 0 "$@")"; then
|
||||
return 1
|
||||
fi
|
||||
printf "%s" "$response"
|
||||
|
Reference in New Issue
Block a user