2 # Copyright (C) 2006-2013 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
21 # mkinstalldirs --- make directory hierarchy
22 # Author: Noah Friedman <friedman@prep.ai.mit.edu>
30 Usage: mkinstalldirs [-h] [--help] [-m mode] dir ..."
32 # process command line arguments
33 while test $# -gt 0 ; do
35 -h | --help | --h* ) # -h for help
36 echo "${usage}" 1>&2; exit 0 ;;
39 test $# -eq 0 && { echo "${usage}" 1>&2; exit 1; }
42 -- ) shift; break ;; # stop option processing
43 -* ) echo "${usage}" 1>&2; exit 1 ;; # unknown option
44 * ) break ;; # first non-opt arg
50 if test -d "$file"; then
63 if mkdir -p -- . 2>/dev/null; then
68 if mkdir -m "$dirmode" -p -- . 2>/dev/null; then
69 echo "mkdir -m $dirmode -p -- $*"
70 exec mkdir -m "$dirmode" -p -- "$@"
76 set fnord `echo ":$file" | sed -ne 's/^:\//#/;s/^://;s/\// /g;s/^#/\//;p'`
82 pathcomp="$pathcomp$d"
84 -* ) pathcomp=./$pathcomp ;;
87 if test ! -d "$pathcomp"; then
88 echo "mkdir $pathcomp"
90 mkdir "$pathcomp" || lasterr=$?
92 if test ! -d "$pathcomp"; then
95 if test ! -z "$dirmode"; then
96 echo "chmod $dirmode $pathcomp"
99 chmod "$dirmode" "$pathcomp" || lasterr=$?
101 if test ! -z "$lasterr"; then
108 pathcomp="$pathcomp/"
118 # mkinstalldirs ends here