From: David Disseldorp Date: Mon, 10 Oct 2016 14:27:47 +0000 (+0200) Subject: dracut.sh: support --tmpdir as a relative path X-Git-Tag: 045~62^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F157%2Fhead;p=thirdparty%2Fdracut.git dracut.sh: support --tmpdir as a relative path Dracut changes working directory before attempting to output files under $DRACUT_TMPDIR , resulting in an IO failure if $DRACUT_TMPDIR is a path relative to the working directory when dracut was started. Fixes: https://github.com/dracutdevs/dracut/issues/156 Signed-off-by: David Disseldorp --- diff --git a/dracut.sh b/dracut.sh index 40ca08f65..a30e8d9de 100755 --- a/dracut.sh +++ b/dracut.sh @@ -820,7 +820,11 @@ esac [[ $reproducible == yes ]] && DRACUT_REPRODUCIBLE=1 -readonly TMPDIR="$tmpdir" +readonly TMPDIR="$(realpath -e "$tmpdir")" +[ -d "$TMPDIR" ] || { + printf "%s\n" "dracut: Invalid tmpdir '$tmpdir'." >&2 + exit 1 +} readonly DRACUT_TMPDIR="$(mktemp -p "$TMPDIR/" -d -t dracut.XXXXXX)" [ -d "$DRACUT_TMPDIR" ] || { printf "%s\n" "dracut: mktemp -p '$TMPDIR/' -d -t dracut.XXXXXX failed." >&2