/[debian]/mimetic/trunk/mkinstalldirs
ViewVC logotype

Diff of /mimetic/trunk/mkinstalldirs

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 131 by gregoa, Sat Feb 25 16:49:58 2006 UTC revision 1444 by gregoa, Thu Sep 18 20:33:08 2008 UTC
# Line 4  Line 4 
4  # Created: 1993-05-16  # Created: 1993-05-16
5  # Public domain  # Public domain
6    
 # $Id: mkinstalldirs,v 1.13 1999/01/05 03:18:55 bje Exp $  
   
7  errstatus=0  errstatus=0
8    dirmode=""
9    
10    usage="\
11    Usage: mkinstalldirs [-h] [--help] [-m mode] dir ..."
12    
13    # process command line arguments
14    while test $# -gt 0 ; do
15       case "${1}" in
16         -h | --help | --h* )                       # -h for help
17            echo "${usage}" 1>&2; exit 0 ;;
18         -m )                                       # -m PERM arg
19            shift
20            test $# -eq 0 && { echo "${usage}" 1>&2; exit 1; }
21            dirmode="${1}"
22            shift ;;
23         -- ) shift; break ;;                       # stop option processing
24         -* ) echo "${usage}" 1>&2; exit 1 ;;       # unknown option
25         * )  break ;;                              # first non-opt arg
26       esac
27    done
28    
29    for file
30    do
31      if test -d "$file"; then
32        shift
33      else
34        break
35      fi
36    done
37    
38    case $# in
39    0) exit 0 ;;
40    esac
41    
42    case $dirmode in
43    '')
44      if mkdir -p -- . 2>/dev/null; then
45        echo "mkdir -p -- $*"
46        exec mkdir -p -- "$@"
47      fi ;;
48    *)
49      if mkdir -m "$dirmode" -p -- . 2>/dev/null; then
50        echo "mkdir -m $dirmode -p -- $*"
51        exec mkdir -m "$dirmode" -p -- "$@"
52      fi ;;
53    esac
54    
55  for file  for file
56  do  do
# Line 22  do Line 66  do
66       esac       esac
67    
68       if test ! -d "$pathcomp"; then       if test ! -d "$pathcomp"; then
69          echo "mkdir $pathcomp"          echo "mkdir $pathcomp"
70    
71          mkdir "$pathcomp" || lasterr=$?          mkdir "$pathcomp" || lasterr=$?
72    
73          if test ! -d "$pathcomp"; then          if test ! -d "$pathcomp"; then
74            errstatus=$lasterr            errstatus=$lasterr
75          fi          else
76              if test ! -z "$dirmode"; then
77                 echo "chmod $dirmode $pathcomp"
78    
79                 lasterr=""
80                 chmod "$dirmode" "$pathcomp" || lasterr=$?
81    
82                 if test ! -z "$lasterr"; then
83                   errstatus=$lasterr
84                 fi
85              fi
86            fi
87       fi       fi
88    
89       pathcomp="$pathcomp/"       pathcomp="$pathcomp/"
# Line 37  done Line 92  done
92    
93  exit $errstatus  exit $errstatus
94    
95    # Local Variables:
96    # mode: shell-script
97    # sh-indentation: 3
98    # End:
99  # mkinstalldirs ends here  # mkinstalldirs ends here

Legend:
Removed from v.131  
changed lines
  Added in v.1444

  ViewVC Help
Powered by ViewVC 1.1.26