2 # Copyright (C) 2006-2008 CEA/DEN, EDF R&D
4 # This library is free software; you can redistribute it and/or
5 # modify it under the terms of the GNU Lesser General Public
6 # License as published by the Free Software Foundation; either
7 # version 2.1 of the License.
9 # This library is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 # Lesser General Public License for more details.
14 # You should have received a copy of the GNU Lesser General Public
15 # License along with this library; if not, write to the Free Software
16 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
20 # mkinstalldirs --- make directory hierarchy
21 # Author: Noah Friedman <friedman@prep.ai.mit.edu>
29 Usage: mkinstalldirs [-h] [--help] [-m mode] dir ..."
31 # process command line arguments
32 while test $# -gt 0 ; do
34 -h | --help | --h* ) # -h for help
35 echo "${usage}" 1>&2; exit 0 ;;
38 test $# -eq 0 && { echo "${usage}" 1>&2; exit 1; }
41 -- ) shift; break ;; # stop option processing
42 -* ) echo "${usage}" 1>&2; exit 1 ;; # unknown option
43 * ) break ;; # first non-opt arg
49 if test -d "$file"; then
62 if mkdir -p -- . 2>/dev/null; then
67 if mkdir -m "$dirmode" -p -- . 2>/dev/null; then
68 echo "mkdir -m $dirmode -p -- $*"
69 exec mkdir -m "$dirmode" -p -- "$@"
75 set fnord `echo ":$file" | sed -ne 's/^:\//#/;s/^://;s/\// /g;s/^#/\//;p'`
81 pathcomp="$pathcomp$d"
83 -* ) pathcomp=./$pathcomp ;;
86 if test ! -d "$pathcomp"; then
87 echo "mkdir $pathcomp"
89 mkdir "$pathcomp" || lasterr=$?
91 if test ! -d "$pathcomp"; then
94 if test ! -z "$dirmode"; then
95 echo "chmod $dirmode $pathcomp"
98 chmod "$dirmode" "$pathcomp" || lasterr=$?
100 if test ! -z "$lasterr"; then
107 pathcomp="$pathcomp/"
117 # mkinstalldirs ends here