From ab3d1c4e948d19ea6c590b57309eb0f103756d10 Mon Sep 17 00:00:00 2001 From: natemaia Date: Tue, 27 Aug 2019 00:52:10 -0700 Subject: [PATCH] Touch up some variables --- archlabs-installer | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/archlabs-installer b/archlabs-installer index dae57a2..acfc4ff 100755 --- a/archlabs-installer +++ b/archlabs-installer @@ -111,11 +111,11 @@ WM_BASE_PKGS+="xdotool compton wmctrl gnome-keyring dunst feh gsimplecal xfce4-p SEL=0 # currently selected menu item ERR="/tmp/errlog" # error log used internally DBG="/tmp/debuglog" # debug log when passed -d -RUN="/run/archiso/bootmnt/arch/boot" # path for live /boot -VM="$(dmesg | grep -i "hypervisor")" # is the system a vm -SYS='Unknown' +RUN="/run/archiso/bootmnt/arch/boot" # path for live system /boot +VM="$(dmesg | grep -i "hypervisor")" # system running in a virtual machine +SYS='Unknown' # bios type to be determined: UEFI/BIOS -export DIALOGOPTS="--cr-wrap" +export DIALOGOPTS="--cr-wrap" # see `man dialog` # } @@ -133,7 +133,6 @@ CMAPS="$(find /usr/share/kbd/keymaps -name '*.map.gz' | awk '{gsub(/\.map\.gz|.* # terminal size [[ $LINES ]] || LINES=$(tput lines) [[ $COLUMNS ]] || COLUMNS=$(tput cols) -SHL=$((LINES - 20)) # associative arrays # { @@ -709,7 +708,7 @@ select_packages() part_menu() { - is_bg_install || return 0 + no_bg_install || return 0 local device choice devhash devhash="$(lsblk -f | base64)" umount_dir $MNT @@ -1092,7 +1091,7 @@ part_mountconf() mount_menu() { msg "Info" "\nGathering device info.\n" 0 - is_bg_install || return 0 + no_bg_install || return 0 lvm_detect umount_dir $MNT part_find 'part|lvm|crypt' || { SEL=2; return 1; } @@ -1932,7 +1931,7 @@ prerun_systemd-boot() lvm_menu() { msg "Info" "\nGathering device info.\n" 0 - is_bg_install || return 1 + no_bg_install || return 1 lvm_detect local choice while :; do @@ -2033,10 +2032,10 @@ lvm_mkgroup() until [[ $named ]]; do lvm_partitions || return 1 lvm_group_name || return 1 - yesno "$_lvmnew" "\nConfirm creation of volume group: $VGROUP\n\nwith the following partition(s): $LVM_PARTS\n" && named=true + yesno "$_lvmnew" "\nCreate volume group: $VGROUP\n\nusing these partition(s): $LVM_PARTS\n" && named=true done - msg "$_lvmnew" "\nCreating group: $VGROUP\n" 0 + msg "$_lvmnew" "\nCreating volume group: $VGROUP\n" 0 vgcreate -f "$VGROUP" $LVM_PARTS >/dev/null 2>$ERR errshow "vgcreate -f $VGROUP $LVM_PARTS" || return 1 @@ -2049,7 +2048,7 @@ lvm_mkgroup() VGROUP_MB=$SIZE fi - msg "$_lvmnew" "\nVolume group: $VGROUP (${SIZE}$SIZE_UNIT) has been created\n" + msg "$_lvmnew" "\nVolume group $VGROUP (${SIZE}$SIZE_UNIT) successfully created\n" } lvm_del_all() @@ -2111,7 +2110,7 @@ lvm_group_name() { VGROUP='' until [[ $VGROUP ]]; do - dlg VGROUP input "$_lvmnew" "$_lvmvgname" "mygroup" + dlg VGROUP input "$_lvmnew" "$_lvmvgname" "lvgroup" if [[ -z $VGROUP ]]; then return 1 elif [[ ${VGROUP:0:1} == "/" || $VGROUP =~ \ |\' ]] || vgdisplay | grep -q "$VGROUP"; then @@ -2126,7 +2125,7 @@ lvm_volume_name() { VNAME='' local txt="$1" default="mainvolume" - (( VOL_COUNT > 1 )) && default="extravolume$VOL_COUNT" + (( VOL_COUNT > 1 )) && default="extvolume$VOL_COUNT" until [[ $VNAME ]]; do dlg VNAME input "$_lvmnew (LV:$VOL_COUNT)" "\n$txt" "$default" if [[ -z $VNAME ]]; then @@ -2145,7 +2144,7 @@ lvm_volume_name() luks_menu() { local choice - is_bg_install || return 1 + no_bg_install || return 1 dlg choice menu "LUKS Encryption" "$_luksmenu" \ "$_luksnew" "cryptsetup -q luksFormat" \ "$_luksopen" "cryptsetup open --type luks" \ @@ -2341,12 +2340,13 @@ dlg() local dlg_t="$2" # dialog type (menu, check, input) local title="$3" # dialog title local body="$4" # dialog message - local n=0 # number of items to display + local n=0 # number of items to display for menu and check dialogs shift 4 # shift off args assigned above - # when passed a large amount of arguments (menu list) adjust menu height - (( ($# / 2) > SHL )) && n=$SHL + # adjust $n when passed a large list + local l=$((LINES - 20)) + (( ($# / 2) > l )) && n=$l tput civis case "$dlg_t" in @@ -2527,7 +2527,7 @@ net_connect() fi } -is_bg_install() +no_bg_install() { [[ $RSYNC_PID || $MIRROR_PID ]] || return 0 msg "Install Running" "\nA background install process is currently running.\n" 2