1 |
#! /bin/sh |
#! /bin/sh |
2 |
# mkinstalldirs --- make directory hierarchy |
# mkinstalldirs --- make directory hierarchy |
3 |
|
|
4 |
scriptversion=2004-02-15.20 |
scriptversion=2005-06-29.22 |
5 |
|
|
6 |
# Original author: Noah Friedman <friedman@prep.ai.mit.edu> |
# Original author: Noah Friedman <friedman@prep.ai.mit.edu> |
7 |
# Created: 1993-05-16 |
# Created: 1993-05-16 |
12 |
# <automake-patches@gnu.org>. |
# <automake-patches@gnu.org>. |
13 |
|
|
14 |
errstatus=0 |
errstatus=0 |
15 |
dirmode="" |
dirmode= |
16 |
|
|
17 |
usage="\ |
usage="\ |
18 |
Usage: mkinstalldirs [-h] [--help] [--version] [-m MODE] DIR ... |
Usage: mkinstalldirs [-h] [--help] [--version] [-m MODE] DIR ... |
27 |
case $1 in |
case $1 in |
28 |
-h | --help | --h*) # -h for help |
-h | --help | --h*) # -h for help |
29 |
echo "$usage" |
echo "$usage" |
30 |
exit 0 |
exit $? |
31 |
;; |
;; |
32 |
-m) # -m PERM arg |
-m) # -m PERM arg |
33 |
shift |
shift |
37 |
;; |
;; |
38 |
--version) |
--version) |
39 |
echo "$0 $scriptversion" |
echo "$0 $scriptversion" |
40 |
exit 0 |
exit $? |
41 |
;; |
;; |
42 |
--) # stop option processing |
--) # stop option processing |
43 |
shift |
shift |
103 |
|
|
104 |
for file |
for file |
105 |
do |
do |
106 |
set fnord `echo ":$file" | sed -ne 's/^:\//#/;s/^://;s/\// /g;s/^#/\//;p'` |
case $file in |
107 |
|
/*) pathcomp=/ ;; |
108 |
|
*) pathcomp= ;; |
109 |
|
esac |
110 |
|
oIFS=$IFS |
111 |
|
IFS=/ |
112 |
|
set fnord $file |
113 |
shift |
shift |
114 |
|
IFS=$oIFS |
115 |
|
|
|
pathcomp= |
|
116 |
for d |
for d |
117 |
do |
do |
118 |
pathcomp="$pathcomp$d" |
test "x$d" = x && continue |
119 |
|
|
120 |
|
pathcomp=$pathcomp$d |
121 |
case $pathcomp in |
case $pathcomp in |
122 |
-*) pathcomp=./$pathcomp ;; |
-*) pathcomp=./$pathcomp ;; |
123 |
esac |
esac |
132 |
else |
else |
133 |
if test ! -z "$dirmode"; then |
if test ! -z "$dirmode"; then |
134 |
echo "chmod $dirmode $pathcomp" |
echo "chmod $dirmode $pathcomp" |
135 |
lasterr="" |
lasterr= |
136 |
chmod "$dirmode" "$pathcomp" || lasterr=$? |
chmod "$dirmode" "$pathcomp" || lasterr=$? |
137 |
|
|
138 |
if test ! -z "$lasterr"; then |
if test ! -z "$lasterr"; then |
142 |
fi |
fi |
143 |
fi |
fi |
144 |
|
|
145 |
pathcomp="$pathcomp/" |
pathcomp=$pathcomp/ |
146 |
done |
done |
147 |
done |
done |
148 |
|
|