From adc11a9b3bb6b4f121c50872709fb78a01dd01df Mon Sep 17 00:00:00 2001 From: Alexandre <44178713+alexbelgium@users.noreply.github.com> Date: Fri, 9 Jan 2026 09:22:49 +0100 Subject: [PATCH] Ensure mktemp parent directory exists --- .templates/00-global_var.sh | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/.templates/00-global_var.sh b/.templates/00-global_var.sh index dcb60d392..708e45823 100755 --- a/.templates/00-global_var.sh +++ b/.templates/00-global_var.sh @@ -32,7 +32,13 @@ fi BLOCK_BEGIN="# --- BEGIN ADDON ENV (generated) ---" BLOCK_END="# --- END ADDON ENV (generated) ---" -EXPORT_BLOCK_FILE="$(mktemp)" +mktemp_safe() { + local tmpdir="${TMPDIR:-/tmp}" + mkdir -p "$tmpdir" + mktemp -p "$tmpdir" +} + +EXPORT_BLOCK_FILE="$(mktemp_safe)" trap 'rm -f "$EXPORT_BLOCK_FILE"' EXIT { @@ -148,7 +154,7 @@ is_shell_run_script() { inject_block_into_file() { local file="$1" local tmp - tmp="$(mktemp)" + tmp="$(mktemp_safe)" awk -v bfile="${EXPORT_BLOCK_FILE}" -v begin="${BLOCK_BEGIN}" -v end="${BLOCK_END}" ' function print_block() {