This PR creates a new image build method, repartition, which doesn't add much (or any, really) new functionality, but rather re-uses existing steps, effectively combining the new and resize methods.
This allows the user to, using a raw image file as a basis:
Overwrite the image's partition table with whatever content they define (via the existing image_partitions config)
Format newly created partitions with mkfs (the user chooses which partitions they want to format, as we don't know which ones are 'newly created' since we don't parse partition tables of existing images)
Resize the ext{2,3,4} filesystems of resized partitions with resize2fs
This is something that was especially useful in my particular use-case, but I think it could be useful more widely as well, hence this PR :)
Use-cases
Grow/shrink a partition in an existing image
Create new partitions at the end of the image file
Swap partition
Separate /home partition
Destroy an unwanted partition in an existing image
Backwards compatibility
I've tried to make this change entirely backwards-compatible, so that no existing builds will be affected by it.
To do this:
skip_mkfs defaults to false, and hence the Mkfs step behaviour is unchanged (it's only currently used with the new method, as far as I can tell, in which case we shouldn't be skipping it by default for any partitions)
resize_fs only has an effect when using the repartition method, and hence the behaviour of the resize step should be unchanged
Description
This PR creates a new image build method,
repartition
, which doesn't add much (or any, really) new functionality, but rather re-uses existing steps, effectively combining thenew
andresize
methods.This allows the user to, using a raw image file as a basis:
image_partitions
config)mkfs
(the user chooses which partitions they want to format, as we don't know which ones are 'newly created' since we don't parse partition tables of existing images)resize2fs
This is something that was especially useful in my particular use-case, but I think it could be useful more widely as well, hence this PR :)
Use-cases
/home
partitionBackwards compatibility
I've tried to make this change entirely backwards-compatible, so that no existing builds will be affected by it.
To do this:
skip_mkfs
defaults to false, and hence the Mkfs step behaviour is unchanged (it's only currently used with thenew
method, as far as I can tell, in which case we shouldn't be skipping it by default for any partitions)resize_fs
only has an effect when using the repartition method, and hence the behaviour of the resize step should be unchanged