mirror of
https://git.launchpad.net/livecd-rootfs
synced 2025-12-16 08:33:31 +00:00
ubuntu: add --comp for each optional component from the model
Signed-off-by: Olivier Gayot <olivier.gayot@canonical.com>
This commit is contained in:
parent
a19f30b9d6
commit
5cbea9f677
@ -42,6 +42,25 @@ get_snaps_args()
|
|||||||
| jq --raw-output '.snaps[] | "--snap=" + .name + "=" + .["default-channel"]'
|
| 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:
|
# Generation of the model:
|
||||||
# * At https://github.com/canonical/models one can find a repo of raw,
|
# * At https://github.com/canonical/models one can find a repo of raw,
|
||||||
# unsigned, input .json files, and their signed .model equivalents.
|
# 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)
|
| grep -v -F -e pc-kernel -e snapd -e firmware-updater -e desktop-security-center)
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
for comp in $(get_all_components "$model"); do
|
||||||
|
prepare_args+=(--comp "$comp")
|
||||||
|
done
|
||||||
|
|
||||||
channel=""
|
channel=""
|
||||||
if [ -n "${CHANNEL:-}" ]; then
|
if [ -n "${CHANNEL:-}" ]; then
|
||||||
channel="--channel $CHANNEL"
|
channel="--channel $CHANNEL"
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user