From 1b92a11268d6c632b8223d77e2300689796f1a77 Mon Sep 17 00:00:00 2001 From: Ben Nemec Date: Wed, 27 May 2015 09:11:13 -0500 Subject: [PATCH] Don't log tmpfs message during cleanup By that point in the build it isn't generally useful, and it causes confusion when builds fail because people think that's the error. Change-Id: I26dee4ac0947b71a4a065ef6c5a18103e7df6667 --- lib/common-functions | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/lib/common-functions b/lib/common-functions index 795833a7..20768f30 100644 --- a/lib/common-functions +++ b/lib/common-functions @@ -15,6 +15,7 @@ # under the License. function tmpfs_check() { + local echo_message=${1:-1} [ "$DIB_NO_TMPFS" == "0" ] || return 1 [ -r /proc/meminfo ] || return 1 total_kB=$(awk '/^MemTotal/ { print $2 }' /proc/meminfo) @@ -22,7 +23,9 @@ function tmpfs_check() { # the double of the minimum tmpfs size required RAM_NEEDED=$(($DIB_MIN_TMPFS * 2)) [ $total_kB -lt $(($RAM_NEEDED*1024*1024)) ] || return 0 - echo "WARNING: Not enough RAM to use tmpfs for build. Using ${TMP_DIR:-/tmp}. ($total_kB < ${RAM_NEEDED}G)" + if [ $echo_message == '1' ]; then + echo "WARNING: Not enough RAM to use tmpfs for build. Using ${TMP_DIR:-/tmp}. ($total_kB < ${RAM_NEEDED}G)" + fi return 1 } @@ -142,7 +145,7 @@ function mount_qcow_image() { function cleanup_dirs () { sudo rm -rf $TMP_BUILD_DIR/built sudo rm -rf $TMP_BUILD_DIR/mnt - if tmpfs_check ; then + if tmpfs_check 0; then sudo umount -f $TMP_BUILD_DIR $TMP_IMAGE_DIR || true fi rm -rf --one-file-system $TMP_BUILD_DIR $TMP_IMAGE_DIR