mirror of
https://github.com/flatcar/scripts.git
synced 2025-09-25 23:51:07 +02:00
build_image: only dump debug info when failing
If the image happens to be full but didn't run out of space, then don't dump the filesystem debug output. Only do it when we're erroring out. BUG=chromium-os:35083 TEST=`./build_image --board=x86-alex` still worked Change-Id: Ia585b43273cc891aaaebe0fe08aedec78c91055e Reviewed-on: https://gerrit.chromium.org/gerrit/35885 Reviewed-by: David James <davidjames@chromium.org> Reviewed-by: Peter Mayo <petermayo@chromium.org> Commit-Ready: Mike Frysinger <vapier@chromium.org> Tested-by: Mike Frysinger <vapier@chromium.org>
This commit is contained in:
parent
a884512e93
commit
26c4241341
@ -5,18 +5,22 @@
|
||||
. "${SRC_ROOT}/platform/dev/toolchain_utils.sh" || exit 1
|
||||
|
||||
cleanup_mounts() {
|
||||
local prev_ret=$?
|
||||
|
||||
# Disable die on error.
|
||||
set +e
|
||||
|
||||
# See if we ran out of space.
|
||||
local df=$(df -B 1M "${root_fs_dir}")
|
||||
if [[ ${df} == *100%* ]]; then
|
||||
error "Here are the biggest files (by disk usage):"
|
||||
# Send final output to stderr to match `error` behavior.
|
||||
sudo find "${root_fs_dir}" -xdev -type f -printf '%b %P\n' | \
|
||||
awk '$1 > 16 { $1 = $1 * 512; print }' | sort -n | tail -100 1>&2
|
||||
error "Target image has run out of space:"
|
||||
error "${df}"
|
||||
# See if we ran out of space. Only show if we errored out via a trap.
|
||||
if [[ ${prev_ret} -ne 0 ]]; then
|
||||
local df=$(df -B 1M "${root_fs_dir}")
|
||||
if [[ ${df} == *100%* ]]; then
|
||||
error "Here are the biggest files (by disk usage):"
|
||||
# Send final output to stderr to match `error` behavior.
|
||||
sudo find "${root_fs_dir}" -xdev -type f -printf '%b %P\n' | \
|
||||
awk '$1 > 16 { $1 = $1 * 512; print }' | sort -n | tail -100 1>&2
|
||||
error "Target image has run out of space:"
|
||||
error "${df}"
|
||||
fi
|
||||
fi
|
||||
|
||||
echo "Cleaning up mounts"
|
||||
|
Loading…
x
Reference in New Issue
Block a user