16 |
while test $# -gt 0 ; do |
while test $# -gt 0 ; do |
17 |
case "${1}" in |
case "${1}" in |
18 |
-h | --help | --h* ) # -h for help |
-h | --help | --h* ) # -h for help |
19 |
echo "${usage}" 1>&2; exit 0 ;; |
echo "${usage}" 1>&2; exit 0 ;; |
20 |
-m ) # -m PERM arg |
-m ) # -m PERM arg |
21 |
shift |
shift |
22 |
test $# -eq 0 && { echo "${usage}" 1>&2; exit 1; } |
test $# -eq 0 && { echo "${usage}" 1>&2; exit 1; } |
23 |
dirmode="${1}" |
dirmode="${1}" |
24 |
shift ;; |
shift ;; |
25 |
-- ) shift; break ;; # stop option processing |
-- ) shift; break ;; # stop option processing |
26 |
-* ) echo "${usage}" 1>&2; exit 1 ;; # unknown option |
-* ) echo "${usage}" 1>&2; exit 1 ;; # unknown option |
27 |
* ) break ;; # first non-opt arg |
* ) break ;; # first non-opt arg |
30 |
|
|
31 |
for file |
for file |
32 |
do |
do |
33 |
|
if test -d "$file"; then |
34 |
|
shift |
35 |
|
else |
36 |
|
break |
37 |
|
fi |
38 |
|
done |
39 |
|
|
40 |
|
case $# in |
41 |
|
0) exit 0 ;; |
42 |
|
esac |
43 |
|
|
44 |
|
case $dirmode in |
45 |
|
'') |
46 |
|
if mkdir -p -- . 2>/dev/null; then |
47 |
|
echo "mkdir -p -- $*" |
48 |
|
exec mkdir -p -- "$@" |
49 |
|
fi ;; |
50 |
|
*) |
51 |
|
if mkdir -m "$dirmode" -p -- . 2>/dev/null; then |
52 |
|
echo "mkdir -m $dirmode -p -- $*" |
53 |
|
exec mkdir -m "$dirmode" -p -- "$@" |
54 |
|
fi ;; |
55 |
|
esac |
56 |
|
|
57 |
|
for file |
58 |
|
do |
59 |
set fnord `echo ":$file" | sed -ne 's/^:\//#/;s/^://;s/\// /g;s/^#/\//;p'` |
set fnord `echo ":$file" | sed -ne 's/^:\//#/;s/^://;s/\// /g;s/^#/\//;p'` |
60 |
shift |
shift |
61 |
|
|
68 |
esac |
esac |
69 |
|
|
70 |
if test ! -d "$pathcomp"; then |
if test ! -d "$pathcomp"; then |
71 |
echo "mkdir $pathcomp" |
echo "mkdir $pathcomp" |
72 |
|
|
73 |
mkdir "$pathcomp" || lasterr=$? |
mkdir "$pathcomp" || lasterr=$? |
74 |
|
|
75 |
if test ! -d "$pathcomp"; then |
if test ! -d "$pathcomp"; then |
76 |
errstatus=$lasterr |
errstatus=$lasterr |
77 |
else |
else |
78 |
if test ! -z "$dirmode"; then |
if test ! -z "$dirmode"; then |
79 |
echo "chmod $dirmode $pathcomp" |
echo "chmod $dirmode $pathcomp" |
80 |
|
|
81 |
lasterr="" |
lasterr="" |
82 |
chmod $dirmode "$pathcomp" || lasterr=$? |
chmod "$dirmode" "$pathcomp" || lasterr=$? |
83 |
|
|
84 |
if test ! -z "$lasterr"; then |
if test ! -z "$lasterr"; then |
85 |
errstatus=$lasterr |
errstatus=$lasterr |
86 |
fi |
fi |
87 |
fi |
fi |
88 |
fi |
fi |
89 |
fi |
fi |
90 |
|
|
91 |
pathcomp="$pathcomp/" |
pathcomp="$pathcomp/" |
95 |
exit $errstatus |
exit $errstatus |
96 |
|
|
97 |
# Local Variables: |
# Local Variables: |
98 |
# mode:shell-script |
# mode: shell-script |
99 |
# sh-indentation:3 |
# sh-indentation: 3 |
100 |
# End: |
# End: |
101 |
|
# mkinstalldirs ends here |