mirror of
https://git.launchpad.net/livecd-rootfs
synced 2025-12-20 02:23:28 +00:00
ubuntu: add a filter for snaps too
We now filter snaps using jq rather than grep. The change has a slight impact because snapd-desktop-integration was filtered out by "grep snapd" but isn't filtered out anymore with jq. Signed-off-by: Olivier Gayot <olivier.gayot@canonical.com>
This commit is contained in:
parent
01c80d8d0a
commit
e6558e2541
1
debian/changelog
vendored
1
debian/changelog
vendored
@ -6,6 +6,7 @@ livecd-rootfs (26.04.12) UNRELEASED; urgency=medium
|
||||
- if we decide to override the definition of a snap (i.e., by taking in
|
||||
from a different model), we also need to override the definition of its
|
||||
components.
|
||||
* desktop: refactor how we filter the snaps when overriding
|
||||
|
||||
-- Olivier Gayot <olivier.gayot@canonical.com> Tue, 16 Dec 2025 14:54:17 +0100
|
||||
|
||||
|
||||
@ -31,15 +31,23 @@ json.dump(yaml.safe_load(sys.stdin), sys.stdout, default=str)
|
||||
|
||||
|
||||
# Use jq to retrieve a list of --snap options from a given *signed* model.
|
||||
get_snaps_args()
|
||||
get_snaps_args_excluding()
|
||||
{
|
||||
local model=$1
|
||||
|
||||
shift
|
||||
|
||||
# The model is signed and is not valid YAML unless we get rid of the
|
||||
# signature. Here we assume the only blank line is before the signature.
|
||||
sed '/^$/,$d' -- "$model" \
|
||||
| yaml_to_json \
|
||||
| jq --raw-output '.snaps[] | "--snap=" + .name + "=" + .["default-channel"]'
|
||||
| jq --raw-output '.snaps[] | select(.name | IN($ARGS.positional[]) | not) | "--snap=" + .name + "=" + .["default-channel"]' --args "$@"
|
||||
}
|
||||
|
||||
# Use jq to retrieve a list of --snap options from a given *signed* model.
|
||||
get_snaps_args()
|
||||
{
|
||||
get_snaps_args_excluding "$1"
|
||||
}
|
||||
|
||||
_get_components_filtered()
|
||||
@ -140,13 +148,13 @@ else
|
||||
# allows us to override snaps. But we don't want all snaps from edge like
|
||||
# the dangerous model has, we want most of them from stable excluding:
|
||||
# * snapd (for TPM/FDE)
|
||||
# * snapd-desktop-integration (for TPM/FDE)
|
||||
# * firmware-updater (for TPM/FDE)
|
||||
# * desktop-security-center (for TPM/FDE)
|
||||
snaps_from_dangerous=(snapd firmware-updater desktop-security-center)
|
||||
snaps_from_dangerous=(snapd snapd-desktop-integration firmware-updater desktop-security-center)
|
||||
while read -r snap_arg; do
|
||||
prepare_args+=("$snap_arg")
|
||||
done < <(get_snaps_args "$stable_model" \
|
||||
| grep -v -F -e snapd -e firmware-updater -e desktop-security-center)
|
||||
done < <(get_snaps_args_excluding "$stable_model" "${snaps_from_dangerous[@]}")
|
||||
|
||||
for comp in $(get_components_excluding "$stable_model" "${snaps_from_dangerous[@]}"); do
|
||||
components+=("$comp")
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user