Commit e8a2f379 authored by Bernhard Landauer's avatar Bernhard Landauer

work on lvm section

parent 308fe960
...@@ -603,7 +603,7 @@ lvm_create() { ...@@ -603,7 +603,7 @@ lvm_create() {
PARTITIONS=$(echo $PARTITIONS | sed 's/M\|G\|T/& off/g') PARTITIONS=$(echo $PARTITIONS | sed 's/M\|G\|T/& off/g')
# Name the Volume Group # 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}) LVM_VG=$(cat ${ANSWER})
# Loop while the Volume Group name starts with a "/", is blank, has spaces, or is already being used # Loop while the Volume Group name starts with a "/", is blank, has spaces, or is already being used
...@@ -641,12 +641,16 @@ lvm_create() { ...@@ -641,12 +641,16 @@ lvm_create() {
# Once VG created, create Logical Volumes # Once VG created, create Logical Volumes
# #
while [[ ! $NUMBER_LOGICAL_VOLUMES == "" ]]; do # Specify number of Logical volumes to create.
# Specify number of Logical volumes to create. DIALOG " $_LvmCreateVG " --inputbox "\n$_LvmLvNumBody1 [${LVM_VG}]. $_LvmLvNumBody2\n " 0 0 2>${ANSWER}
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 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. # 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 while [[ $NUMBER_LOGICAL_VOLUMES -gt 1 ]]; do
DIALOG " $_LvmCreateVG (LV:$NUMBER_LOGICAL_VOLUMES) " --inputbox "\n$_LvmLvNameBody1\n " 0 0 "lvol" 2>${ANSWER} || return 0 DIALOG " $_LvmCreateVG (LV:$NUMBER_LOGICAL_VOLUMES) " --inputbox "\n$_LvmLvNameBody1\n " 0 0 "lvol" 2>${ANSWER} || return 0
...@@ -774,6 +778,12 @@ lvm_del_vg() { ...@@ -774,6 +778,12 @@ lvm_del_vg() {
} }
lvm_del_all() { 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_PV=$(pvs -o pv_name --noheading 2>/dev/null)
LVM_VG=$(vgs -o vg_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) LVM_LV=$(lvs -o vg_name,lv_name --noheading --separator - 2>/dev/null)
...@@ -801,22 +811,30 @@ lvm_del_all() { ...@@ -801,22 +811,30 @@ lvm_del_all() {
} }
lvm_menu() { lvm_menu() {
DIALOG " $_PrepLVM $_PrepLVM2 " --infobox "\n$_PlsWaitBody\n " 0 0 declare -i loopmenu=1
sleep 1 while ((loopmenu)); do
lvm_detect DIALOG " $_PrepLVM $_PrepLVM2 " --infobox "\n$_PlsWaitBody\n " 0 0
sleep 1
DIALOG " $_PrepLVM $_PrepLVM2 " --menu "\n$_LvmMenu\n " 0 0 4 \ lvm_detect
"$_LvmCreateVG" "vgcreate -f, lvcreate -L -n" \
"$_LvmDelVG" "vgremove -f" \ DIALOG " $_PrepLVM $_PrepLVM2 " --menu "\n$_LvmMenu\n " 0 0 4 \
"$_LvMDelAll" "lvrmeove, vgremove, pvremove -f" \ "$_LvmCreateVG" "vgcreate -f, lvcreate -L -n" \
"$_Back" "-" 2>${ANSWER} "$_LvmDelVG" "vgremove -f" \
"$_LvMDelAll" "lvrmeove, vgremove, pvremove -f" \
case $(cat ${ANSWER}) in "$_Back" "-" 2>${ANSWER}
"$_LvmCreateVG") lvm_create ;;
"$_LvmDelVG") lvm_del_vg ;; case $(cat ${ANSWER}) in
"$_LvMDelAll") lvm_del_all ;; "$_LvmCreateVG") lvm_create
*) return 0 ;; ;;
esac "$_LvmDelVG") lvm_del_vg
;;
"$_LvMDelAll") lvm_del_all
;;
*) loopmenu=0
return 0
;;
esac
done
} }
mount_partitions() { 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