From e08f02aca7a9df2affbfe54d56bcb9c9e42b400d Mon Sep 17 00:00:00 2001 From: Jose Diaz-Gonzalez Date: Mon, 31 Aug 2015 15:17:04 -0400 Subject: [PATCH] Use a custom temporary directory for dokku-related files Also fix the trap call --- plugins/00_dokku-standard/commands | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/plugins/00_dokku-standard/commands b/plugins/00_dokku-standard/commands index b38ac9540..d2fd4736b 100755 --- a/plugins/00_dokku-standard/commands +++ b/plugins/00_dokku-standard/commands @@ -67,16 +67,18 @@ case "$1" in pluginhook pre-release-buildstep "$APP" pluginhook pre-release-buildpack "$APP" if [[ -n $(config_export global) ]]; then - TMPFILE=$(mktemp $DOKKU_ROOT/$APP/.dokku_config.XXXXXX) || dokku_log_fail "Cannot create temp file using mktemp in /tmp dir" - trap 'rm -rf "$TMPFILE" > /dev/null' RETURN + mkdir -p "$DOKKU_ROOT/$APP/.dokku/tmp" + TMPFILE=$(mktemp $DOKKU_ROOT/$APP/.dokku/tmp/.XXXXXX) || dokku_log_fail "Cannot create temp file using mktemp in /tmp dir" + trap 'rm -rf "$TMPFILE" > /dev/null' INT TERM EXIT config_export global > $TMPFILE id=$(docker run -i -a stdin $IMAGE /bin/bash -c "mkdir -p /app/.profile.d && cat > /app/.profile.d/00-global-env.sh" < "$TMPFILE") test "$(docker wait $id)" -eq 0 docker commit $id $IMAGE > /dev/null fi if [[ -n $(config_export app $APP) ]]; then - TMPFILE=$(mktemp $DOKKU_ROOT/$APP/.dokku_config.XXXXXX) || dokku_log_fail "Cannot create temp file using mktemp in /tmp dir" - trap 'rm -rf "$TMPFILE" > /dev/null' RETURN + mkdir -p "$DOKKU_ROOT/$APP/.dokku/tmp" + TMPFILE=$(mktemp $DOKKU_ROOT/$APP/.dokku/tmp/XXXXXX) || dokku_log_fail "Cannot create temp file using mktemp in /tmp dir" + trap 'rm -rf "$TMPFILE" > /dev/null' INT TERM EXIT config_export app $APP > $TMPFILE id=$(docker run -i -a stdin $IMAGE /bin/bash -c "mkdir -p /app/.profile.d && cat > /app/.profile.d/01-app-env.sh" < "$TMPFILE") test "$(docker wait $id)" -eq 0