comparison build-aux/install-sh @ 5978:ee280efaa0fb

autoupdate
author Karl Berry <karl@freefriends.org>
date Sun, 10 Jul 2005 12:38:11 +0000
parents 49fa4c5819d0
children a0fb75f11ca0
comparison
equal deleted inserted replaced
5977:044f3909fcee 5978:ee280efaa0fb
1 #!/bin/sh 1 #!/bin/sh
2 # install - install a program, script, or datafile 2 # install - install a program, script, or datafile
3 3
4 scriptversion=2005-05-14.22 4 scriptversion=2005-07-09.12
5 5
6 # This originates from X11R5 (mit/util/scripts/install.sh), which was 6 # This originates from X11R5 (mit/util/scripts/install.sh), which was
7 # later released in X11R6 (xc/config/util/install.sh) with the 7 # later released in X11R6 (xc/config/util/install.sh) with the
8 # following copyright and license. 8 # following copyright and license.
9 # 9 #
217 217
218 # Make sure that the destination directory exists. 218 # Make sure that the destination directory exists.
219 219
220 # Skip lots of stat calls in the usual case. 220 # Skip lots of stat calls in the usual case.
221 if test ! -d "$dstdir"; then 221 if test ! -d "$dstdir"; then
222 defaultIFS=' 222 case $dstdir in
223 ' 223 /*) pathcomp=/ ;;
224 IFS="${IFS-$defaultIFS}" 224 -*) pathcomp=./ ;;
225 225 *) pathcomp= ;;
226 esac
226 oIFS=$IFS 227 oIFS=$IFS
227 # Some sh's can't handle IFS=/ for some reason. 228 IFS=/
228 IFS='%' 229 set fnord $dstdir
229 set x `echo "$dstdir" | sed -e 's@/@%@g' -e 's@^%@/@'`
230 shift 230 shift
231 IFS=$oIFS 231 IFS=$oIFS
232 232
233 pathcomp= 233 for d
234 234 do
235 while test $# -ne 0 ; do 235 test "x$d" = x && continue
236 pathcomp=$pathcomp$1 236
237 shift 237 pathcomp=$pathcomp$d
238 if test ! -d "$pathcomp"; then 238 if test ! -d "$pathcomp"; then
239 $mkdirprog "$pathcomp" 239 $mkdirprog "$pathcomp"
240 # mkdir can fail with a `File exist' error in case several 240 # mkdir can fail with a `File exist' error in case several
241 # install-sh are creating the directory concurrently. This 241 # install-sh are creating the directory concurrently. This
242 # is OK. 242 # is OK.
243 test -d "$pathcomp" || exit 243 test -d "$pathcomp" || exit 1
244 fi 244 fi
245 pathcomp=$pathcomp/ 245 pathcomp=$pathcomp/
246 done 246 done
247 fi 247 fi
248 248