In addition to what juan says, I'm a fan of providing the path to the tmp dir as a datastore option (with default to /tmp/random). This will require adding a `mkdir -p` call first to ensure the specified tmp dir exists on the target.