Commit e8a2f379 authored by Bernhard Landauer's avatar Bernhard Landauer
Browse files

work on lvm section

parent 308fe960
......@@ -603,7 +603,7 @@ lvm_create() {
PARTITIONS=$(echo $PARTITIONS | sed 's/M\|G\|T/& off/g')
# Name the Volume Group
DIALOG " $_LvmCreateVG " --inputbox "\n$_LvmNameVgBody\n " 0 0 "" 2>${ANSWER} || return 0
DIALOG " $_LvmCreateVG " --inputbox "\n$_LvmNameVgBody\n " 0 0 2>${ANSWER} || return 0
LVM_VG=$(cat ${ANSWER})
# Loop while the Volume Group name starts with a "/", is blank, has spaces, or is already being used
......@@ -641,12 +641,16 @@ lvm_create() {
# Once VG created, create Logical Volumes
#
while [[ ! $NUMBER_LOGICAL_VOLUMES == "" ]]; do
# Specify number of Logical volumes to create.
DIALOG " $_LvmCreateVG " --inputbox "\n$_LvmLvNumBody1 [${LVM_VG}]. $_LvmLvNumBody2\n " 0 0 2>${ANSWER}
NUMBER_LOGICAL_VOLUMES=$(cat ${ANSWER})
# repeat if answer is not a number
while [[ $(cat ${ANSWER}) != ?(-)+([0-9]) ]]; do
DIALOG " $_ErrTitle " --inputbox "\n$_LvmLvNumBody1 [${LVM_VG}]. $_LvmLvNumBody2\n " 0 0 2>${ANSWER}
done
NUMBER_LOGICAL_VOLUMES=$(cat ${ANSWER})
# Loop while the number of LVs is greater than 1. This is because the size of the last LV is automatic.
while [[ $NUMBER_LOGICAL_VOLUMES -gt 1 ]]; do
DIALOG " $_LvmCreateVG (LV:$NUMBER_LOGICAL_VOLUMES) " --inputbox "\n$_LvmLvNameBody1\n " 0 0 "lvol" 2>${ANSWER} || return 0
......@@ -774,6 +778,12 @@ lvm_del_vg() {
}
lvm_del_all() {
# check if VG exist at all
if [[ $(lvs) == "" ]];
DIALOG " $_ErrTitle " --msgbox "\n$_LvmVGErr\n " 0 0
return 0
fi
LVM_PV=$(pvs -o pv_name --noheading 2>/dev/null)
LVM_VG=$(vgs -o vg_name --noheading 2>/dev/null)
LVM_LV=$(lvs -o vg_name,lv_name --noheading --separator - 2>/dev/null)
......@@ -801,6 +811,8 @@ lvm_del_all() {
}
lvm_menu() {
declare -i loopmenu=1
while ((loopmenu)); do
DIALOG " $_PrepLVM $_PrepLVM2 " --infobox "\n$_PlsWaitBody\n " 0 0
sleep 1
lvm_detect
......@@ -812,11 +824,17 @@ lvm_menu() {
"$_Back" "-" 2>${ANSWER}
case $(cat ${ANSWER}) in
"$_LvmCreateVG") lvm_create ;;
"$_LvmDelVG") lvm_del_vg ;;
"$_LvMDelAll") lvm_del_all ;;
*) return 0 ;;
"$_LvmCreateVG") lvm_create
;;
"$_LvmDelVG") lvm_del_vg
;;
"$_LvMDelAll") lvm_del_all
;;
*) loopmenu=0
return 0
;;
esac
done
}
mount_partitions() {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment