pmb.install: simplify root size estimation (MR 1931)

Do not substract the estimated size of the home and boot directories
from the root directory size. While that would be the correct way if we
were able to get exact sizes, it isn't helpful with the very rough
estimates we are getting from pmb.helpers.other.folder_size. Replace
"calculate" wording with "estimate".
This commit is contained in:
Oliver Smith 2020-06-02 10:22:07 +02:00
parent 37b4af19fc
commit 40a328388d
No known key found for this signature in database
GPG Key ID: 5AE7F5513E0885CB
1 changed files with 6 additions and 11 deletions

View File

@ -36,20 +36,15 @@ def get_subpartitions_size(args):
:returns: (boot, root) the size of the boot and root
partition as integer in bytes
"""
# Calculate required sizes first
boot = int(args.boot_size) * 1024 * 1024
# Estimate root partition size, then add some free space. The size
# calculation is not as trivial as one may think, and depending on the
# file system etc it seems to be just impossible to get it right.
chroot = args.work + "/chroot_rootfs_" + args.device
full = pmb.helpers.other.folder_size(args, chroot)
boot = pmb.helpers.other.folder_size(args, chroot + "/boot")
home = pmb.helpers.other.folder_size(args, chroot + "/home")
# The home folder gets omitted when copying the rootfs to
# /dev/installp2
root = full - boot - home
# Add some free space, see also: #336, #1671
root = pmb.helpers.other.folder_size(args, chroot)
root *= 1.20
root += 50 * 1024 * 1024
boot = int(args.boot_size) * 1024 * 1024
return (boot, root)