X-Git-Url: https://git.decadent.org.uk/gitweb/?a=blobdiff_plain;f=config%2Fdebian%2Fcommon;h=a568d82657b0e559c55b838f708054473f0cdc75;hb=5428cbbe30b7e2b77305024f45ef2fa2ffa68490;hp=0754159ea93b41e7fbd0cd50dce0627def7d429c;hpb=813801add25896afc4bd9839f5d1fe0c05eea465;p=dak.git diff --git a/config/debian/common b/config/debian/common index 0754159e..a568d826 100644 --- a/config/debian/common +++ b/config/debian/common @@ -23,6 +23,19 @@ function debug () { fi } +# Get a tempfile, add it to the right variable to get rid of it, +# and return it +function gettempfile() { + local MAKEDIR=${1:-false} + local TMPARGS="" + if [[ ${MAKEDIR} == true ]]; then + TMPARGS="--directory" + fi + local TMPFILE=$( mktemp -p ${TMPDIR} ${TMPARGS} ) + TMPFILES="${TEMPFILES} ${TMPFILE}" + echo "${TMPFILE}" +} + # Function that only cleans tempfiles, but does not exit or otherwise # care about any exit status function cleantempfiles() { @@ -347,7 +360,11 @@ function stage() { # Now we should make sure that we have a usable ${PROGRAM}.log, so # append the $STAGEFILE.log to it. - /usr/bin/ts "%b %d %H:%M:%S ${HOSTNAME} ${PROGRAM}[$$]: ${FUNC} " < "${STAGEFILE}.log" + if [[ ${TIMESTAMP} == true ]]; then + /usr/bin/ts "%b %d %H:%M:%S ${HOSTNAME} ${PROGRAM}[$$]: ${FUNC} " < "${STAGEFILE}.log" + else + cat "${STAGEFILE}.log" + fi rm -f "${STAGEFILE}.log" log "########## ${PROGRAM} END: ${FUNC} ##########"