--- deliantra/server/utils/mkinstalldirs 2006/02/03 07:14:50 1.1 +++ deliantra/server/utils/mkinstalldirs 2007/03/06 19:02:36 1.2 @@ -1,7 +1,7 @@ #! /bin/sh # mkinstalldirs --- make directory hierarchy -scriptversion=2004-02-15.20 +scriptversion=2005-06-29.22 # Original author: Noah Friedman # Created: 1993-05-16 @@ -12,7 +12,7 @@ # . errstatus=0 -dirmode="" +dirmode=755 usage="\ Usage: mkinstalldirs [-h] [--help] [--version] [-m MODE] DIR ... @@ -27,7 +27,7 @@ case $1 in -h | --help | --h*) # -h for help echo "$usage" - exit 0 + exit $? ;; -m) # -m PERM arg shift @@ -37,7 +37,7 @@ ;; --version) echo "$0 $scriptversion" - exit 0 + exit $? ;; --) # stop option processing shift @@ -103,13 +103,21 @@ for file do - set fnord `echo ":$file" | sed -ne 's/^:\//#/;s/^://;s/\// /g;s/^#/\//;p'` + case $file in + /*) pathcomp=/ ;; + *) pathcomp= ;; + esac + oIFS=$IFS + IFS=/ + set fnord $file shift + IFS=$oIFS - pathcomp= for d do - pathcomp="$pathcomp$d" + test "x$d" = x && continue + + pathcomp=$pathcomp$d case $pathcomp in -*) pathcomp=./$pathcomp ;; esac @@ -124,7 +132,7 @@ else if test ! -z "$dirmode"; then echo "chmod $dirmode $pathcomp" - lasterr="" + lasterr= chmod "$dirmode" "$pathcomp" || lasterr=$? if test ! -z "$lasterr"; then @@ -134,7 +142,7 @@ fi fi - pathcomp="$pathcomp/" + pathcomp=$pathcomp/ done done