| # mkinstalldirs --- make directory hierarchy |
| # Author: Noah Friedman <friedman@prep.ai.mit.edu> |
| Usage: mkinstalldirs [-h] [--help] [-m mode] dir ..." |
| # process command line arguments |
| -h | --help | --h* ) # -h for help |
| echo "${usage}" 1>&2; exit 0 ;; |
| test $# -eq 0 && { echo "${usage}" 1>&2; exit 1; } |
| -- ) shift; break ;; # stop option processing |
| -* ) echo "${usage}" 1>&2; exit 1 ;; # unknown option |
| * ) break ;; # first non-opt arg |
| if mkdir -p -- . 2>/dev/null; then |
| # We cannot trust mkdir to set the proper permissions on |
| # parent directories. So create them manually. |
| if test ! -d "$pathcomp"; then |
| mkdir "$pathcomp" || lasterr=$? |
| if test ! -d "$pathcomp"; then |
| elif test -n "$dirmode"; then |
| echo "chmod $dirmode $pathcomp" |
| chmod "$dirmode" "$pathcomp" || lasterr=$? |
| if test -n "$lasterr"; then |
| # mkinstalldirs ends here |