mirror of
https://github.com/flatcar/scripts.git
synced 2025-12-07 18:31:54 +01:00
Fix message funcs to use $@ and fix callers to use it correctly.
Fixed all callers in my big CL to no longer have to wrap poorly using \ and start from the beginning of the next line but rather pass in an array of args i.e. info "tacos" " are" " delicious". BUG=None TEST=Ran to see the errors in parse_build_image and manual eyeing. Change-Id: I5eac8a5ae7a8d314dbc4e821ee33cf88213711d0 Reviewed-on: https://gerrit.chromium.org/gerrit/10823 Commit-Ready: Chris Sosa <sosa@chromium.org> Reviewed-by: Chris Sosa <sosa@chromium.org> Tested-by: Chris Sosa <sosa@chromium.org>
This commit is contained in:
parent
b0f5732449
commit
131eaf5667
@ -116,8 +116,8 @@ fi
|
||||
|
||||
if [ $((FLAGS_rootfs_size + FLAGS_rootfs_hash_pad)) -gt \
|
||||
${FLAGS_rootfs_partition_size} ] ; then
|
||||
die "rootfs ($((FLAGS_rootfs_size + FLAGS_rootfs_hash_pad)) MiB) is \
|
||||
bigger than partition (${FLAGS_rootfs_partition_size} MiB)."
|
||||
die "rootfs ($((FLAGS_rootfs_size + FLAGS_rootfs_hash_pad)) MiB) is" \
|
||||
"bigger than partition (${FLAGS_rootfs_partition_size} MiB)."
|
||||
fi
|
||||
|
||||
# If we are creating a developer image, also create a pristine image with a
|
||||
@ -179,8 +179,8 @@ create_base_image ${PRISTINE_IMAGE_NAME}
|
||||
BOOT_FLAG=
|
||||
if [ ${FLAGS_factory_install} -eq ${FLAGS_TRUE} ]; then
|
||||
BOOT_FLAG="-b 1" # BOOT_FLAG_DEVELOPER value defined in load_kernel_fw.h
|
||||
info "--factory_install set, pass BOOT_FLAG_DEVELOPER flag to \
|
||||
load_kernel_test"
|
||||
info "--factory_install set, pass BOOT_FLAG_DEVELOPER flag to" \
|
||||
"load_kernel_test"
|
||||
fi
|
||||
|
||||
# Verify pristine image if we built it.
|
||||
|
||||
@ -159,8 +159,8 @@ create_base_image() {
|
||||
LIBC_PATH="${PKGDIR}/cross-${CHOST}/${LIBC_TAR}"
|
||||
|
||||
if ! [[ -e ${LIBC_PATH} ]]; then
|
||||
die "${LIBC_PATH} does not exist. Try running ./setup_board --board=\
|
||||
${BOARD} to update the version of libc installed on that board."
|
||||
die "${LIBC_PATH} does not exist. Try running ./setup_board" \
|
||||
"--board=${BOARD} to update the version of libc installed on that board."
|
||||
fi
|
||||
|
||||
sudo tar jxpf "${LIBC_PATH}" -C "${ROOT_FS_DIR}" ./usr/${CHOST} \
|
||||
|
||||
@ -81,8 +81,8 @@ parse_build_image_args() {
|
||||
if should_build_image ${CHROMEOS_FACTORY_INSTALL_SHIM_NAME}; then
|
||||
for image in ${CHROMEOS_BASE_IMAGE_NAME} ${CHROMEOS_DEVELOPER_IMAGE_NAME}\
|
||||
${CHROMEOS_TEST_IMAGE_NAME} ${CHROMEOS_FACTORY_TEST_IMAGE_NAME}; do
|
||||
should_build_image ${image} && die \
|
||||
"Can't build both $image and ${CHROMEOS_FACTORY_INSTALL_SHIM_NAME}."
|
||||
should_build_image ${image} && die "Can't build both $image" \
|
||||
"and ${CHROMEOS_FACTORY_INSTALL_SHIM_NAME}."
|
||||
done
|
||||
FLAGS_withdev=${FLAGS_FALSE}
|
||||
FLAGS_test=${FLAGS_FALSE}
|
||||
@ -93,35 +93,35 @@ parse_build_image_args() {
|
||||
# Legacy method for tweaking flags to do the right thing.
|
||||
if [ ${FLAGS_factory_install} -eq ${FLAGS_TRUE} ]; then
|
||||
if [ ${FLAGS_factory} -eq ${FLAGS_TRUE} ]; then
|
||||
info "Incompatible flags: --factory and --factory_install cannot both \
|
||||
be set to True. Resetting --factory to False."
|
||||
info "Incompatible flags: --factory and --factory_install cannot both" \
|
||||
"be set to True. Resetting --factory to False."
|
||||
FLAGS_factory=${FLAGS_FALSE}
|
||||
fi
|
||||
if [ ${FLAGS_test} -eq ${FLAGS_TRUE} ]; then
|
||||
info "Incompatible flags: --test and --factory_install cannot both be \
|
||||
set to True. Resetting --test to False."
|
||||
info "Incompatible flags: --test and --factory_install cannot both be" \
|
||||
"set to True. Resetting --test to False."
|
||||
FLAGS_test=${FLAGS_FALSE}
|
||||
fi
|
||||
# Disable --withdev flag when --factory_install is set to True. Otherwise,
|
||||
# the dev image produced will be based on install shim, rather than a
|
||||
# pristine image.
|
||||
if [ ${FLAGS_withdev} -eq ${FLAGS_TRUE} ]; then
|
||||
info "Incompatible flags: --withdev and --factory_install cannot both \
|
||||
be set to True. Resetting --withdev to False."
|
||||
info "Incompatible flags: --withdev and --factory_install cannot both" \
|
||||
"be set to True. Resetting --withdev to False."
|
||||
FLAGS_withdev=${FLAGS_FALSE}
|
||||
fi
|
||||
fi
|
||||
if [ ${FLAGS_factory} -eq ${FLAGS_TRUE} ]; then
|
||||
if [ ${FLAGS_test} -eq ${FLAGS_FALSE} ]; then
|
||||
info "Incompatible flags: --factory implies --test. Resetting --test \
|
||||
to True."
|
||||
info "Incompatible flags: --factory implies --test. Resetting --test" \
|
||||
"to True."
|
||||
FLAGS_test=${FLAGS_TRUE}
|
||||
fi
|
||||
fi
|
||||
if [ ${FLAGS_test} -eq ${FLAGS_TRUE} ]; then
|
||||
if [ ${FLAGS_withdev} -eq ${FLAGS_FALSE} ]; then
|
||||
info "Incompatible flags: --test implies --withdev. Resetting \
|
||||
--withdev to True."
|
||||
info "Incompatible flags: --test implies --withdev. Resetting" \
|
||||
"--withdev to True."
|
||||
FLAGS_withdev=${FLAGS_TRUE}
|
||||
fi
|
||||
fi
|
||||
|
||||
@ -321,19 +321,19 @@ function check_flags_only_and_allow_null_arg {
|
||||
}
|
||||
|
||||
function info {
|
||||
echo -e >&2 "${V_BOLD_GREEN}INFO ${CROS_LOG_PREFIX:-""}: $1${V_VIDOFF}"
|
||||
echo -e >&2 "${V_BOLD_GREEN}INFO ${CROS_LOG_PREFIX:-""}: $@${V_VIDOFF}"
|
||||
}
|
||||
|
||||
function warn {
|
||||
echo -e >&2 "${V_BOLD_YELLOW}WARNING ${CROS_LOG_PREFIX:-""}: $1${V_VIDOFF}"
|
||||
echo -e >&2 "${V_BOLD_YELLOW}WARNING ${CROS_LOG_PREFIX:-""}: $@${V_VIDOFF}"
|
||||
}
|
||||
|
||||
function error {
|
||||
echo -e >&2 "${V_BOLD_RED}ERROR ${CROS_LOG_PREFIX:-""}: $1${V_VIDOFF}"
|
||||
echo -e >&2 "${V_BOLD_RED}ERROR ${CROS_LOG_PREFIX:-""}: $@${V_VIDOFF}"
|
||||
}
|
||||
|
||||
function die {
|
||||
error "$1"
|
||||
error "$@"
|
||||
exit 1
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user