Touch up some variables

This commit is contained in:
natemaia 2019-08-27 00:52:10 -07:00
parent 0e7257b119
commit ab3d1c4e94

View File

@ -111,11 +111,11 @@ WM_BASE_PKGS+="xdotool compton wmctrl gnome-keyring dunst feh gsimplecal xfce4-p
SEL=0 # currently selected menu item SEL=0 # currently selected menu item
ERR="/tmp/errlog" # error log used internally ERR="/tmp/errlog" # error log used internally
DBG="/tmp/debuglog" # debug log when passed -d DBG="/tmp/debuglog" # debug log when passed -d
RUN="/run/archiso/bootmnt/arch/boot" # path for live /boot RUN="/run/archiso/bootmnt/arch/boot" # path for live system /boot
VM="$(dmesg | grep -i "hypervisor")" # is the system a vm VM="$(dmesg | grep -i "hypervisor")" # system running in a virtual machine
SYS='Unknown' 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 # terminal size
[[ $LINES ]] || LINES=$(tput lines) [[ $LINES ]] || LINES=$(tput lines)
[[ $COLUMNS ]] || COLUMNS=$(tput cols) [[ $COLUMNS ]] || COLUMNS=$(tput cols)
SHL=$((LINES - 20))
# associative arrays # associative arrays
# { # {
@ -709,7 +708,7 @@ select_packages()
part_menu() part_menu()
{ {
is_bg_install || return 0 no_bg_install || return 0
local device choice devhash local device choice devhash
devhash="$(lsblk -f | base64)" devhash="$(lsblk -f | base64)"
umount_dir $MNT umount_dir $MNT
@ -1092,7 +1091,7 @@ part_mountconf()
mount_menu() mount_menu()
{ {
msg "Info" "\nGathering device info.\n" 0 msg "Info" "\nGathering device info.\n" 0
is_bg_install || return 0 no_bg_install || return 0
lvm_detect lvm_detect
umount_dir $MNT umount_dir $MNT
part_find 'part|lvm|crypt' || { SEL=2; return 1; } part_find 'part|lvm|crypt' || { SEL=2; return 1; }
@ -1932,7 +1931,7 @@ prerun_systemd-boot()
lvm_menu() lvm_menu()
{ {
msg "Info" "\nGathering device info.\n" 0 msg "Info" "\nGathering device info.\n" 0
is_bg_install || return 1 no_bg_install || return 1
lvm_detect lvm_detect
local choice local choice
while :; do while :; do
@ -2033,10 +2032,10 @@ lvm_mkgroup()
until [[ $named ]]; do until [[ $named ]]; do
lvm_partitions || return 1 lvm_partitions || return 1
lvm_group_name || 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 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 vgcreate -f "$VGROUP" $LVM_PARTS >/dev/null 2>$ERR
errshow "vgcreate -f $VGROUP $LVM_PARTS" || return 1 errshow "vgcreate -f $VGROUP $LVM_PARTS" || return 1
@ -2049,7 +2048,7 @@ lvm_mkgroup()
VGROUP_MB=$SIZE VGROUP_MB=$SIZE
fi 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() lvm_del_all()
@ -2111,7 +2110,7 @@ lvm_group_name()
{ {
VGROUP='' VGROUP=''
until [[ $VGROUP ]]; do until [[ $VGROUP ]]; do
dlg VGROUP input "$_lvmnew" "$_lvmvgname" "mygroup" dlg VGROUP input "$_lvmnew" "$_lvmvgname" "lvgroup"
if [[ -z $VGROUP ]]; then if [[ -z $VGROUP ]]; then
return 1 return 1
elif [[ ${VGROUP:0:1} == "/" || $VGROUP =~ \ |\' ]] || vgdisplay | grep -q "$VGROUP"; then elif [[ ${VGROUP:0:1} == "/" || $VGROUP =~ \ |\' ]] || vgdisplay | grep -q "$VGROUP"; then
@ -2126,7 +2125,7 @@ lvm_volume_name()
{ {
VNAME='' VNAME=''
local txt="$1" default="mainvolume" local txt="$1" default="mainvolume"
(( VOL_COUNT > 1 )) && default="extravolume$VOL_COUNT" (( VOL_COUNT > 1 )) && default="extvolume$VOL_COUNT"
until [[ $VNAME ]]; do until [[ $VNAME ]]; do
dlg VNAME input "$_lvmnew (LV:$VOL_COUNT)" "\n$txt" "$default" dlg VNAME input "$_lvmnew (LV:$VOL_COUNT)" "\n$txt" "$default"
if [[ -z $VNAME ]]; then if [[ -z $VNAME ]]; then
@ -2145,7 +2144,7 @@ lvm_volume_name()
luks_menu() luks_menu()
{ {
local choice local choice
is_bg_install || return 1 no_bg_install || return 1
dlg choice menu "LUKS Encryption" "$_luksmenu" \ dlg choice menu "LUKS Encryption" "$_luksmenu" \
"$_luksnew" "cryptsetup -q luksFormat" \ "$_luksnew" "cryptsetup -q luksFormat" \
"$_luksopen" "cryptsetup open --type luks" \ "$_luksopen" "cryptsetup open --type luks" \
@ -2341,12 +2340,13 @@ dlg()
local dlg_t="$2" # dialog type (menu, check, input) local dlg_t="$2" # dialog type (menu, check, input)
local title="$3" # dialog title local title="$3" # dialog title
local body="$4" # dialog message 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 shift 4 # shift off args assigned above
# when passed a large amount of arguments (menu list) adjust menu height # adjust $n when passed a large list
(( ($# / 2) > SHL )) && n=$SHL local l=$((LINES - 20))
(( ($# / 2) > l )) && n=$l
tput civis tput civis
case "$dlg_t" in case "$dlg_t" in
@ -2527,7 +2527,7 @@ net_connect()
fi fi
} }
is_bg_install() no_bg_install()
{ {
[[ $RSYNC_PID || $MIRROR_PID ]] || return 0 [[ $RSYNC_PID || $MIRROR_PID ]] || return 0
msg "Install Running" "\nA background install process is currently running.\n" 2 msg "Install Running" "\nA background install process is currently running.\n" 2