aboutsummaryrefslogtreecommitdiffstats
path: root/main/lxc/download-template-tmpfs.patch
blob: de36c365a0147557a8677b65090e130efdd94e09 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
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