815f157c05
2009-01-19 15:47:39 +0100 rene r266508 : CWS-TOOLING: rebase CWS configuretoplevel to trunk@266428 (milestone: DEV300:m39) 2009-01-18 00:35:31 +0100 rene r266462 : #i10000# Mac OS X "of course" has other paths... 2009-01-16 13:24:23 +0100 rene r266415 : make OS2 use STLport... 2009-01-15 22:08:38 +0100 rene r266393 : STLport for FreeBSD 2009-01-15 01:23:51 +0100 rene r266333 : #i98048# harmonize STL default; default to *NOT* use STLport 2009-01-09 22:44:43 +0100 rene r266120 : #i97428# try to find out XLIB via pkg-config 2009-01-09 22:41:18 +0100 rene r266119 : #i97827# fail when we don't find make 2008-12-27 01:19:34 +0100 rene r265812 : add make (dis)clean; force /bin/sh as we source *Enc.Set.sh 2008-12-27 01:16:31 +0100 rene r265811 : fix makefile.rc for config.*/config_office move 2008-12-26 22:37:54 +0100 rene r265810 : #i91641# in some cases, we also need the -Xbootclasspath at the second javac call 2008-12-26 17:55:11 +0100 rene r265806 : actually commit Makefile.in 2008-12-25 19:24:24 +0100 rene r265803 : CWS-TOOLING: rebase CWS configuretoplevel to trunk@265758 (milestone: DEV300:m38) 2008-12-10 22:51:06 +0100 rene r265232 : #i96912# revert, cws swffixes02 has the right fix 2008-12-08 18:47:10 +0100 rene r265014 : xulrunner has no /plugin or /nspr 2008-12-08 17:51:28 +0100 rene r265013 : i96912# fix --with-system-mozilla 2008-12-05 13:05:55 +0100 rene r264903 : #i95339# 2008-12-04 17:53:53 +0100 rene r264865 : fix merge error #i80238# add help for --with-epm 2008-12-04 17:44:28 +0100 rene r264864 : #i91641# fix build with JDKs already including a version of rhino which conflicts with our ancient one 2008-12-04 17:40:48 +0100 rene r264863 : i93429# check for sanity for expand.exe 2008-12-04 17:34:20 +0100 rene r264862 : config_office changes from m33 to m37 2008-12-04 17:28:55 +0100 rene r264861 : CWS-TOOLING: rebase CWS configuretoplevel to trunk@264807 (milestone: DEV300:m37) 2008-12-04 16:49:03 +0100 rene r264856 : fix cws. part 5 2008-12-04 16:45:06 +0100 rene r264855 : fix cws, part 4 2008-12-04 16:01:49 +0100 rene r264850 : fix cws, part 3 2008-12-04 15:14:12 +0100 rene r264848 : fix cws, part 2
276 lines
6.2 KiB
Bash
276 lines
6.2 KiB
Bash
#!/bin/sh
|
|
#
|
|
# install - install a program, script, or datafile
|
|
# This comes from X11R5 (mit/util/scripts/install.sh).
|
|
#
|
|
# Copyright 1991 by the Massachusetts Institute of Technology
|
|
#
|
|
# Permission to use, copy, modify, distribute, and sell this software and its
|
|
# documentation for any purpose is hereby granted without fee, provided that
|
|
# the above copyright notice appear in all copies and that both that
|
|
# copyright notice and this permission notice appear in supporting
|
|
# documentation, and that the name of M.I.T. not be used in advertising or
|
|
# publicity pertaining to distribution of the software without specific,
|
|
# written prior permission. M.I.T. makes no representations about the
|
|
# suitability of this software for any purpose. It is provided "as is"
|
|
# without express or implied warranty.
|
|
#
|
|
# Calling this script install-sh is preferred over install.sh, to prevent
|
|
# `make' implicit rules from creating a file called install from it
|
|
# when there is no Makefile.
|
|
#
|
|
# This script is compatible with the BSD install script, but was written
|
|
# from scratch. It can only install one file at a time, a restriction
|
|
# shared with many OS's install programs.
|
|
|
|
|
|
# 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.
|
|
|
|
mvprog="${MVPROG-mv}"
|
|
cpprog="${CPPROG-cp}"
|
|
chmodprog="${CHMODPROG-chmod}"
|
|
chownprog="${CHOWNPROG-chown}"
|
|
chgrpprog="${CHGRPPROG-chgrp}"
|
|
stripprog="${STRIPPROG-strip}"
|
|
rmprog="${RMPROG-rm}"
|
|
mkdirprog="${MKDIRPROG-mkdir}"
|
|
|
|
transformbasename=""
|
|
transform_arg=""
|
|
instcmd="$mvprog"
|
|
chmodcmd="$chmodprog 0755"
|
|
chowncmd=""
|
|
chgrpcmd=""
|
|
stripcmd=""
|
|
rmcmd="$rmprog -f"
|
|
mvcmd="$mvprog"
|
|
src=""
|
|
dst=""
|
|
dir_arg=""
|
|
|
|
while [ x"$1" != x ]; do
|
|
case $1 in
|
|
-c) instcmd=$cpprog
|
|
shift
|
|
continue;;
|
|
|
|
-d) dir_arg=true
|
|
shift
|
|
continue;;
|
|
|
|
-m) chmodcmd="$chmodprog $2"
|
|
shift
|
|
shift
|
|
continue;;
|
|
|
|
-o) chowncmd="$chownprog $2"
|
|
shift
|
|
shift
|
|
continue;;
|
|
|
|
-g) chgrpcmd="$chgrpprog $2"
|
|
shift
|
|
shift
|
|
continue;;
|
|
|
|
-s) stripcmd=$stripprog
|
|
shift
|
|
continue;;
|
|
|
|
-t=*) transformarg=`echo $1 | sed 's/-t=//'`
|
|
shift
|
|
continue;;
|
|
|
|
-b=*) transformbasename=`echo $1 | sed 's/-b=//'`
|
|
shift
|
|
continue;;
|
|
|
|
*) if [ x"$src" = x ]
|
|
then
|
|
src=$1
|
|
else
|
|
# this colon is to work around a 386BSD /bin/sh bug
|
|
:
|
|
dst=$1
|
|
fi
|
|
shift
|
|
continue;;
|
|
esac
|
|
done
|
|
|
|
if [ x"$src" = x ]
|
|
then
|
|
echo "$0: no input file specified" >&2
|
|
exit 1
|
|
else
|
|
:
|
|
fi
|
|
|
|
if [ x"$dir_arg" != x ]; then
|
|
dst=$src
|
|
src=""
|
|
|
|
if [ -d "$dst" ]; then
|
|
instcmd=:
|
|
chmodcmd=""
|
|
else
|
|
instcmd=$mkdirprog
|
|
fi
|
|
else
|
|
|
|
# Waiting for this to be detected by the "$instcmd $src $dsttmp" command
|
|
# might cause directories to be created, which would be especially bad
|
|
# if $src (and thus $dsttmp) contains '*'.
|
|
|
|
if [ -f "$src" ] || [ -d "$src" ]
|
|
then
|
|
:
|
|
else
|
|
echo "$0: $src does not exist" >&2
|
|
exit 1
|
|
fi
|
|
|
|
if [ x"$dst" = x ]
|
|
then
|
|
echo "$0: no destination specified" >&2
|
|
exit 1
|
|
else
|
|
:
|
|
fi
|
|
|
|
# If destination is a directory, append the input filename; if your system
|
|
# does not like double slashes in filenames, you may need to add some logic
|
|
|
|
if [ -d "$dst" ]
|
|
then
|
|
dst=$dst/`basename "$src"`
|
|
else
|
|
:
|
|
fi
|
|
fi
|
|
|
|
## this sed command emulates the dirname command
|
|
dstdir=`echo "$dst" | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'`
|
|
|
|
# Make sure that the destination directory exists.
|
|
# this part is taken from Noah Friedman's mkinstalldirs script
|
|
|
|
# Skip lots of stat calls in the usual case.
|
|
if [ ! -d "$dstdir" ]; then
|
|
defaultIFS='
|
|
'
|
|
IFS="${IFS-$defaultIFS}"
|
|
|
|
oIFS=$IFS
|
|
# Some sh's can't handle IFS=/ for some reason.
|
|
IFS='%'
|
|
set - `echo "$dstdir" | sed -e 's@/@%@g' -e 's@^%@/@'`
|
|
IFS=$oIFS
|
|
|
|
pathcomp=''
|
|
|
|
while [ $# -ne 0 ] ; do
|
|
pathcomp=$pathcomp$1
|
|
shift
|
|
|
|
if [ ! -d "$pathcomp" ] ;
|
|
then
|
|
$mkdirprog "$pathcomp"
|
|
else
|
|
:
|
|
fi
|
|
|
|
pathcomp=$pathcomp/
|
|
done
|
|
fi
|
|
|
|
if [ x"$dir_arg" != x ]
|
|
then
|
|
$doit $instcmd "$dst" &&
|
|
|
|
if [ x"$chowncmd" != x ]; then $doit $chowncmd "$dst"; else : ; fi &&
|
|
if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd "$dst"; else : ; fi &&
|
|
if [ x"$stripcmd" != x ]; then $doit $stripcmd "$dst"; else : ; fi &&
|
|
if [ x"$chmodcmd" != x ]; then $doit $chmodcmd "$dst"; else : ; fi
|
|
else
|
|
|
|
# If we're going to rename the final executable, determine the name now.
|
|
|
|
if [ x"$transformarg" = x ]
|
|
then
|
|
dstfile=`basename "$dst"`
|
|
else
|
|
dstfile=`basename "$dst" $transformbasename |
|
|
sed $transformarg`$transformbasename
|
|
fi
|
|
|
|
# don't allow the sed command to completely eliminate the filename
|
|
|
|
if [ x"$dstfile" = x ]
|
|
then
|
|
dstfile=`basename "$dst"`
|
|
else
|
|
:
|
|
fi
|
|
|
|
# Make a couple of temp file names in the proper directory.
|
|
|
|
dsttmp=$dstdir/#inst.$$#
|
|
rmtmp=$dstdir/#rm.$$#
|
|
|
|
# Trap to clean up temp files at exit.
|
|
|
|
trap 'status=$?; rm -f "$dsttmp" "$rmtmp" && exit $status' 0
|
|
trap '(exit $?); exit' 1 2 13 15
|
|
|
|
# Move or copy the file name to the temp name
|
|
|
|
$doit $instcmd "$src" "$dsttmp" &&
|
|
|
|
# and set any options; do chmod last to preserve setuid bits
|
|
|
|
# If any of these fail, we abort the whole thing. If we want to
|
|
# ignore errors from any of these, just make sure not to ignore
|
|
# errors from the above "$doit $instcmd $src $dsttmp" command.
|
|
|
|
if [ x"$chowncmd" != x ]; then $doit $chowncmd "$dsttmp"; else :;fi &&
|
|
if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd "$dsttmp"; else :;fi &&
|
|
if [ x"$stripcmd" != x ]; then $doit $stripcmd "$dsttmp"; else :;fi &&
|
|
if [ x"$chmodcmd" != x ]; then $doit $chmodcmd "$dsttmp"; else :;fi &&
|
|
|
|
# Now remove or move aside any old file at destination location. We try this
|
|
# two ways since rm can't unlink itself on some systems and the destination
|
|
# file might be busy for other reasons. In this case, the final cleanup
|
|
# might fail but the new file should still install successfully.
|
|
|
|
{
|
|
if [ -f "$dstdir/$dstfile" ]
|
|
then
|
|
$doit $rmcmd -f "$dstdir/$dstfile" 2>/dev/null ||
|
|
$doit $mvcmd -f "$dstdir/$dstfile" "$rmtmp" 2>/dev/null ||
|
|
{
|
|
echo "$0: cannot unlink or rename $dstdir/$dstfile" >&2
|
|
(exit 1); exit
|
|
}
|
|
else
|
|
:
|
|
fi
|
|
} &&
|
|
|
|
# Now rename the file to the real destination.
|
|
|
|
$doit $mvcmd "$dsttmp" "$dstdir/$dstfile"
|
|
|
|
fi &&
|
|
|
|
# The final little trick to "correctly" pass the exit status to the exit trap.
|
|
|
|
{
|
|
(exit 0); exit
|
|
}
|