aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMark Allen <[email protected]>2019-05-31 11:42:09 -0500
committerGitHub <[email protected]>2019-05-31 11:42:09 -0500
commita3bfc826b66b1837f938a44101782e082dae32ed (patch)
tree4999fdadab70606f07eaf7a8ae69b1be7cedbe1c
parent73b71512188fe6c16a01d1b983ee7d9508fe346a (diff)
parentf612d34e66786601be227ac5f9feaa50f6f611ad (diff)
downloadkerl-a3bfc826b66b1837f938a44101782e082dae32ed.tar.gz
kerl-a3bfc826b66b1837f938a44101782e082dae32ed.tar.bz2
kerl-a3bfc826b66b1837f938a44101782e082dae32ed.zip
Merge pull request #300 from Awlexus/master
Added a tmp_dir var
-rw-r--r--README.md5
-rwxr-xr-xkerl5
2 files changed, 8 insertions, 2 deletions
diff --git a/README.md b/README.md
index 7c3f39b..516305f 100644
--- a/README.md
+++ b/README.md
@@ -458,6 +458,11 @@ after activating a kerl installation of Erlang/OTP. Here is an example of
# compilation options
KERL_CONFIGURE_OPTIONS="--disable-native-libs --enable-vm-probes --with-dynamic-trace=dtrace --with-ssl=/usr/local --with-javac --enable-hipe --enable-kernel-poll --with-wx-config=/usr/local/bin/wxgtk2u-2.8-config --without-odbc --enable-threads --enable-sctp --enable-smp-support"
+
+In case you cannot access the default directory for temporary files (`/tmp`) or simply want them somewhere else, you can also provide your own directory with the variable `TMP_DIR`
+
+ export TMP_DIR=/your/custom/temporary/dir
+
#### Building documentation
Prior to kerl 1.0, kerl always downloaded prepared documentation from erlang.org. Now if `KERL_BUILD_DOCS=yes` is set, kerl will build the man pages and HTML
diff --git a/kerl b/kerl
index a207a34..4e7b82c 100755
--- a/kerl
+++ b/kerl
@@ -33,6 +33,7 @@ DOCSH_GITHUB_URL='https://github.com/erszcz/docsh.git'
ERLANG_DOWNLOAD_URL='https://www.erlang.org/download'
KERL_CONFIG_STORAGE_FILENAME='.kerl_config'
+TMP_DIR=${TMP_DIR:-'/tmp'}
if [ -z "$HOME" ]; then
# shellcheck disable=SC2016
echo 'Error: $HOME is empty or not set.' 1>&2
@@ -213,7 +214,7 @@ get_git_releases() {
}
get_tarball_releases() {
- tmp="$(mktemp /tmp/kerl.XXXXXX)"
+ tmp="$(mktemp ${TMP_DIR}/kerl.XXXXXX)"
if [ 200 = "$(curl -qsL --output "$tmp" --write-out '%{http_code}' $ERLANG_DOWNLOAD_URL/)" ]; then
sed $SED_OPT \
-e 's/^.*<[aA] [hH][rR][eE][fF]=\"otp_src_([-0-9A-Za-z_.]+)\.tar\.gz\">.*$/\1/' \
@@ -703,7 +704,7 @@ _do_build() {
fi
# Check to see if configuration options need to be stored or have changed
- TMPOPT="/tmp/kerloptions.$$"
+ TMPOPT="${TMP_DIR}/kerloptions.$$"
echo "$CFLAGS" >"$TMPOPT"
echo "$KERL_CONFIGURE_OPTIONS" >>"$TMPOPT"
SUM=$($MD5SUM "$TMPOPT" | cut -d ' ' -f $MD5SUM_FIELD)