Merge pull request #428 from marineam/selinux

build_image: make building selinux policy optional
This commit is contained in:
Michael Marineau 2015-07-02 12:14:42 -07:00
commit 032a4d5fe6
3 changed files with 13 additions and 13 deletions

View File

@ -13,3 +13,14 @@ ARCH=$(get_board_arch ${BOARD})
# What cross-build are we targeting? # What cross-build are we targeting?
. "${BOARD_ROOT}/etc/portage/make.conf" . "${BOARD_ROOT}/etc/portage/make.conf"
# check if any of the given use flags are enabled for a pkg
pkg_use_enabled() {
local pkg="$1"
shift
# for every flag argument, turn it into `-e ^+flag` for grep
local grep_args="${@/#/-e ^+}"
equery-"${BOARD}" -q uses "${pkg}" | grep -q ${grep_args}
return $?
}

View File

@ -299,8 +299,8 @@ finish_image() {
fi fi
# Build the selinux policy # Build the selinux policy
if [[ "$BOARD" = amd64* ]]; then if pkg_use_enabled coreos-base/coreos selinux; then
sudo chroot ${root_fs_dir} bash -c "cd /usr/share/selinux/mcs; semodule -i *.pp" sudo chroot "${root_fs_dir}" bash -c "cd /usr/share/selinux/mcs && semodule -i *.pp"
fi fi
# We only need to disable rw and apply dm-verity in prod with a /usr partition # We only need to disable rw and apply dm-verity in prod with a /usr partition

View File

@ -168,17 +168,6 @@ if [[ ${#CROS_WORKON_PKGS[@]} -gt 0 ]]; then
) )
fi fi
# check if any of the given use flags are enabled for a pkg
pkg_use_enabled() {
local pkg="$1"
shift
# for every flag argument, turn it into `-e ^+flag` for grep
local grep_args="${@/#/-e ^+}"
equery-"${BOARD}" -q uses "${pkg}" | grep -q ${grep_args}
return $?
}
# Goo to attempt to resolve dependency loops on individual packages. # Goo to attempt to resolve dependency loops on individual packages.
# If this becomes insufficient we will need to move to a full multi-stage # If this becomes insufficient we will need to move to a full multi-stage
# bootstrap process like we do with the SDK via catalyst. # bootstrap process like we do with the SDK via catalyst.