mirror of
https://github.com/flatcar/scripts.git
synced 2025-12-08 19:02:10 +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 \
|
if [ $((FLAGS_rootfs_size + FLAGS_rootfs_hash_pad)) -gt \
|
||||||
${FLAGS_rootfs_partition_size} ] ; then
|
${FLAGS_rootfs_partition_size} ] ; then
|
||||||
die "rootfs ($((FLAGS_rootfs_size + FLAGS_rootfs_hash_pad)) MiB) is \
|
die "rootfs ($((FLAGS_rootfs_size + FLAGS_rootfs_hash_pad)) MiB) is" \
|
||||||
bigger than partition (${FLAGS_rootfs_partition_size} MiB)."
|
"bigger than partition (${FLAGS_rootfs_partition_size} MiB)."
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# If we are creating a developer image, also create a pristine image with a
|
# 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=
|
BOOT_FLAG=
|
||||||
if [ ${FLAGS_factory_install} -eq ${FLAGS_TRUE} ]; then
|
if [ ${FLAGS_factory_install} -eq ${FLAGS_TRUE} ]; then
|
||||||
BOOT_FLAG="-b 1" # BOOT_FLAG_DEVELOPER value defined in load_kernel_fw.h
|
BOOT_FLAG="-b 1" # BOOT_FLAG_DEVELOPER value defined in load_kernel_fw.h
|
||||||
info "--factory_install set, pass BOOT_FLAG_DEVELOPER flag to \
|
info "--factory_install set, pass BOOT_FLAG_DEVELOPER flag to" \
|
||||||
load_kernel_test"
|
"load_kernel_test"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Verify pristine image if we built it.
|
# Verify pristine image if we built it.
|
||||||
|
|||||||
@ -159,8 +159,8 @@ create_base_image() {
|
|||||||
LIBC_PATH="${PKGDIR}/cross-${CHOST}/${LIBC_TAR}"
|
LIBC_PATH="${PKGDIR}/cross-${CHOST}/${LIBC_TAR}"
|
||||||
|
|
||||||
if ! [[ -e ${LIBC_PATH} ]]; then
|
if ! [[ -e ${LIBC_PATH} ]]; then
|
||||||
die "${LIBC_PATH} does not exist. Try running ./setup_board --board=\
|
die "${LIBC_PATH} does not exist. Try running ./setup_board" \
|
||||||
${BOARD} to update the version of libc installed on that board."
|
"--board=${BOARD} to update the version of libc installed on that board."
|
||||||
fi
|
fi
|
||||||
|
|
||||||
sudo tar jxpf "${LIBC_PATH}" -C "${ROOT_FS_DIR}" ./usr/${CHOST} \
|
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
|
if should_build_image ${CHROMEOS_FACTORY_INSTALL_SHIM_NAME}; then
|
||||||
for image in ${CHROMEOS_BASE_IMAGE_NAME} ${CHROMEOS_DEVELOPER_IMAGE_NAME}\
|
for image in ${CHROMEOS_BASE_IMAGE_NAME} ${CHROMEOS_DEVELOPER_IMAGE_NAME}\
|
||||||
${CHROMEOS_TEST_IMAGE_NAME} ${CHROMEOS_FACTORY_TEST_IMAGE_NAME}; do
|
${CHROMEOS_TEST_IMAGE_NAME} ${CHROMEOS_FACTORY_TEST_IMAGE_NAME}; do
|
||||||
should_build_image ${image} && die \
|
should_build_image ${image} && die "Can't build both $image" \
|
||||||
"Can't build both $image and ${CHROMEOS_FACTORY_INSTALL_SHIM_NAME}."
|
"and ${CHROMEOS_FACTORY_INSTALL_SHIM_NAME}."
|
||||||
done
|
done
|
||||||
FLAGS_withdev=${FLAGS_FALSE}
|
FLAGS_withdev=${FLAGS_FALSE}
|
||||||
FLAGS_test=${FLAGS_FALSE}
|
FLAGS_test=${FLAGS_FALSE}
|
||||||
@ -93,35 +93,35 @@ parse_build_image_args() {
|
|||||||
# Legacy method for tweaking flags to do the right thing.
|
# Legacy method for tweaking flags to do the right thing.
|
||||||
if [ ${FLAGS_factory_install} -eq ${FLAGS_TRUE} ]; then
|
if [ ${FLAGS_factory_install} -eq ${FLAGS_TRUE} ]; then
|
||||||
if [ ${FLAGS_factory} -eq ${FLAGS_TRUE} ]; then
|
if [ ${FLAGS_factory} -eq ${FLAGS_TRUE} ]; then
|
||||||
info "Incompatible flags: --factory and --factory_install cannot both \
|
info "Incompatible flags: --factory and --factory_install cannot both" \
|
||||||
be set to True. Resetting --factory to False."
|
"be set to True. Resetting --factory to False."
|
||||||
FLAGS_factory=${FLAGS_FALSE}
|
FLAGS_factory=${FLAGS_FALSE}
|
||||||
fi
|
fi
|
||||||
if [ ${FLAGS_test} -eq ${FLAGS_TRUE} ]; then
|
if [ ${FLAGS_test} -eq ${FLAGS_TRUE} ]; then
|
||||||
info "Incompatible flags: --test and --factory_install cannot both be \
|
info "Incompatible flags: --test and --factory_install cannot both be" \
|
||||||
set to True. Resetting --test to False."
|
"set to True. Resetting --test to False."
|
||||||
FLAGS_test=${FLAGS_FALSE}
|
FLAGS_test=${FLAGS_FALSE}
|
||||||
fi
|
fi
|
||||||
# Disable --withdev flag when --factory_install is set to True. Otherwise,
|
# Disable --withdev flag when --factory_install is set to True. Otherwise,
|
||||||
# the dev image produced will be based on install shim, rather than a
|
# the dev image produced will be based on install shim, rather than a
|
||||||
# pristine image.
|
# pristine image.
|
||||||
if [ ${FLAGS_withdev} -eq ${FLAGS_TRUE} ]; then
|
if [ ${FLAGS_withdev} -eq ${FLAGS_TRUE} ]; then
|
||||||
info "Incompatible flags: --withdev and --factory_install cannot both \
|
info "Incompatible flags: --withdev and --factory_install cannot both" \
|
||||||
be set to True. Resetting --withdev to False."
|
"be set to True. Resetting --withdev to False."
|
||||||
FLAGS_withdev=${FLAGS_FALSE}
|
FLAGS_withdev=${FLAGS_FALSE}
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
if [ ${FLAGS_factory} -eq ${FLAGS_TRUE} ]; then
|
if [ ${FLAGS_factory} -eq ${FLAGS_TRUE} ]; then
|
||||||
if [ ${FLAGS_test} -eq ${FLAGS_FALSE} ]; then
|
if [ ${FLAGS_test} -eq ${FLAGS_FALSE} ]; then
|
||||||
info "Incompatible flags: --factory implies --test. Resetting --test \
|
info "Incompatible flags: --factory implies --test. Resetting --test" \
|
||||||
to True."
|
"to True."
|
||||||
FLAGS_test=${FLAGS_TRUE}
|
FLAGS_test=${FLAGS_TRUE}
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
if [ ${FLAGS_test} -eq ${FLAGS_TRUE} ]; then
|
if [ ${FLAGS_test} -eq ${FLAGS_TRUE} ]; then
|
||||||
if [ ${FLAGS_withdev} -eq ${FLAGS_FALSE} ]; then
|
if [ ${FLAGS_withdev} -eq ${FLAGS_FALSE} ]; then
|
||||||
info "Incompatible flags: --test implies --withdev. Resetting \
|
info "Incompatible flags: --test implies --withdev. Resetting" \
|
||||||
--withdev to True."
|
"--withdev to True."
|
||||||
FLAGS_withdev=${FLAGS_TRUE}
|
FLAGS_withdev=${FLAGS_TRUE}
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|||||||
@ -321,19 +321,19 @@ function check_flags_only_and_allow_null_arg {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function info {
|
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 {
|
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 {
|
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 {
|
function die {
|
||||||
error "$1"
|
error "$@"
|
||||||
exit 1
|
exit 1
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user