We have an installation that we deploy to a bunch of workstations. We prefer if the installation uses the temporary file directory that Windows has already allocated for the user.
The entry for /tmp in /etc/fstab, or the directory /tmp, is preferred. If neither is found, the patch mounts /tmp at the directory indicated by the environment variable TMP or, if that is not set, TEMP. The patch does nothing if neither environment variable is set. Earl --- mount.h.orig 2010-03-18 07:57:09.000000000 -0700 +++ mount.h 2010-09-08 11:10:23.218802900 -0700 @@ -140,6 +140,7 @@ int nmounts; mount_item mount[MAX_MOUNTS]; + static bool got_tmp; static bool got_usr_bin; static bool got_usr_lib; static int root_idx; --- mount.cc.orig 2010-03-30 03:03:09.000000000 -0700 +++ mount.cc 2010-09-08 11:35:27.765251900 -0700 @@ -45,6 +45,7 @@ #define isproc(path) \ (path_prefix_p (proc, (path), proc_len, false)) +bool NO_COPY mount_info::got_tmp; bool NO_COPY mount_info::got_usr_bin; bool NO_COPY mount_info::got_usr_lib; int NO_COPY mount_info::root_idx = -1; @@ -390,6 +391,24 @@ MOUNT_SYSTEM | MOUNT_BINARY | MOUNT_AUTOMATIC); } } + + if (!got_tmp) + { + char tmpdir[PATH_MAX]; + if (root_idx < 0) + api_fatal ("root_idx %d, user_shared magic %p, nmounts %d", root_idx, user_shared->version, nmounts); + char *p = stpcpy (tmpdir, mount[root_idx].native_path); + stpcpy (p, "\\tmp"); + if (GetFileAttributes (tmpdir) != FILE_ATTRIBUTE_DIRECTORY) + { + const char *tmp = getenv("TMP"); + if (!tmp) + tmp = getenv("TEMP"); + if (tmp) + add_item (tmp, "/tmp", + MOUNT_SYSTEM | MOUNT_BINARY | MOUNT_AUTOMATIC); + } + } } static void @@ -1342,6 +1361,9 @@ if (i == nmounts) nmounts++; + if (strcmp (posixtmp, "/tmp") == 0) + got_tmp = true; + if (strcmp (posixtmp, "/usr/bin") == 0) got_usr_bin = true;