Harald Hoyer 5f0dd7
From bc1e69b691e6d25722b64e1df58a35e3be977801 Mon Sep 17 00:00:00 2001
Harald Hoyer 5f0dd7
From: Topi Miettinen <toiwoton@gmail.com>
Harald Hoyer 5f0dd7
Date: Sun, 1 Mar 2020 10:45:16 +0200
Harald Hoyer 5f0dd7
Subject: [PATCH] Use TMPDIR if available
Harald Hoyer 5f0dd7
Harald Hoyer 5f0dd7
Use environment variable TMPDIR (typically /run/user/$UID) as default
Harald Hoyer 5f0dd7
temporary directory, if available. This should be more private
Harald Hoyer 5f0dd7
location than /var/tmp. Path specified with --tmpdir is takes
Harald Hoyer 5f0dd7
precedence over TMPDIR and /var/tmp is still used as last resort if
Harald Hoyer 5f0dd7
neither TMPDIR is set nor --tmpdir is used.
Harald Hoyer 5f0dd7
Harald Hoyer 5f0dd7
Signed-off-by: Topi Miettinen <toiwoton@gmail.com>
Harald Hoyer 5f0dd7
---
Harald Hoyer 5f0dd7
 dracut.sh | 3 ++-
Harald Hoyer 5f0dd7
 1 file changed, 2 insertions(+), 1 deletion(-)
Harald Hoyer 5f0dd7
Harald Hoyer 5f0dd7
diff --git a/dracut.sh b/dracut.sh
Harald Hoyer 5f0dd7
index c14f6c0b..ab82cbc9 100755
Harald Hoyer 5f0dd7
--- a/dracut.sh
Harald Hoyer 5f0dd7
+++ b/dracut.sh
Harald Hoyer 5f0dd7
@@ -140,7 +140,7 @@ Creates initial ramdisk images for preloading modules
Harald Hoyer 5f0dd7
   --confdir [DIR]       Specify configuration directory to use *.conf files
Harald Hoyer 5f0dd7
                          from. Default: /etc/dracut.conf.d
Harald Hoyer 5f0dd7
   --tmpdir [DIR]        Temporary directory to be used instead of default
Harald Hoyer 5f0dd7
-                         /var/tmp.
Harald Hoyer 5f0dd7
+                         ${TMPDIR:-/var/tmp}.
Harald Hoyer 5f0dd7
   -r, --sysroot [DIR]   Specify sysroot directory to collect files from.
Harald Hoyer 5f0dd7
   -l, --local           Local mode. Use modules from the current working
Harald Hoyer 5f0dd7
                          directory instead of the system-wide installed in
Harald Hoyer 5f0dd7
@@ -765,6 +765,7 @@ stdloglvl=$((stdloglvl + verbosity_mod_l))
Harald Hoyer 5f0dd7
 [[ $dracutbasedir ]] || dracutbasedir=$dracutsysrootdir/usr/lib/dracut
Harald Hoyer 5f0dd7
 [[ $fw_dir ]] || fw_dir="$dracutsysrootdir/lib/firmware/updates:$dracutsysrootdir/lib/firmware:$dracutsysrootdir/lib/firmware/$kernel"
Harald Hoyer 5f0dd7
 [[ $tmpdir_l ]] && tmpdir="$tmpdir_l"
Harald Hoyer 5f0dd7
+[[ $tmpdir ]] && tmpdir="$TMPDIR"
Harald Hoyer 5f0dd7
 [[ $tmpdir ]] || tmpdir=$dracutsysrootdir/var/tmp
Harald Hoyer 5f0dd7
 [[ $INITRD_COMPRESS ]] && compress=$INITRD_COMPRESS
Harald Hoyer 5f0dd7
 [[ $compress_l ]] && compress=$compress_l
Harald Hoyer 5f0dd7