Fix: lvm group size parsing issue

This commit is contained in:
natemaia 2018-12-16 23:50:48 -08:00
parent 6ff20d57a4
commit dd243e47f8
2 changed files with 34 additions and 31 deletions

View File

@ -10,7 +10,7 @@
# immutable globals
readonly VER="1.7.47" # Installer version
readonly VER="1.7.48" # Installer version
readonly DIST="ArchLabs" # Linux distributor
readonly MNT="/mnt" # Install mountpoint
readonly ERR="/tmp/errlog" # Built-in error log

View File

@ -12,6 +12,32 @@ declare -g LVM=""
declare -g GROUP_PARTS=""
declare -g VOL_GROUP_MB=0
lvm_menu()
{
lvm_detect
tput civis
local choice
choice="$(menubox "$_PrepLVM" "$_LvmMenu" 0 0 0 \
"$_LvmCreateVG" "vgcreate -f, lvcreate -L -n" \
"$_LvmDelVG" "vgremove -f" \
"$_LvMDelAll" "lvrmeove, vgremove, pvremove -f" \
"$_Back" "-")"
case $choice in
"$_LvmCreateVG")
lvm_create
retval=$?
[[ $retval != 1 ]] && return $retval
;;
"$_LvmDelVG") lvm_del_vg ;;
"$_LvMDelAll") lvm_del_all ;;
*) return 0
esac
lvm_menu
}
lvm_detect()
{
PHYSICAL_VOLUMES="$(pvs -o pv_name --noheading 2>/dev/null)"
@ -213,11 +239,14 @@ lvm_create_group()
vgcreate -f "$VOLUME_GROUP" "$GROUP_PARTS" >/dev/null 2>$ERR
echeck "vgcreate -f $VOLUME_GROUP $GROUP_PARTS"
GROUP_SIZE=$(vgdisplay "$VOLUME_GROUP" |
awk '/VG Size/ {print int($3)}')
GROUP_SIZE=$(vgdisplay "$VOLUME_GROUP" | awk '/VG Size/ {
gsub(/[^0-9.]/, "")
print int($0)
}')
GROUP_SIZE_TYPE="$(vgdisplay "$VOLUME_GROUP" |
awk '/VG Size/ {print substr($NF, 0, 1)}')"
GROUP_SIZE_TYPE="$(vgdisplay "$VOLUME_GROUP" | awk '/VG Size/ {
print substr($NF, 0, 1)
}')"
if [[ $GROUP_SIZE_TYPE == 'G' ]]; then
VOL_GROUP_MB=$((GROUP_SIZE * 1000))
@ -288,29 +317,3 @@ lvm_del_all()
return 0
}
lvm_menu()
{
lvm_detect
tput civis
local choice
choice="$(menubox "$_PrepLVM" "$_LvmMenu" 0 0 0 \
"$_LvmCreateVG" "vgcreate -f, lvcreate -L -n" \
"$_LvmDelVG" "vgremove -f" \
"$_LvMDelAll" "lvrmeove, vgremove, pvremove -f" \
"$_Back" "-")"
case $choice in
"$_LvmCreateVG")
lvm_create
retval=$?
[[ $retval != 1 ]] && return $retval
;;
"$_LvmDelVG") lvm_del_vg ;;
"$_LvMDelAll") lvm_del_all ;;
*) return 0
esac
lvm_menu
}