2 # mkinstalldirs (now mktexdir) -- make directory hierarchy.
3 # Author: Noah Friedman <friedman@prep.ai.mit.edu>, created: 1993-05-16.
6 # Modified for sticky directory creation, --help, --version, more,
7 # by Thomas Esser, Karl Berry, Olaf Weber, et al.
9 version
='$Id: mktexdir 34656 2014-07-18 23:38:50Z karl $'
10 progname
=`echo $0 | sed 's%.*/%%'`
12 # preferentially use subprograms from our own directory.
13 mydir
=`echo "$0" | sed 's,/[^/]*$,,'`
14 mydir
=`cd "$mydir" && pwd`
15 PATH
="$mydir:$PATH"; export PATH
17 usage
="Usage: $0 DIR...
18 Create each DIR, including any missing leading directories."
21 # Common code for all scripts.
22 : ${MT_TEXMFMAIN=`kpsewhich --expand-path='$TEXMFMAIN'`}
23 : ${MT_MKTEX_OPT=`kpsewhich --format='web2c files' mktex.opt`}
24 test -n "$MT_MKTEX_OPT" || MT_MKTEX_OPT
="$MT_TEXMFMAIN/web2c/mktex.opt"
25 if test ! -f "$MT_MKTEX_OPT"; then
26 echo "$0: Cannot find mktex.opt; check your installation." >&2
32 test -n "$MT_MKTEXDIR_OPT" && .
"$MT_MKTEXDIR_OPT"
34 test -z "$MT_APPEND_MASK" && MT_APPEND_MASK
="="
44 OLDIFS
=$IFS; IFS
=/; set fnord
`echo "./$file"`; IFS
=$OLDIFS; shift
49 test -z "$d" && continue
50 pathcomp
="$pathcomp$d"
52 if test ! -d "./$pathcomp"; then
53 mkdir
"./$pathcomp" ||
{ errstatus
=$?
; break; }
54 chmod `kpsestat ${MT_APPEND_MASK} "$pathcomp"/..` "./$pathcomp"