From 0e7257b119e67e441dce56bcebc0a115ad73c9b6 Mon Sep 17 00:00:00 2001 From: natemaia Date: Tue, 27 Aug 2019 00:24:03 -0700 Subject: [PATCH] Fix: lvm_create() calling dlg() with invalid argument list --- archlabs-installer | 32 +++++++++++++++++--------------- 1 file changed, 17 insertions(+), 15 deletions(-) diff --git a/archlabs-installer b/archlabs-installer index de58ff1..dae57a2 100755 --- a/archlabs-installer +++ b/archlabs-installer @@ -15,7 +15,7 @@ : ${DIST="ArchLabs"} -VER="2.0.60" # installer version +VER="2.0.61" # installer version MNT="/mnt" # install mountpoint ANS="/tmp/ans" # dialog answer file @@ -1935,17 +1935,19 @@ lvm_menu() is_bg_install || return 1 lvm_detect local choice - dlg choice menu "Logical Volume Management" "$_lvmmenu" \ - "$_lvmnew" "vgcreate -f, lvcreate -L -n" \ - "$_lvmdel" "vgremove -f" \ - "$_lvmdelall" "lvrmeove, vgremove, pvremove -f" \ - "back" "return to the main menu" - - case "$choice" in - "$_lvmnew") lvm_create || return 1 ;; - "$_lvmdel") lvm_delgroup && yesno "$_lvmdel" "$_lvmdelask" && vgremove -f "$DEL_VG" >/dev/null 2>&1 ;; - "$_lvmdelall") lvm_del_all ;; - esac + while :; do + dlg choice menu "Logical Volume Management" "$_lvmmenu" \ + "$_lvmnew" "vgcreate -f, lvcreate -L -n" \ + "$_lvmdel" "vgremove -f" \ + "$_lvmdelall" "lvrmeove, vgremove, pvremove -f" \ + "back" "return to the main menu" + case "$choice" in + "$_lvmnew") lvm_create ;; + "$_lvmdel") lvm_delgroup && yesno "$_lvmdel" "$_lvmdelask" && vgremove -f "$DEL_VG" >/dev/null 2>&1 ;; + "$_lvmdelall") lvm_del_all ;; + *) break ;; + esac + done return 0 } @@ -1972,7 +1974,7 @@ lvm_create() umount_dir $MNT lvm_mkgroup || return 1 local txt="\nThe last (or only) logical volume will automatically use all remaining space in the volume group." - dlg VOL_COUNT menu "$_lvmnew" "\nSelect the number of logical volumes (LVs) to create in: $VGROUP\n$txt" 1 - 2 - 3 - 4 - 5 - 6 - 7 - 8 - 9 + dlg VOL_COUNT menu "$_lvmnew" "\nSelect the number of logical volumes (LVs) to create in: $VGROUP\n$txt" 1 - 2 - 3 - 4 - 5 - 6 - 7 - 8 - 9 - [[ $VOL_COUNT ]] || return 1 lvm_extra_lvs || return 1 lvm_volume_name "$_lvmlvname\nNOTE: This LV will use up all remaining space in the volume group (${VGROUP_MB}MB)" || return 1 @@ -2034,7 +2036,7 @@ lvm_mkgroup() yesno "$_lvmnew" "\nConfirm creation of volume group: $VGROUP\n\nwith the following partition(s): $LVM_PARTS\n" && named=true done - msg "$_lvmnew" "\nCreating group: $VGROUP (${SIZE}$SIZE_UNIT)\n" 0 + msg "$_lvmnew" "\nCreating group: $VGROUP\n" 0 vgcreate -f "$VGROUP" $LVM_PARTS >/dev/null 2>$ERR errshow "vgcreate -f $VGROUP $LVM_PARTS" || return 1 @@ -2048,7 +2050,6 @@ lvm_mkgroup() fi msg "$_lvmnew" "\nVolume group: $VGROUP (${SIZE}$SIZE_UNIT) has been created\n" - return 0 } lvm_del_all() @@ -2079,6 +2080,7 @@ lvm_delgroup() for i in $(lvs --noheadings | awk '{print $2}' | uniq); do VOL_GROUP_LIST+="$i $(vgdisplay "$i" | awk '/VG Size/ {print $3$4}') " done + [[ $VOL_GROUP_LIST ]] || { msg "No Groups" "\nNo volume groups found."; return 1; } dlg DEL_VG menu "Logical Volume Management" "\nSelect volume group to delete.\n\nAll logical volumes within will also be deleted." $VOL_GROUP_LIST