setup-env: only allow slaves with large amounts of RAM to mount tmpfs

Signed-off-by: Derek Straka <derek@asterius.io>
This commit is contained in:
Derek Straka
2016-11-30 11:13:18 -05:00
parent b828ccaefe
commit 3d70f56ae7
2 changed files with 10 additions and 2 deletions

View File

@@ -1,5 +1,8 @@
#!/bin/bash -e
sudo umount build
# Only attempt to unmount if the directory is already mounted
if mountpoint -q `pwd`/build; then
sudo umount build
fi
exit 0

View File

@@ -2,6 +2,11 @@
mkdir -p build
sudo mount -t tmpfs -o size=64G,mode=755,uid=${UID} tmpfs build
total_mem=`grep MemTotal /proc/meminfo | awk '{print $2}'`
# Only have the slaves with large amounts of RAM mount the tmpfs
if [ "$total_mem" -ge "67108864" ]; then
sudo mount -t tmpfs -o size=64G,mode=755,uid=${UID} tmpfs build
fi
exit 0