2
2
# install - install a program, script, or datafile
4
scriptversion=2004-04-01.17
4
scriptversion=2004-02-15.20
6
6
# This originates from X11R5 (mit/util/scripts/install.sh), which was
7
7
# later released in X11R6 (xc/config/util/install.sh) with the
280
280
&& { test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } \
281
281
&& { test -z "$chmodcmd" || $doit $chmodcmd "$dsttmp"; } &&
283
# Now remove or move aside any old file at destination location. We
284
# try this two ways since rm can't unlink itself on some systems and
285
# the destination file might be busy for other reasons. In this case,
286
# the final cleanup might fail but the new file should still install
289
if test -f "$dstdir/$dstfile"; then
290
$doit $rmcmd -f "$dstdir/$dstfile" 2>/dev/null \
291
|| $doit $mvcmd -f "$dstdir/$dstfile" "$rmtmp" 2>/dev/null \
293
echo "$0: cannot unlink or rename $dstdir/$dstfile" >&2
283
301
# Now rename the file to the real destination.
284
{ $doit $mvcmd -f "$dsttmp" "$dstdir/$dstfile" 2>/dev/null \
286
# The rename failed, perhaps because mv can't rename something else
287
# to itself, or perhaps because mv is so ancient that it does not
290
# Now remove or move aside any old file at destination location.
291
# We try this two ways since rm can't unlink itself on some
292
# systems and the destination file might be busy for other
293
# reasons. In this case, the final cleanup might fail but the new
294
# file should still install successfully.
296
if test -f "$dstdir/$dstfile"; then
297
$doit $rmcmd -f "$dstdir/$dstfile" 2>/dev/null \
298
|| $doit $mvcmd -f "$dstdir/$dstfile" "$rmtmp" 2>/dev/null \
300
echo "$0: cannot unlink or rename $dstdir/$dstfile" >&2
308
# Now rename the file to the real destination.
309
$doit $mvcmd "$dsttmp" "$dstdir/$dstfile"
302
$doit $mvcmd "$dsttmp" "$dstdir/$dstfile"
312
303
fi || { (exit 1); exit; }