This allows to track down left-over temporary files to their sources.
export JOB_HOME=$JENKINS_HOME/jobs/$JOB_NAME/builds
SCRIPTSDIR=$(dirname $0)
-BUILD_SCRIPT=$(mktemp)
+BUILD_SCRIPT=$(mktemp -t ${0##*/}.XXXXXXXXXX)
cat > $BUILD_SCRIPT <<-EOF
#/bin/bash
set -e
set -eux
script_dir="$( cd "$( dirname "$0" )" && pwd )"
-workdir="$(mktemp -d)"
+workdir="$(mktemp -d -t ${0##*/}.XXXXXXXXXX)"
liveboot_id="$LIVEBOOT_BUILD_NUMBER"
assembledir="$workdir/liveboot-$liveboot_id-kernel-dbg"
export PB_SUITE=production-proposed-updates
SCRIPTSDIR=$(dirname $0)
-BUILD_SCRIPT=$(mktemp)
+BUILD_SCRIPT=$(mktemp -t ${0##*/}.XXXXXXXXXX)
cat > $BUILD_SCRIPT <<-EOF
cd /srv/build
rm liveboot -rf
#
# prepare ssh
#
-TMPFILE=$(mktemp)
+TMPFILE=$(mktemp -t ${0##*/}.XXXXXXXXXX)
ssh-agent > $TMPFILE
source $TMPFILE
ssh-add ~/.ssh/id_ritest
#
# add jenkins user and sudoers.d/jenkins for it
#
-TMPFILE=$(mktemp)
+TMPFILE=$(mktemp -t ${0##*/}.XXXXXXXXXX)
cat > $TMPFILE <<-EOF
addgroup --system jenkins
adduser --system --home /home/jenkins --shell /bin/bash --ingroup jenkins --disabled-password --gecos "Profitbricks jenkins user" jenkins
#
# add jenkins user and sudoers.d/jenkins for it
#
-TMPFILE=$(mktemp)
+TMPFILE=$(mktemp -t ${0##*/}.XXXXXXXXXX)
cat > $TMPFILE <<-EOF
addgroup --system jenkins
adduser --system --home /home/jenkins --shell /bin/bash --ingroup jenkins --disabled-password --gecos "Profitbricks jenkins user" jenkins
fi
# Checkout liveboot repo
-BUILD_SCRIPT=$(mktemp)
+BUILD_SCRIPT=$(mktemp -t ${0##*/}.XXXXXXXXXX)
cat > $BUILD_SCRIPT <<-EOF
cd /srv/build
rm /srv/build/liveboot_test_state -rf
#!/bin/bash
# copyright 2012 Holger Levsen GPL2 licenced, holger@layer-acht.org
-OUTPUT=$(mktemp)
+OUTPUT=$(mktemp -t ${0##*/}.XXXXXXXXXX)
for file in $(find . -iname '*.pp') ; do
echo -n "parsing $file: "
#
# prepare ssh
#
-TMPFILE=$(mktemp)
+TMPFILE=$(mktemp -t ${0##*/}.XXXXXXXXXX)
ssh-agent > $TMPFILE
source $TMPFILE
ssh-add ~/.ssh/id_ritest
echo
echo
-TMPFILE=$(mktemp)
+TMPFILE=$(mktemp -t ${0##*/}.XXXXXXXXXX)
cat > $TMPFILE <<-EOF
# Generated automatically by jenkins - don't edit manually, it will be overwritten
TIMEOUT 100