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
This commit is contained in:
Ben Nemec 2015-05-27 09:11:13 -05:00
parent 80057470a6
commit 1b92a11268

View File

@ -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