Ensure $TMP_BUILD_DIR is actually created.

Previously if mktemp failed in function mk_build_dir, die was not
called.  The check for the exit code was actually checking that the
previous export statement completed successfully, not the call to
mktemp.

Change-Id: I477a2ce75c87c8167883ce7aa342e93c40770e29
This commit is contained in:
James Slagle 2013-07-31 14:26:05 -04:00
parent 5b37036c88
commit de6efe2b2c

View File

@ -24,8 +24,9 @@ function tmpfs_check() {
}
function mk_build_dir () {
export TMP_BUILD_DIR=$(mktemp -t -d --tmpdir=${TMP_DIR:-/tmp} image.XXXXXXXX)
TMP_BUILD_DIR=$(mktemp -t -d --tmpdir=${TMP_DIR:-/tmp} image.XXXXXXXX)
[ $? -eq 0 ] || die "Failed to create tmp directory"
export TMP_BUILD_DIR
if tmpfs_check ; then
sudo mount -t tmpfs tmpfs $TMP_BUILD_DIR
fi