Allow programs in the sandbox to write temp files.

This creates a tmp directory in the sandbox directory, and points
TMPDIR at it.  Allows writing files to that directory.

@jtauber @cpennington can you review?  I can help you understand the code if need be.