9002
+ ��膩��� 1 #! /bin/sh
+ ��膩��� 2 # mkinstalldirs --- make directory hierarchy
+ ��膩��� 3
+ ��膩��� 4 scriptversion=2004-02-15.20
+ ��膩��� 5
+ ��膩��� 6 # Original author: Noah Friedman <friedman@prep.ai.mit.edu>
+ ��膩��� 7 # Created: 1993-05-16
+ ��膩��� 8 # Public domain.
+ ��膩��� 9 #
+ ��膩��� 10 # This file is maintained in Automake, please report
+ ��膩��� 11 # bugs to <bug-automake@gnu.org> or send patches to
+ ��膩��� 12 # <automake-patches@gnu.org>.
+ ��膩��� 13
+ ��膩��� 14 errstatus=0
+ ��膩��� 15 dirmode=""
+ ��膩��� 16
+ ��膩��� 17 usage="\
+ ��膩��� 18 Usage: mkinstalldirs [-h] [--help] [--version] [-m MODE] DIR ...
+ ��膩��� 19
+ ��膩��� 20 Create each directory DIR (with mode MODE, if specified), including all
+ ��膩��� 21 leading file name components.
+ ��膩��� 22
+ ��膩��� 23 Report bugs to <bug-automake@gnu.org>."
+ ��膩��� 24
+ ��膩��� 25 # process command line arguments
+ ��膩��� 26 while test $# -gt 0 ; do
+ ��膩��� 27 case $1 in
+ ��膩��� 28 -h | --help | --h*) # -h for help
+ ��膩��� 29 echo "$usage"
+ ��膩��� 30 exit 0
+ ��膩��� 31 ;;
+ ��膩��� 32 -m) # -m PERM arg
+ ��膩��� 33 shift
+ ��膩��� 34 test $# -eq 0 && { echo "$usage" 1>&2; exit 1; }
+ ��膩��� 35 dirmode=$1
+ ��膩��� 36 shift
+ ��膩��� 37 ;;
+ ��膩��� 38 --version)
+ ��膩��� 39 echo "$0 $scriptversion"
+ ��膩��� 40 exit 0
+ ��膩��� 41 ;;
+ ��膩��� 42 --) # stop option processing
+ ��膩��� 43 shift
+ ��膩��� 44 break
+ ��膩��� 45 ;;
+ ��膩��� 46 -*) # unknown option
+ ��膩��� 47 echo "$usage" 1>&2
+ ��膩��� 48 exit 1
+ ��膩��� 49 ;;
+ ��膩��� 50 *) # first non-opt arg
+ ��膩��� 51 break
+ ��膩��� 52 ;;
+ ��膩��� 53 esac
+ ��膩��� 54 done
+ ��膩��� 55
+ ��膩��� 56 for file
+ ��膩��� 57 do
+ ��膩��� 58 if test -d "$file"; then
+ ��膩��� 59 shift
+ ��膩��� 60 else
+ ��膩��� 61 break
+ ��膩��� 62 fi
+ ��膩��� 63 done
+ ��膩��� 64
+ ��膩��� 65 case $# in
+ ��膩��� 66 0) exit 0 ;;
+ ��膩��� 67 esac
+ ��膩��� 68
+ ��膩��� 69 # Solaris 8's mkdir -p isn't thread-safe. If you mkdir -p a/b and
+ ��膩��� 70 # mkdir -p a/c at the same time, both will detect that a is missing,
+ ��膩��� 71 # one will create a, then the other will try to create a and die with
+ ��膩��� 72 # a "File exists" error. This is a problem when calling mkinstalldirs
+ ��膩��� 73 # from a parallel make. We use --version in the probe to restrict
+ ��膩��� 74 # ourselves to GNU mkdir, which is thread-safe.
+ ��膩��� 75 case $dirmode in
+ ��膩��� 76 '')
+ ��膩��� 77 if mkdir -p --version . >/dev/null 2>&1 && test ! -d ./--version; then
+ ��膩��� 78 echo "mkdir -p -- $*"
+ ��膩��� 79 exec mkdir -p -- "$@"
+ ��膩��� 80 else
+ ��膩��� 81 # On NextStep and OpenStep, the `mkdir' command does not
+ ��膩��� 82 # recognize any option. It will interpret all options as
+ ��膩��� 83 # directories to create, and then abort because `.' already
+ ��膩��� 84 # exists.
+ ��膩��� 85 test -d ./-p && rmdir ./-p
+ ��膩��� 86 test -d ./--version && rmdir ./--version
+ ��膩��� 87 fi
+ ��膩��� 88 ;;
+ ��膩��� 89 *)
+ ��膩��� 90 if mkdir -m "$dirmode" -p --version . >/dev/null 2>&1 &&
+ ��膩��� 91 test ! -d ./--version; then
+ ��膩��� 92 echo "mkdir -m $dirmode -p -- $*"
+ ��膩��� 93 exec mkdir -m "$dirmode" -p -- "$@"
+ ��膩��� 94 else
+ ��膩��� 95 # Clean up after NextStep and OpenStep mkdir.
+ ��膩��� 96 for d in ./-m ./-p ./--version "./$dirmode";
+ ��膩��� 97 do
+ ��膩��� 98 test -d $d && rmdir $d
+ ��膩��� 99 done
+ ��膩��� 100 fi
+ ��膩��� 101 ;;
+ ��膩��� 102 esac
+ ��膩��� 103
+ ��膩��� 104 for file
+ ��膩��� 105 do
+ ��膩��� 106 set fnord `echo ":$file" | sed -ne 's/^:\//#/;s/^://;s/\// /g;s/^#/\//;p'`
+ ��膩��� 107 shift
+ ��膩��� 108
+ ��膩��� 109 pathcomp=
+ ��膩��� 110 for d
+ ��膩��� 111 do
+ ��膩��� 112 pathcomp="$pathcomp$d"
+ ��膩��� 113 case $pathcomp in
+ ��膩��� 114 -*) pathcomp=./$pathcomp ;;
+ ��膩��� 115 esac
+ ��膩��� 116
+ ��膩��� 117 if test ! -d "$pathcomp"; then
+ ��膩��� 118 echo "mkdir $pathcomp"
+ ��膩��� 119
+ ��膩��� 120 mkdir "$pathcomp" || lasterr=$?
+ ��膩��� 121
+ ��膩��� 122 if test ! -d "$pathcomp"; then
+ ��膩��� 123 errstatus=$lasterr
+ ��膩��� 124 else
+ ��膩��� 125 if test ! -z "$dirmode"; then
+ ��膩��� 126 echo "chmod $dirmode $pathcomp"
+ ��膩��� 127 lasterr=""
+ ��膩��� 128 chmod "$dirmode" "$pathcomp" || lasterr=$?
+ ��膩��� 129
+ ��膩��� 130 if test ! -z "$lasterr"; then
+ ��膩��� 131 errstatus=$lasterr
+ ��膩��� 132 fi
+ ��膩��� 133 fi
+ ��膩��� 134 fi
+ ��膩��� 135 fi
+ ��膩��� 136
+ ��膩��� 137 pathcomp="$pathcomp/"
+ ��膩��� 138 done
+ ��膩��� 139 done
+ ��膩��� 140
+ ��膩��� 141 exit $errstatus
+ ��膩��� 142
+ ��膩��� 143 # Local Variables:
+ ��膩��� 144 # mode: shell-script
+ ��膩��� 145 # sh-indentation: 2
+ ��膩��� 146 # eval: (add-hook 'write-file-hooks 'time-stamp)
+ ��膩��� 147 # time-stamp-start: "scriptversion="
+ ��膩��� 148 # time-stamp-format: "%:y-%02m-%02d.%02H"
+ ��膩��� 149 # time-stamp-end: "$"
+ ��膩��� 150 # End: