mirror of
https://github.com/flatcar/scripts.git
synced 2025-11-16 16:12:00 +01:00
fix(make_chroot.sh): Remove duplicate chroot toolchain setup code.
Instead of handling toolchain packages in make_chroot and telling update_chroot to skip the toolchains just depend on update_chroot to do it properly. Reduces our code duplication by a tiny but worthwhile bit.
This commit is contained in:
parent
f25b84973e
commit
c5c5696c8b
@ -449,28 +449,8 @@ fi
|
|||||||
# Add version of $STAGE3 for update checks.
|
# Add version of $STAGE3 for update checks.
|
||||||
echo STAGE3=$STAGE3 > $CHROOT_STATE
|
echo STAGE3=$STAGE3 > $CHROOT_STATE
|
||||||
|
|
||||||
info "Updating portage"
|
|
||||||
early_enter_chroot emerge -uNv --quiet portage
|
|
||||||
|
|
||||||
# Enable git terminal prompt
|
|
||||||
early_enter_chroot eselect bashcomp enable --global git-prompt
|
|
||||||
|
|
||||||
info "Updating host toolchain"
|
|
||||||
early_enter_chroot $EMERGE_CMD -uNv crossdev
|
|
||||||
TOOLCHAIN_ARGS=( --deleteold )
|
|
||||||
if [[ ${FLAGS_usepkg} -eq ${FLAGS_FALSE} ]]; then
|
|
||||||
TOOLCHAIN_ARGS+=( --nousepkg )
|
|
||||||
elif [[ ${FLAGS_getbinpkg} -eq ${FLAGS_FALSE} ]]; then
|
|
||||||
TOOLCHAIN_ARGS+=( --nogetbinpkg )
|
|
||||||
fi
|
|
||||||
# Note: early_enter_chroot executes as root.
|
|
||||||
early_enter_chroot "${CHROOT_TRUNK_DIR}/chromite/bin/cros_setup_toolchains" \
|
|
||||||
--hostonly "${TOOLCHAIN_ARGS[@]}"
|
|
||||||
|
|
||||||
# Update chroot.
|
# Update chroot.
|
||||||
# Skip toolchain update because it already happened above, and the chroot is
|
UPDATE_ARGS=()
|
||||||
# not ready to emerge all cross toolchains.
|
|
||||||
UPDATE_ARGS=( --skip_toolchain_update )
|
|
||||||
if [[ ${FLAGS_usepkg} -eq ${FLAGS_TRUE} ]]; then
|
if [[ ${FLAGS_usepkg} -eq ${FLAGS_TRUE} ]]; then
|
||||||
UPDATE_ARGS+=( --usepkg )
|
UPDATE_ARGS+=( --usepkg )
|
||||||
if [[ ${FLAGS_getbinpkg} -eq ${FLAGS_TRUE} ]]; then
|
if [[ ${FLAGS_getbinpkg} -eq ${FLAGS_TRUE} ]]; then
|
||||||
@ -491,17 +471,14 @@ if [[ "${FLAGS_jobs}" -ne -1 ]]; then
|
|||||||
fi
|
fi
|
||||||
enter_chroot "${CHROOT_TRUNK_DIR}/src/scripts/update_chroot" "${UPDATE_ARGS[@]}"
|
enter_chroot "${CHROOT_TRUNK_DIR}/src/scripts/update_chroot" "${UPDATE_ARGS[@]}"
|
||||||
|
|
||||||
|
# Enable git terminal prompt
|
||||||
|
early_enter_chroot eselect bashcomp enable --global git-prompt
|
||||||
|
|
||||||
CHROOT_EXAMPLE_OPT=""
|
CHROOT_EXAMPLE_OPT=""
|
||||||
if [[ "$FLAGS_chroot" != "$DEFAULT_CHROOT_DIR" ]]; then
|
if [[ "$FLAGS_chroot" != "$DEFAULT_CHROOT_DIR" ]]; then
|
||||||
CHROOT_EXAMPLE_OPT="--chroot=$FLAGS_chroot"
|
CHROOT_EXAMPLE_OPT="--chroot=$FLAGS_chroot"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# As a final pass, build all desired cross-toolchains.
|
|
||||||
info "Updating toolchains"
|
|
||||||
|
|
||||||
enter_chroot sudo -E "${CHROOT_TRUNK_DIR}/chromite/bin/cros_setup_toolchains" \
|
|
||||||
"${TOOLCHAIN_ARGS[@]}"
|
|
||||||
|
|
||||||
command_completed
|
command_completed
|
||||||
|
|
||||||
cat <<EOF
|
cat <<EOF
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user