Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion build_image
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@ DEFINE_string developer_data "" \
"Insert a custom cloudinit file into the image."
DEFINE_string devcontainer_binhost "${DEFAULT_DEVCONTAINER_BINHOST}" \
"Override portage binhost configuration used in development container."
DEFINE_string oem_sysexts "everything!" \
"A comma-separated list of OEMs to build, by default build all the OEM sysexts. Used only if building OEM sysexts"

# include upload options
. "${BUILD_LIBRARY_DIR}/release_util.sh" || exit 1
Expand Down Expand Up @@ -193,7 +195,7 @@ if [[ "${SYSEXT}" -eq 1 ]]; then
create_prod_sysexts "${FLATCAR_PRODUCTION_IMAGE_NAME}"
fi
if [[ "${OEM_SYSEXT}" -eq 1 ]]; then
create_oem_sysexts "${FLATCAR_PRODUCTION_IMAGE_NAME}"
create_oem_sysexts "${FLATCAR_PRODUCTION_IMAGE_NAME}" "${FLAGS_oem_sysexts}"
fi

if [[ ${FLAGS_extract_update} -eq ${FLAGS_TRUE} ]]; then
Expand Down
15 changes: 14 additions & 1 deletion build_library/prod_image_util.sh
Original file line number Diff line number Diff line change
Expand Up @@ -276,13 +276,26 @@ create_prod_sysexts() {
}

create_oem_sysexts() {
local image_name="$1"
local image_name=${1}; shift
local requested_oem_sysexts_csv=${1}; shift
local image_sysext_base="${image_name%.bin}_sysext.squashfs"
local overlay_path
overlay_path=$(portageq get_repo_path / coreos-overlay)

local -a oem_sysexts
get_oem_sysext_matrix "${ARCH}" oem_sysexts
if [[ ${requested_oem_sysexts_csv} != 'everything!' ]]; then
local -a all_oems requested_oems invalid_oems
all_oems=( "${oem_sysexts[@]}" )
all_oems=( "${all_oems[@]%%|*}" )
all_oems=( "${all_oems[@]#oem-}" )
mapfile -t requested_oems <<<"${requested_oem_sysexts_csv//,/$'\n'}"
mapfile -t invalid_oems < <(comm -23 <(printf '%s\n' "${requested_oems[@]}" | sort -u) <(printf '%s\n' "${all_oems[@]}" | sort -u))
if [[ ${#invalid_oems[@]} -gt 0 ]]; then
die "Requested OEMs to build sysexts for are invalid: ${invalid_oems[*]}, valid OEMs are ${all_oems[*]}"
fi
mapfile -t oem_sysexts < <(printf '%s\n' "${oem_sysexts[@]}" | grep '^oem-\('"${requested_oem_sysexts_csv//,/'\|'}"'\)|')
fi

local sysext name metapkg useflags
for sysext in "${oem_sysexts[@]}"; do
Expand Down