diff options
author | Jim Meyering <jim@meyering.net> | 2006-05-29 06:55:36 +0000 |
---|---|---|
committer | Jim Meyering <jim@meyering.net> | 2006-05-29 06:55:36 +0000 |
commit | 90407bb522614258f4618d68670345bd55ad1b24 (patch) | |
tree | 4708999fd1109ffd658321934eed30f514ee266e /build-aux/install-sh | |
parent | a143307078deb9e894618223b938544404873e52 (diff) | |
download | coreutils-90407bb522614258f4618d68670345bd55ad1b24.tar.xz |
Update from gnulib.
Diffstat (limited to 'build-aux/install-sh')
-rwxr-xr-x | build-aux/install-sh | 48 |
1 files changed, 35 insertions, 13 deletions
diff --git a/build-aux/install-sh b/build-aux/install-sh index 220d6647e..f746d0f80 100755 --- a/build-aux/install-sh +++ b/build-aux/install-sh @@ -1,7 +1,7 @@ #!/bin/sh # install - install a program, script, or datafile -scriptversion=2006-04-25.22 +scriptversion=2006-05-11.20 # This originates from X11R5 (mit/util/scripts/install.sh), which was # later released in X11R6 (xc/config/util/install.sh) with the @@ -42,12 +42,17 @@ scriptversion=2006-04-25.22 # from scratch. It can only install one file at a time, a restriction # shared with many OS's install programs. +nl=' +' +IFS=" "" $nl" + # set DOITPROG to echo to test this script # Don't use :- since 4.3BSD and earlier shells don't like it. doit="${DOITPROG-}" -# put in absolute paths if you don't have them in your path; or use env. vars. +# Put in absolute file names if you don't have them in your path; +# or use environment vars. mvprog="${MVPROG-mv}" cpprog="${CPPROG-cp}" @@ -311,9 +316,9 @@ do # step, checking for races as we go. case $dstdir in - /*) pathcomp=/ ;; - -*) pathcomp=./ ;; - *) pathcomp= ;; + /*) prefix=/ ;; + -*) prefix=./ ;; + *) prefix= ;; esac case $posix_glob in @@ -333,19 +338,36 @@ do $posix_glob && set +f IFS=$oIFS + prefixes= + for d do - test "x$d" = x && continue + test -z "$d" && continue - pathcomp=$pathcomp$d - if test ! -d "$pathcomp"; then - $mkdirprog "$pathcomp" - # Don't fail if two instances are running concurrently. - test -d "$pathcomp" || exit 1 + prefix=$prefix$d + if test -d "$prefix"; then + prefixes= + else + if $posix_mkdir; then + $mkdirprog -m "$mkdir_mode" -p -- "$dstdir" && break + # Don't fail if two instances are running concurrently. + test -d "$prefix" || exit 1 + else + case $prefix in + *\'*) qprefix=`echo "$prefix" | sed "s/'/'\\\\\\\\''/g"`;; + *) qprefix=$prefix;; + esac + prefixes="$prefixes '$qprefix'" + fi fi - pathcomp=$pathcomp/ + prefix=$prefix/ done - obsolete_mkdir_used=true + + if test -n "$prefixes"; then + # Don't fail if two instances are running concurrently. + eval "\$mkdirprog $prefixes" || test -d "$dstdir" || exit 1 + obsolete_mkdir_used=true + fi fi fi |