From 9cb0d0c8e5b6e5190d699cc6ec7b950dd8da55e1 Mon Sep 17 00:00:00 2001 From: Daniel Zatovic Date: Mon, 7 Apr 2025 12:12:56 +0200 Subject: [PATCH] sysext: allow for architecture-specific sysexts --- build_library/prod_image_util.sh | 24 +++++++++++++++++------- 1 file changed, 17 insertions(+), 7 deletions(-) diff --git a/build_library/prod_image_util.sh b/build_library/prod_image_util.sh index 0245b477b1..d7e77ff3a5 100755 --- a/build_library/prod_image_util.sh +++ b/build_library/prod_image_util.sh @@ -213,20 +213,30 @@ create_prod_sysexts() { local image_name="$1" local image_sysext_base="${image_name%.bin}_sysext.squashfs" for sysext in "${EXTRA_SYSEXTS[@]}"; do - local name="flatcar-${sysext%%|*}" - local pkgs_and_useflags="${sysext#*|}" - local pkgs="${pkgs_and_useflags%%|*}" + local name pkgs useflags arches + IFS="|" read -r name pkgs useflags arches <<< "$sysext" + name="flatcar-$name" local pkg_array=(${pkgs//,/ }) - local useflags="" - if [[ "$pkgs_and_useflags" == *\|* ]]; then - useflags="${pkgs_and_useflags#*|}" - fi + local arch_array=(${arches//,/ }) local useflags_array=(${useflags//,/ }) local mangle_script="${BUILD_LIBRARY_DIR}/sysext_mangle_${name}" if [[ ! -x "${mangle_script}" ]]; then mangle_script= fi + + if [[ -n "$arches" ]]; then + should_skip=1 + for arch in "${arch_array[@]}"; do + if [[ $arch == "$ARCH" ]]; then + should_skip=0 + fi + done + if [[ $should_skip -eq 1 ]]; then + continue + fi + fi + sudo rm -f "${BUILD_DIR}/${name}.raw" \ "${BUILD_DIR}/flatcar-test-update-${name}.gz" \ "${BUILD_DIR}/${name}_*"