mirror of
https://github.com/flatcar/scripts.git
synced 2026-05-04 19:56:32 +02:00
image_to_vm.sh: avoid subshells
There is a bug in bash where BASH_COMMAND is not correct when an error is hit in a subshell (it retains the command run *before* the subshell). Since this has confused a few people using image_to_vm.sh so far, drop the use of subshells in this file. They weren't necessary in the first place so it isn't like we're losing anything. URL: http://lists.gnu.org/archive/html/bug-bash/2012-08/msg00052.html BUG=None TEST=`./image_to_vm.sh --board=x86-alex --from=../build/images/x86-alex/latest` still works TEST=`rm ../build/images/x86-alex/latest/chromiumos_image.bin && ./image_to_vm.sh --board=x86-alex --from=../build/images/x86-alex/latest/` reports correct line Change-Id: Iaa7560b4868128119a4f6223b54020611f203635 Reviewed-on: https://gerrit.chromium.org/gerrit/31135 Reviewed-by: Brian Harring <ferringb@chromium.org> Commit-Ready: Mike Frysinger <vapier@chromium.org> Tested-by: Mike Frysinger <vapier@chromium.org>
This commit is contained in:
parent
4d21a2926a
commit
919bf0c5b8
@ -69,8 +69,8 @@ if [ -z "${FLAGS_board}" ] ; then
|
||||
fi
|
||||
|
||||
if [ "${FLAGS_full}" -eq "${FLAGS_TRUE}" ] && \
|
||||
( [[ ${FLAGS_vdisk_size} < ${MIN_VDISK_SIZE_FULL} ]] || \
|
||||
[[ ${FLAGS_statefulfs_size} < ${MIN_STATEFUL_FS_SIZE_FULL} ]]); then
|
||||
[[ ${FLAGS_vdisk_size} < ${MIN_VDISK_SIZE_FULL} || \
|
||||
${FLAGS_statefulfs_size} < ${MIN_STATEFUL_FS_SIZE_FULL} ]]; then
|
||||
warn "Disk is too small for full, using minimum: vdisk size equal to \
|
||||
${MIN_VDISK_SIZE_FULL} and statefulfs size equal to \
|
||||
${MIN_STATEFUL_FS_SIZE_FULL}."
|
||||
@ -113,8 +113,9 @@ FLAGS_to=`eval readlink -f $FLAGS_to`
|
||||
|
||||
# Split apart the partitions and make some new ones
|
||||
TEMP_DIR=$(mktemp -d)
|
||||
(cd "${TEMP_DIR}" &&
|
||||
"${FLAGS_from}/unpack_partitions.sh" "${SRC_IMAGE}")
|
||||
pushd "${TEMP_DIR}" >/dev/null
|
||||
"${FLAGS_from}/unpack_partitions.sh" "${SRC_IMAGE}"
|
||||
popd >/dev/null
|
||||
|
||||
# Fix the kernel command line
|
||||
TEMP_ESP="${TEMP_DIR}"/part_12
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user