aboutsummaryrefslogtreecommitdiffstats
path: root/main/lxc/download-template-tmpfs.patch
diff options
context:
space:
mode:
Diffstat (limited to 'main/lxc/download-template-tmpfs.patch')
-rw-r--r--main/lxc/download-template-tmpfs.patch23
1 files changed, 23 insertions, 0 deletions
diff --git a/main/lxc/download-template-tmpfs.patch b/main/lxc/download-template-tmpfs.patch
new file mode 100644
index 0000000000..de36c365a0
--- /dev/null
+++ b/main/lxc/download-template-tmpfs.patch
@@ -0,0 +1,23 @@
+--- a/templates/lxc-download.in
++++ b/templates/lxc-download.in
+@@ -298,11 +298,15 @@ fi
+ # Trap all exit signals
+ trap cleanup EXIT HUP INT TERM
+
+-if ! type 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 ! type 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