diff --git a/0-preinstall.sh b/0-preinstall.sh index 552ca8a..7cf0f9f 100755 --- a/0-preinstall.sh +++ b/0-preinstall.sh @@ -84,7 +84,7 @@ do_format() { do_lvm() { i=0 while [[ "$i" -le "${#LVM_PART_NUM[@]}" ]]; do - if [[ "$i" -eq "${#LVM_PART_NUM[@]}" ]]; then + if [[ "${#LVM_PART_NUM[@]}" -eq 1 ]]; then lvcreate --extents 100%FREE "$LVM_VG" --name "${LVM_NAMES[$i]}" else lvcreate --size "${LVM_SIZES[$i]}" "$LVM_VG" --name "${LVM_NAMES[$i]}" diff --git a/startup.sh b/startup.sh index eaede7d..c824fd9 100644 --- a/startup.sh +++ b/startup.sh @@ -98,16 +98,20 @@ set_lvm() { echo "And will be mounted at /mnt/ and other partitions will be mounted" echo "at /mnt/partition_name by making a directory /mnt/partition_name" - i=1 + i=0 _LVM_NAMES=() LVM_SIZES=() - if [[ -z "$_PART_NUM" ]]; then + if [[ -z "$_PART_NUM" || "$_PART_NUM" -eq 1 ]]; then _PART_NUM=1 _LVM_NAMES+=("root") - LVM_SIZES+=("100%FREE") + # LVM_SIZES+=("100%FREE") i=2 fi while [[ $i -le "$_PART_NUM" ]]; do + if [[ "$_PART_NUM" -eq 1 ]]; then + read -r -p "Enter last partition name [like home]: " _LVM_NAME + _LVM_NAMES+=("$_LVM_NAME") + fi read -r -p "Enter $i partition name [like root]: " _LVM_NAME _LVM_NAMES+=("$_LVM_NAME") read -r -p "Enter $i partition size [like 25G, 200M]: " _LVM_SIZE