]>
git.saurik.com Git - apple/launchd.git/blob - launchd/mkinstalldirs
2 # mkinstalldirs --- make directory hierarchy
3 # Author: Noah Friedman <friedman@prep.ai.mit.edu>
11 Usage: mkinstalldirs [-h] [--help] [-m mode] dir ..."
13 # process command line arguments
14 while test $# -gt 0 ; do
16 -h | --help | --h* ) # -h for help
17 echo "${usage}" 1>&2; exit 0 ;;
20 test $# -eq 0 && { echo "${usage}" 1>&2; exit 1; }
23 -- ) shift; break ;; # stop option processing
24 -* ) echo "${usage}" 1>&2; exit 1 ;; # unknown option
25 * ) break ;; # first non-opt arg
31 if test -d "$file"; then
44 if mkdir -p -- .
2>/dev
/null
; then
49 if mkdir -m "$dirmode" -p -- .
2>/dev
/null
; then
50 echo "mkdir -m $dirmode -p -- $*"
51 exec mkdir -m "$dirmode" -p -- "$@"
57 set fnord
`echo ":$file" | sed -ne 's/^:\//#/;s/^://;s/\// /g;s/^#/\//;p'`
63 pathcomp
="$pathcomp$d"
65 -* ) pathcomp
=.
/$pathcomp ;;
68 if test ! -d "$pathcomp"; then
69 echo "mkdir $pathcomp"
71 mkdir "$pathcomp" || lasterr
=$?
73 if test ! -d "$pathcomp"; then
76 if test ! -z "$dirmode"; then
77 echo "chmod $dirmode $pathcomp"
80 chmod "$dirmode" "$pathcomp" || lasterr
=$?
82 if test ! -z "$lasterr"; then
99 # mkinstalldirs ends here