From 8e063362efd11d8d86987d6199867d974fa8c6be Mon Sep 17 00:00:00 2001 From: Michael Prokop Date: Tue, 26 Apr 2022 15:50:59 +0200 Subject: [PATCH] TT#173500 Create tmpfiles with template name We want to be able to track down any left-behind tmp files, so ensure we're creating them with according file names. Change-Id: I4eb44047f2eb86ba9f0a8aeeb8d6555290f60c00 --- t/iso-tester | 4 ++-- templates/scripts/includes/deployment.sh | 8 ++++---- templates/scripts/includes/disk_selection.sh | 4 ++-- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/t/iso-tester b/t/iso-tester index b4b5ea3..30ff87c 100755 --- a/t/iso-tester +++ b/t/iso-tester @@ -31,8 +31,8 @@ if [ -n "${3:-}" ] ; then SCREENSHOT_COMPARE="$3" fi -QEMU_MONITOR=$(mktemp) -SCREENDUMP=$(mktemp) +QEMU_MONITOR=$(mktemp -t iso-tester-qemu.XXXXXXXXXX) +SCREENDUMP=$(mktemp -t iso-tester-screen.XXXXXXXXXX) send_command() { echo "$*" | socat - UNIX-CONNECT:"${QEMU_MONITOR}" diff --git a/templates/scripts/includes/deployment.sh b/templates/scripts/includes/deployment.sh index d1a07ec..1bcb700 100755 --- a/templates/scripts/includes/deployment.sh +++ b/templates/scripts/includes/deployment.sh @@ -176,10 +176,10 @@ ensure_recent_package_versions() { # use temporary apt database for speed reasons local TMPDIR - TMPDIR=$(mktemp -d) + TMPDIR=$(mktemp -d -t ngcp-deployment-recent-tmp.XXXXXXXXXX) mkdir -p "${TMPDIR}/statedir/lists/partial" "${TMPDIR}/cachedir/archives/partial" local debsrcfile - debsrcfile=$(mktemp) + debsrcfile=$(mktemp -t ngcp-deployment-recent-debsrc.XXXXXXXXXX) echo "deb ${SIPWISE_REPO_TRANSPORT}://${SIPWISE_REPO_HOST}/grml.org grml-testing main" >> "${debsrcfile}" DEBIAN_FRONTEND='noninteractive' apt-get \ @@ -269,7 +269,7 @@ ensure_packages_installed() { # so is installed from management node so these additional packages have to be accessible from # sipwise repo local TMPDIR - TMPDIR=$(mktemp -d) + TMPDIR=$(mktemp -d -t ngcp-deployment-ensure-tmp.XXXXXXXXXX) mkdir -p "${TMPDIR}/etc/preferences.d" "${TMPDIR}/statedir/lists/partial" \ "${TMPDIR}/cachedir/archives/partial" chown _apt -R "${TMPDIR}" @@ -811,7 +811,7 @@ get_installer_path() { if [ -n "${NGCP_PPA}" ] ; then local ppa_tmp_packages - ppa_tmp_packages=$(mktemp) + ppa_tmp_packages=$(mktemp -t ngcp-deployment-installer-path.XXXXXXXXXX) echo "NGCP PPA requested, checking ngcp-installer package availability in PPA repo" local ppa_repos_base_path="${SIPWISE_URL}/autobuild/dists/${NGCP_PPA}/main/binary-amd64/" diff --git a/templates/scripts/includes/disk_selection.sh b/templates/scripts/includes/disk_selection.sh index 368ca6a..256b5fd 100755 --- a/templates/scripts/includes/disk_selection.sh +++ b/templates/scripts/includes/disk_selection.sh @@ -11,7 +11,7 @@ prompt_for_raid() { echo "${i}" "${disk_info}" off done) ) local TMP - TMP=$(mktemp) + TMP=$(mktemp -t ngcp-deployment-raid-prompt.XXXXXXXXXX) if ! dialog --title "Disk selection for Software RAID" --separate-output \ --checklist "Please select the disks you would like to use for your RAID1:" 0 0 0 \ "${DISK_LIST[@]}" 2>"${TMP}" ; then @@ -36,7 +36,7 @@ prompt_for_target() { done) ) local TMP - TMP=$(mktemp) + TMP=$(mktemp -t ngcp-deployment-target-prompt.XXXXXXXXXX) if ! dialog --title "Disk selection" --single-quoted \ --ok-label OK --cancel-label Exit \ --menu "Please select the target disk for installing Debian/ngcp:" 0 0 0 \