Merge "Don't log tmpfs message during cleanup"
This commit is contained in:
commit
7e04c4cc84
@ -15,6 +15,7 @@
|
|||||||
# under the License.
|
# under the License.
|
||||||
|
|
||||||
function tmpfs_check() {
|
function tmpfs_check() {
|
||||||
|
local echo_message=${1:-1}
|
||||||
[ "$DIB_NO_TMPFS" == "0" ] || return 1
|
[ "$DIB_NO_TMPFS" == "0" ] || return 1
|
||||||
[ -r /proc/meminfo ] || return 1
|
[ -r /proc/meminfo ] || return 1
|
||||||
total_kB=$(awk '/^MemTotal/ { print $2 }' /proc/meminfo)
|
total_kB=$(awk '/^MemTotal/ { print $2 }' /proc/meminfo)
|
||||||
@ -22,7 +23,9 @@ function tmpfs_check() {
|
|||||||
# the double of the minimum tmpfs size required
|
# the double of the minimum tmpfs size required
|
||||||
RAM_NEEDED=$(($DIB_MIN_TMPFS * 2))
|
RAM_NEEDED=$(($DIB_MIN_TMPFS * 2))
|
||||||
[ $total_kB -lt $(($RAM_NEEDED*1024*1024)) ] || return 0
|
[ $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
|
return 1
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -142,7 +145,7 @@ function mount_qcow_image() {
|
|||||||
function cleanup_dirs () {
|
function cleanup_dirs () {
|
||||||
sudo rm -rf $TMP_BUILD_DIR/built
|
sudo rm -rf $TMP_BUILD_DIR/built
|
||||||
sudo rm -rf $TMP_BUILD_DIR/mnt
|
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
|
sudo umount -f $TMP_BUILD_DIR $TMP_IMAGE_DIR || true
|
||||||
fi
|
fi
|
||||||
rm -rf --one-file-system $TMP_BUILD_DIR $TMP_IMAGE_DIR
|
rm -rf --one-file-system $TMP_BUILD_DIR $TMP_IMAGE_DIR
|
||||||
|
Loading…
Reference in New Issue
Block a user