diff --git a/live-build/ubuntu/hooks/030-ubuntu-live-system-seed.binary b/live-build/ubuntu/hooks/030-ubuntu-live-system-seed.binary index b3b2b345..f7e8ab33 100644 --- a/live-build/ubuntu/hooks/030-ubuntu-live-system-seed.binary +++ b/live-build/ubuntu/hooks/030-ubuntu-live-system-seed.binary @@ -42,6 +42,25 @@ get_snaps_args() | jq --raw-output '.snaps[] | "--snap=" + .name + "=" + .["default-channel"]' } +get_all_components() +{ + # Get list of all components in every snaps + local model=$1 + local jq_filter=' +# Find all snaps that have components + .snaps[] | select(.components) +# Then save the name of each snap in a variable + | .name as $snap +# Then for each entry that has "optional" + | .components | to_entries | map(select(.value.presence == "optional")) +# Output its name with the snap name prepended + | "\($snap)" + "+" + .[].key' + + sed '/^$/,$d' -- "$model" \ + | yaml_to_json \ + | jq --raw-output "$jq_filter" +} + # Generation of the model: # * At https://github.com/canonical/models one can find a repo of raw, # unsigned, input .json files, and their signed .model equivalents. @@ -91,6 +110,10 @@ else | grep -v -F -e pc-kernel -e snapd -e firmware-updater -e desktop-security-center) fi +for comp in $(get_all_components "$model"); do + prepare_args+=(--comp "$comp") +done + channel="" if [ -n "${CHANNEL:-}" ]; then channel="--channel $CHANNEL"