various fixes
[automated-distro-installer] / fai / config / hooks / partition.DEFAULT
index 1586e48a2f86866c16552ff7b4ce27be3d0e161f..410b915651aef26b658fce62fc3492c2c173d395 100755 (executable)
@@ -866,8 +866,13 @@ if $partition; then
       # so use fixed sizes to allow both to grow
       # 600 = uefi 512 + grubext 8 + bios grub 3 + some extra cuz this is lvm
       #root_mib=$(( disk_mib - root2_part_mib - swap_mib - boot_part_mib - boot2_part_mib - 600 ))
-      root_mib=$(( 1000 * 1000 )) # * 1000 to make it in gb.
       o_mib=$(( 120 * 1000 ))
+      # max minus o, minus a gig just for some extra space
+      max_root_mib=$(( disk_mib - root2_part_mib - swap_mib - boot_part_mib - boot2_part_mib - 600 - o_mib - 1000 ))
+      root_mib=$(( 1000 * 1000 )) # * 1000 to make it in gb.
+      if (( max_root_mib < root_mib )); then
+        root_mib=$max_root_mib
+      fi
     fi
 
     if [[ ! $SPECIAL_DISK ]]; then