mirror of
https://github.com/flatcar/scripts.git
synced 2026-05-04 11:51:14 +02:00
Merge pull request #208 from marineam/oem
Rework how OEM packages are installed
This commit is contained in:
commit
835cb59837
@ -227,20 +227,35 @@ setup_disk_image() {
|
||||
if [[ $(_get_vm_opt BOOT_KERNEL) -eq 0 ]]; then
|
||||
sudo mv "${SYSLINUX_DIR}/default.cfg.A" "${SYSLINUX_DIR}/default.cfg"
|
||||
fi
|
||||
|
||||
# The only filesystem after this point that may be modified is OEM
|
||||
# Note: it would be more logical for disk_util to mount things read-only
|
||||
# to begin with but I'm having trouble making that work reliably.
|
||||
# When mounting w/ ro the automatically allocated loop device will
|
||||
# also be configured as read-only. blockdev --setrw will change that
|
||||
# but io will start throwing errors so that clearly isn't sufficient.
|
||||
local mnt
|
||||
for mnt in $(findmnt -nrR -o target -T "${VM_TMP_ROOT}"); do
|
||||
if [[ "${mnt}" != */usr/share/oem ]]; then
|
||||
sudo mount -o remount,ro "${mnt}"
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
# If the current type defines a oem package install it to the given fs image.
|
||||
install_oem_package() {
|
||||
local oem_pkg=$(_get_vm_opt OEM_PACKAGE)
|
||||
local oem_mnt="${VM_TMP_ROOT}/usr/share/oem"
|
||||
local oem_tmp="${VM_TMP_DIR}/oem"
|
||||
|
||||
if [[ -z "${oem_pkg}" ]]; then
|
||||
return 0
|
||||
fi
|
||||
|
||||
info "Installing ${oem_pkg} to OEM partition"
|
||||
emerge-${BOARD} --root="${oem_mnt}" --root-deps=rdeps "${oem_pkg}"
|
||||
sudo rm -rf "${oem_mnt}/var" # clean out /var/pkg/db and friends
|
||||
emerge-${BOARD} --root="${oem_tmp}" \
|
||||
--root-deps=rdeps --usepkg --quiet "${oem_pkg}"
|
||||
sudo rsync -a "${oem_tmp}/usr/share/oem/" "${VM_TMP_ROOT}/usr/share/oem/"
|
||||
sudo rm -rf "${oem_tmp}"
|
||||
}
|
||||
|
||||
# Write the vm disk image to the target directory in the proper format
|
||||
|
||||
@ -63,12 +63,6 @@ DEFINE_boolean skip_chroot_upgrade "${FLAGS_FALSE}" \
|
||||
"Don't run the chroot upgrade automatically; use with care."
|
||||
DEFINE_boolean skip_toolchain_update "${FLAGS_FALSE}" \
|
||||
"Don't update toolchain automatically."
|
||||
DEFINE_boolean withdev "${FLAGS_TRUE}" \
|
||||
"Build useful developer friendly utilities."
|
||||
DEFINE_boolean withdebug "${FLAGS_TRUE}" \
|
||||
"Build debug versions of Chromium-OS-specific packages."
|
||||
DEFINE_boolean withtest "${FLAGS_TRUE}" \
|
||||
"Build packages required for testing."
|
||||
|
||||
# The --reuse_pkgs_from_local_boards flag tells Portage to share binary
|
||||
# packages between boards that are built locally, so that the total time
|
||||
@ -186,28 +180,6 @@ if [[ "${FLAGS_showoutput}" -eq "${FLAGS_TRUE}" && \
|
||||
EMERGE_FLAGS+=( --show-output )
|
||||
fi
|
||||
|
||||
if [[ "${FLAGS_withdebug}" -eq "${FLAGS_FALSE}" ]]; then
|
||||
export USE="${USE} -cros-debug"
|
||||
fi
|
||||
|
||||
# Figure out which packages we should be building.
|
||||
PACKAGES=( "$@" )
|
||||
if [[ $# -eq 0 ]]; then
|
||||
PACKAGES=( coreos-base/coreos )
|
||||
if [[ "${FLAGS_withdev}" -eq "${FLAGS_TRUE}" ]]; then
|
||||
PACKAGES+=( coreos-base/coreos-dev )
|
||||
fi
|
||||
fi
|
||||
|
||||
# Verify that all packages can be emerged from scratch, without any
|
||||
# backtracking. Only print the output if this step fails.
|
||||
info "Checking package dependencies are correct: ${PACKAGES[*]}"
|
||||
if ! OUTPUT=$(emerge-${FLAGS_board} -pe --backtrack=0 \
|
||||
"${PACKAGES[@]}" 2>&1); then
|
||||
printf "%s\n" "${OUTPUT}"
|
||||
die_notrace "emerge detected broken ebuilds. See error message above."
|
||||
fi
|
||||
|
||||
# Build cros_workon packages when they are changed.
|
||||
CROS_WORKON_PKGS=()
|
||||
if [ "${FLAGS_noworkon}" -eq "${FLAGS_FALSE}" ]; then
|
||||
@ -223,7 +195,7 @@ if [[ ${#CROS_WORKON_PKGS[@]} -gt 0 ]]; then
|
||||
fi
|
||||
|
||||
info "Merging board packages now"
|
||||
sudo -E "${EMERGE_CMD[@]}" "${EMERGE_FLAGS[@]}" "${PACKAGES[@]}"
|
||||
sudo -E "${EMERGE_CMD[@]}" "${EMERGE_FLAGS[@]}" coreos-devel/board-packages
|
||||
|
||||
info "Checking build root"
|
||||
test_image_content "${BOARD_ROOT}"
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user