feat: mount_disk_image: Add rootpart parameter

mount_disk_image function expects root partition to be at number 1. But
some images require the root partition to be at other some other number.
For example, EKS Anywhere images for bare metal are used with Tinkerbell
deployment with a default configuration that expects the root device to
be found at /dev/sda2. The knowledge of the root device path is needed
to modify certain files in the root filesystem (e.g. cloud-init configs)
for the machine to join Kubernetes cluster control plane.

The partition number can be changed in the hook by "sgidsk --transpose".
Allow the hook to use mount_disk_image with custom root partition number
by making it an optional third parameter that defaults to 1.
This commit is contained in:
Tomáš Virtus 2024-01-24 11:20:26 +01:00
parent 471f45101e
commit dab1f8c765
No known key found for this signature in database
GPG Key ID: 8FE3BB74393D85AE
2 changed files with 8 additions and 1 deletions

6
debian/changelog vendored
View File

@ -1,3 +1,9 @@
livecd-rootfs (24.04.20) noble; urgency=medium
* live-build/functions: mount_disk_image: add rootpart parameter
-- Tomáš Virtus <tomas.virtus@canonical.com> Wed, 24 Jan 2024 12:52:29 +0000
livecd-rootfs (24.04.19) noble; urgency=medium
* live-build/auto/config: don't repeatedly add the same pass name to the

View File

@ -207,7 +207,8 @@ get_lowerdirs_for_pass () {
mount_disk_image() {
local disk_image=${1}
local mountpoint=${2}
mount_image ${disk_image} 1
local rootpart=${3:-1}
mount_image ${disk_image} "${rootpart}"
mount_partition "${rootfs_dev_mapper}" $mountpoint
local boot_dev="${loop_device}p16"