diff options
Diffstat (limited to 'lib/tmpfile')
-rw-r--r-- | lib/tmpfile | 45 |
1 files changed, 0 insertions, 45 deletions
diff --git a/lib/tmpfile b/lib/tmpfile deleted file mode 100644 index 886d61c..0000000 --- a/lib/tmpfile +++ /dev/null @@ -1,45 +0,0 @@ -#!/bin/bash - -# Setup a temporary file -function hydra_set_tmpfile { - if [ -z "$BASEDIR" ]; then - echo "Please set BASEDIR before creating a tmp file" - exit 1 - fi - - if [ -z "$1" ]; then - template="$BASEDIR/tmp/hydra.XXXXXXXXXX" - else - template="$BASEDIR/tmp/$1.XXXXXXXXXX" - fi - - mkdir -p $BASEDIR/tmp - hydra_git_ignore 'tmp/*' - - if [ "$2" == "-d" ]; then - TMPWORK="`mktemp -d $template`" - else - TMPWORK="`mktemp $template`" - fi - - if [ "$?" != "0" ]; then - echo "Error: can't set TMPWORK $TMPWORK" - exit 1 - fi - - trap "hydra_unset_tmpfile $TMPWORK; exit" INT TERM EXIT -} - -# Remove a temporary file -function hydra_unset_tmpfile { - if [ -z "$1" ]; then - echo "No tmp file set" - fi - - rm -f $1 - - if [ "$?" != "0" ]; then - echo "Warning: could not delete file $1. Please delete it manually as it might have sensitive information." - exit 1 - fi -} |