Skip to content

Commit f2fa465

Browse files
committed
Add mkinstalldirs
svn path=/trunk/mono/; revision=113082
1 parent 6eb9a61 commit f2fa465

File tree

2 files changed

+102
-1
lines changed

2 files changed

+102
-1
lines changed

Makefile.am

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ SUBDIRS = po/mcs $(libgc_dir) $(eglib_dir) mono $(ikvm_native_dir) support docs
77
## 'tools' is not normally built
88
DIST_SUBDIRS = po/mcs libgc $(eglib_dir) mono ikvm-native support docs data runtime scripts man samples web tools msvc
99

10-
EXTRA_DIST= po.m4 mono-uninstalled.pc.in dtrace-prelink.sh build-mingw32.sh LICENSE
10+
EXTRA_DIST= po.m4 mono-uninstalled.pc.in dtrace-prelink.sh build-mingw32.sh LICENSE mkinstalldirs
1111

1212
DISTCHECK_CONFIGURE_FLAGS = EXTERNAL_MCS=false EXTERNAL_RUNTIME=false
1313

mkinstalldirs

Lines changed: 101 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,101 @@
1+
#! /bin/sh
2+
# mkinstalldirs --- make directory hierarchy
3+
# Author: Noah Friedman <friedman@prep.ai.mit.edu>
4+
# Created: 1993-05-16
5+
# Public domain
6+
7+
# $Id: mkinstalldirs 36980 2004-12-03 01:08:33Z benm $
8+
9+
errstatus=0
10+
dirmode=""
11+
12+
usage="\
13+
Usage: mkinstalldirs [-h] [--help] [-m mode] dir ..."
14+
15+
# process command line arguments
16+
while test $# -gt 0 ; do
17+
case "${1}" in
18+
-h | --help | --h* ) # -h for help
19+
echo "${usage}" 1>&2; exit 0 ;;
20+
-m ) # -m PERM arg
21+
shift
22+
test $# -eq 0 && { echo "${usage}" 1>&2; exit 1; }
23+
dirmode="${1}"
24+
shift ;;
25+
-- ) shift; break ;; # stop option processing
26+
-* ) echo "${usage}" 1>&2; exit 1 ;; # unknown option
27+
* ) break ;; # first non-opt arg
28+
esac
29+
done
30+
31+
for file
32+
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'`
60+
shift
61+
62+
pathcomp=
63+
for d
64+
do
65+
pathcomp="$pathcomp$d"
66+
case "$pathcomp" in
67+
-* ) pathcomp=./$pathcomp ;;
68+
esac
69+
70+
if test ! -d "$pathcomp"; then
71+
echo "mkdir $pathcomp"
72+
73+
mkdir "$pathcomp" || lasterr=$?
74+
75+
if test ! -d "$pathcomp"; then
76+
errstatus=$lasterr
77+
else
78+
if test ! -z "$dirmode"; then
79+
echo "chmod $dirmode $pathcomp"
80+
81+
lasterr=""
82+
chmod "$dirmode" "$pathcomp" || lasterr=$?
83+
84+
if test ! -z "$lasterr"; then
85+
errstatus=$lasterr
86+
fi
87+
fi
88+
fi
89+
fi
90+
91+
pathcomp="$pathcomp/"
92+
done
93+
done
94+
95+
exit $errstatus
96+
97+
# Local Variables:
98+
# mode: shell-script
99+
# sh-indentation: 3
100+
# End:
101+
# mkinstalldirs ends here

0 commit comments

Comments
 (0)