From 2f214ff3e833e45907dadf3f7be0ed835a745171 Mon Sep 17 00:00:00 2001 From: Ian Wienand Date: Thu, 7 Apr 2016 08:11:39 +1000 Subject: [PATCH] Turn of tracing around du invocations We don't want the output of "du" run on the image spammed into the logs with "set -x". Swizzle it off around the sensitive commands. Change-Id: I687e77275f9a49e7934211835aba8610e88cdca6 --- bin/disk-image-create | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/bin/disk-image-create b/bin/disk-image-create index b14232d33..baf607406 100755 --- a/bin/disk-image-create +++ b/bin/disk-image-create @@ -323,21 +323,24 @@ fi unmount_image mv $TMP_BUILD_DIR/mnt $TMP_BUILD_DIR/built +# save xtrace state, as we want to turn it off to avoid spamming the +# logs with du output below. +xtrace=$(set +o | grep xtrace) + if [ -n "$DIB_IMAGE_SIZE" ]; then du_size=$(echo "$DIB_IMAGE_SIZE" | awk '{printf("%d\n",$1 * 1024 *1024)}') else + set +o xtrace du_output=$(sudo du -a -c -x ${TMP_BUILD_DIR}/built) - # the last line is the total size from "-c". # scale this by 0.6 to create a slightly bigger image du_size=$(echo "$du_output" | tail -n1 | cut -f1 | \ awk '{print int($1 / 0.6)}') + $xtrace fi if [[ "${DIB_SHOW_IMAGE_USAGE:-0}" != 0 ]]; then - xtrace=$(set +o | grep xtrace) set +o xtrace - if [ -z "$du_output" ]; then du_output=$(sudo du -a -c -x ${TMP_BUILD_DIR}/built) fi