33# Use of this source code is governed by a BSD-style license that can be
44# found in the LICENSE file.
55
6+ source " ${BUILD_LIBRARY_DIR} /pkg_util.sh" || exit 1
7+
68# Lookup the current version of a binary package, downloading it if needed.
79# Usage: get_binary_pkg some-pkg/name
810# Prints: some-pkg/name-1.2.3
@@ -222,6 +224,14 @@ create_prod_tar() {
222224create_prod_sysexts () {
223225 local image_name=" $1 "
224226 local image_sysext_base=" ${image_name% .bin} _sysext.squashfs"
227+ local -a extra_args
228+
229+ local selinux=' '
230+ if is_selinux_enabled " ${BOARD} " ; then
231+ selinux=x
232+ fi
233+
234+ local sysext
225235 for sysext in " ${EXTRA_SYSEXTS[@]} " ; do
226236 local name pkgs useflags arches
227237 IFS=" |" read -r name pkgs useflags arches <<< " $sysext"
@@ -230,9 +240,13 @@ create_prod_sysexts() {
230240 local arch_array=(${arches// ,/ } )
231241 local useflags_array=(${useflags// ,/ } )
232242
243+ extra_args=()
233244 local mangle_script=" ${BUILD_LIBRARY_DIR} /sysext_mangle_${name} "
234- if [[ ! -x " ${mangle_script} " ]]; then
235- mangle_script=
245+ if [[ -x " ${mangle_script} " ]]; then
246+ extra_args+=( --manglefs_script=" ${mangle_script} " )
247+ fi
248+ if [[ -n ${selinux} ]]; then
249+ extra_args+=( --selinux )
236250 fi
237251
238252 if [[ -n " $arches " ]]; then
@@ -248,8 +262,8 @@ create_prod_sysexts() {
248262 fi
249263
250264 sudo rm -f " ${BUILD_DIR} /${name} .raw" \
251- " ${BUILD_DIR} /flatcar-test-update-${name} .gz" \
252- " ${BUILD_DIR} /${name} _*"
265+ " ${BUILD_DIR} /flatcar-test-update-${name} .gz" \
266+ " ${BUILD_DIR} /${name} _*"
253267 # we use -E to pass the USE flags, but also MODULES_SIGN variables
254268 #
255269 # The --install_root_basename="${name}-extra-sysext-rootfs" flag
@@ -260,8 +274,8 @@ create_prod_sysexts() {
260274 --squashfs_base=" ${BUILD_DIR} /${image_sysext_base} " \
261275 --image_builddir=" ${BUILD_DIR} " \
262276 --install_root_basename=" ${name} -extra-sysext-rootfs" \
263- ${mangle_script: +--manglefs_script=${mangle_script} } \
264277 --forbidden_packages=' sec-policy/selinux-.*;selinux policy packages must be in base image' \
278+ " ${extra_args[@]} " \
265279 " ${name} " " ${pkg_array[@]} "
266280 delta_generator \
267281 -private_key " /usr/share/update_engine/update-payload-key.key.pem" \
0 commit comments