--- a/templates/lxc-download.in +++ b/templates/lxc-download.in @@ -311,11 +311,15 @@ # Trap all exit signals trap cleanup EXIT HUP INT TERM -if ! command -V mktemp >/dev/null 2>&1; then - DOWNLOAD_TEMP=/tmp/lxc-download.$$ - mkdir -p "${DOWNLOAD_TEMP}" -else - DOWNLOAD_TEMP=$(mktemp -d) +if ! grep -qw '/tmp' /proc/mounts; then + if ! command -V mktemp >/dev/null 2>&1; then + DOWNLOAD_TEMP=/tmp/lxc-download.$$ + mkdir -p "${DOWNLOAD_TEMP}" + else + DOWNLOAD_TEMP=$(mktemp -d) + fi +else # /tmp may be mounted in tmpfs / zram or noexec + DOWNLOAD_TEMP=$(mktemp -d -p $LXC_PATH) fi # Simply list images