mirror of
https://git.launchpad.net/livecd-rootfs
synced 2025-12-19 01:53:29 +00:00
ubuntu: use the same for in construct when getting snap args
Signed-off-by: Olivier Gayot <olivier.gayot@canonical.com>
This commit is contained in:
parent
e6558e2541
commit
2f918331fb
@ -34,6 +34,13 @@ json.dump(yaml.safe_load(sys.stdin), sys.stdout, default=str)
|
|||||||
get_snaps_args_excluding()
|
get_snaps_args_excluding()
|
||||||
{
|
{
|
||||||
local model=$1
|
local model=$1
|
||||||
|
local jq_filter='
|
||||||
|
# Find all snaps that are not filtered out.
|
||||||
|
# The filtered out snaps are passed as positional arguments so they end up in
|
||||||
|
# the $ARGS.positional array.
|
||||||
|
.snaps[] | select(.name | IN($ARGS.positional[]) | not)
|
||||||
|
# Then forge the --snap option.
|
||||||
|
| "--snap=" + .name + "=" + .["default-channel"]'
|
||||||
|
|
||||||
shift
|
shift
|
||||||
|
|
||||||
@ -41,13 +48,14 @@ get_snaps_args_excluding()
|
|||||||
# signature. Here we assume the only blank line is before the signature.
|
# signature. Here we assume the only blank line is before the signature.
|
||||||
sed '/^$/,$d' -- "$model" \
|
sed '/^$/,$d' -- "$model" \
|
||||||
| yaml_to_json \
|
| yaml_to_json \
|
||||||
| jq --raw-output '.snaps[] | select(.name | IN($ARGS.positional[]) | not) | "--snap=" + .name + "=" + .["default-channel"]' --args "$@"
|
| jq --raw-output "$jq_filter" --args "$@"
|
||||||
}
|
}
|
||||||
|
|
||||||
# Use jq to retrieve a list of --snap options from a given *signed* model.
|
# Use jq to retrieve a list of --snap options from a given *signed* model.
|
||||||
get_snaps_args()
|
get_snaps_args()
|
||||||
{
|
{
|
||||||
get_snaps_args_excluding "$1"
|
local model=$1
|
||||||
|
get_snaps_args_excluding "$model"
|
||||||
}
|
}
|
||||||
|
|
||||||
_get_components_filtered()
|
_get_components_filtered()
|
||||||
@ -152,9 +160,9 @@ else
|
|||||||
# * firmware-updater (for TPM/FDE)
|
# * firmware-updater (for TPM/FDE)
|
||||||
# * desktop-security-center (for TPM/FDE)
|
# * desktop-security-center (for TPM/FDE)
|
||||||
snaps_from_dangerous=(snapd snapd-desktop-integration firmware-updater desktop-security-center)
|
snaps_from_dangerous=(snapd snapd-desktop-integration firmware-updater desktop-security-center)
|
||||||
while read -r snap_arg; do
|
for snap_arg in $(get_snaps_args_excluding "$stable_model" "${snaps_from_dangerous[@]}"); do
|
||||||
prepare_args+=("$snap_arg")
|
prepare_args+=("$snap_arg")
|
||||||
done < <(get_snaps_args_excluding "$stable_model" "${snaps_from_dangerous[@]}")
|
done
|
||||||
|
|
||||||
for comp in $(get_components_excluding "$stable_model" "${snaps_from_dangerous[@]}"); do
|
for comp in $(get_components_excluding "$stable_model" "${snaps_from_dangerous[@]}"); do
|
||||||
components+=("$comp")
|
components+=("$comp")
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user