When injecting a snap on an ISO that has multiple initrds (which define multiple layerfs-paths), having a way to select the initrd to use is convenient.
On Ubuntu 22.04 Server ISOs, we have a boot entry for "Ubuntu Server" and a second boot entry for "Ubuntu Server with HWE kernel". The entries respectively map to /casper/initrd and /casper/hwe-initrd.
Unconditionally injecting the snap using the layerfs-path from /casper/initrd makes it difficult to run ISO testing with the HWE kernel.
By making livefs-editor look for the presence of the INITRD_PATH variable (which we would set to /casper/hwe-initrd in our scenario), we have the opportunity to choose which boot entry is affected by the snap injection.
I think ideally, we'd need a way to inject the snap in both layers ; which we can't do in a single livefs-editor invocation with this implementation. But I guess it's an improvement.
When injecting a snap on an ISO that has multiple initrds (which define multiple layerfs-paths), having a way to select the initrd to use is convenient.
On Ubuntu 22.04 Server ISOs, we have a boot entry for "Ubuntu Server" and a second boot entry for "Ubuntu Server with HWE kernel". The entries respectively map to /casper/initrd and /casper/hwe-initrd.
Unconditionally injecting the snap using the layerfs-path from /casper/initrd makes it difficult to run ISO testing with the HWE kernel.
By making livefs-editor look for the presence of the INITRD_PATH variable (which we would set to /casper/hwe-initrd in our scenario), we have the opportunity to choose which boot entry is affected by the snap injection.