3172
|
1 #!/bin/sh |
|
2 # mkinstalldirs --- make directory hierarchy (now mktexdir). |
3285
|
3 # Author: Noah Friedman <friedman@gnu.org>, created: 1993-05-16. |
3172
|
4 # Public domain. |
|
5 # |
|
6 # Modified for sticky directory creation, --help, --version. |
|
7 # te@informatik.uni-hannover.de and kb@mail.tug.org. |
|
8 |
|
9 version='$Id: mktexdir,v 1.10 1998/03/16 23:15:36 olaf Exp $' |
|
10 usage="Usage: $0 DIRS... |
|
11 Create each DIR, including any missing leading directories." |
|
12 |
|
13 # Common code for all scripts. |
|
14 : ${MT_TEXMFMAIN=`kpsewhich --expand-path='$TEXMFMAIN'`} |
|
15 : ${MT_MKTEX_OPT=`kpsewhich --format='web2c files' mktex.opt`} |
|
16 test -n "$MT_MKTEX_OPT" || MT_MKTEX_OPT="$MT_TEXMFMAIN/web2c/mktex.opt" |
|
17 if test ! -f "$MT_MKTEX_OPT"; then |
|
18 echo "$0: Cannot find mktex.opt; check your installation." >&2 |
|
19 exit 1 |
|
20 fi |
|
21 |
|
22 . "$MT_MKTEX_OPT" |
|
23 |
|
24 test -n "$MT_MKTEXDIR_OPT" && . "$MT_MKTEXDIR_OPT" |
|
25 |
|
26 errstatus=0 |
|
27 |
|
28 for file |
|
29 do |
|
30 set fnord `echo ":$file" | sed -ne 's/^:\//#/;s/^://;s/\// /g;s/^#/\//;p'` |
|
31 shift |
|
32 |
|
33 pathcomp= |
|
34 for d in ${1+"$@"} ; do |
|
35 pathcomp="$pathcomp$d" |
|
36 case "$pathcomp" in |
|
37 -* ) pathcomp="./$pathcomp" ;; |
|
38 esac |
|
39 |
|
40 if test ! -d "$pathcomp"; then |
|
41 mkdir "$pathcomp" || errstatus=$? |
|
42 chmod `kpsestat ${MT_APPEND_MASK:-=} "$pathcomp"/..` "$pathcomp" |
|
43 fi |
|
44 |
|
45 pathcomp="$pathcomp/" |
|
46 done |
|
47 done |
|
48 |
|
49 exit $errstatus |