Persist `$TMPDIR` from installer to updater. (#10384)
Austin S. Hemmelgarn committed
Jan 4, 2021 at 07:11 UTC
59db8884c633e45642bed85c4e48f9a2df4d6d1d
2 files changed
+14
-9
netdata-installer.sh
+1
@@ -1866,6 +1866,7 @@ cat << EOF > "${NETDATA_USER_CONFIG_DIR}/.environment"
1866
PATH="${PATH}"
1867
CFLAGS="${CFLAGS}"
1868
LDFLAGS="${LDFLAGS}"
1869
+NETDATA_TMPDIR="${TMPDIR}"
1870
NETDATA_PREFIX="${NETDATA_PREFIX}"
1871
NETDATA_CONFIGURE_OPTIONS="${NETDATA_CONFIGURE_OPTIONS}"
1872
NETDATA_ADDED_TO_GROUPS="${NETDATA_ADDED_TO_GROUPS}"
packaging/installer/netdata-updater.sh
+13
-9
@@ -98,18 +98,22 @@ create_tmp_directory() {
98
if [ -n "${NETDATA_TMPDIR_PATH}" ]; then
99
echo "${NETDATA_TMPDIR_PATH}"
100
else
101
- if [ -z "${TMPDIR}" ] || _cannot_use_tmpdir "${TMPDIR}" ; then
102
- if _cannot_use_tmpdir /tmp ; then
103
- if _cannot_use_tmpdir "${PWD}" ; then
104
- echo >&2
105
- echo >&2 "Unable to find a usable temprorary directory. Please set \$TMPDIR to a path that is both writable and allows execution of files and try again."
106
- exit 1
101
+ if [ -z "${NETDATA_TMPDIR}" ] || _cannot_find_tmpdir "${NETDATA_TMPDIR}" ; then
102
+ if [ -z "${TMPDIR}" ] || _cannot_use_tmpdir "${TMPDIR}" ; then
103
+ if _cannot_use_tmpdir /tmp ; then
104
+ if _cannot_use_tmpdir "${PWD}" ; then
105
+ echo >&2
106
+ echo >&2 "Unable to find a usable temprorary directory. Please set \$TMPDIR to a path that is both writable and allows execution of files and try again."
107
+ exit 1
108
+ else
109
+ TMPDIR="${PWD}"
110
+ fi
111
else
108
- TMPDIR="${PWD}"
112
+ TMPDIR="/tmp"
113
fi
110
- else
111
- TMPDIR="/tmp"
114
fi
115
+ else
116
+ TMPDIR="${NETDATA_TMPDIR}"
117
fi
118
119
mktemp -d -t netdata-updater-XXXXXXXXXX