Commit 7738c6a6 authored by Michael Shigorin's avatar Michael Shigorin

bin/mktmpdir tweaks

The fallback case of building in a brother directory moved from the last line of code to the first one becoming more explicit along the way. Support for slash-containing argument (being a tmpdir name template prefix) has been added.
parent 2f307fff
......@@ -2,7 +2,7 @@
# analyze free space, preferring tmpfs over really many gigaz
# hope there aren't spaces in RM's $HOME are they?
DIRS="$TMP $TMPDIR $HOME/hasher /tmp /var/tmp"
DIRS="$TMP $TMPDIR $HOME/hasher /tmp /var/tmp .."
MINSIZE=262144 # face control criterion
# pick existing, writeable, >256M free space dirs
......@@ -25,5 +25,7 @@ choose_tmpdir() {
| cut -f2 -d' '
}
DIR="`choose_tmpdir`"
mktemp -d "${1:-tmpdir}.XXXXXXX" --tmpdir="${DIR:-`realpath ..`}"
DIR="`choose_tmpdir`/`dirname "$1"`"
NAME="`basename "${1:-tmpdir}"`"
mkdir -p "$DIR" # in case $1 contains slash(es)
mktemp -d "$NAME.XXXXXXX" --tmpdir="${DIR%/.}"
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment