OpenCores
URL https://opencores.org/ocsvn/or1k/or1k/trunk

Subversion Repositories or1k

[/] [or1k/] [trunk/] [insight/] [tcl/] [unix/] [install-sh] - Diff between revs 578 and 1765

Go to most recent revision | Only display areas with differences | Details | Blame | View Log

Rev 578 Rev 1765
#!/bin/sh
#!/bin/sh
#
#
# install - install a program, script, or datafile
# install - install a program, script, or datafile
# This comes from X11R5; it is not part of GNU.
# This comes from X11R5; it is not part of GNU.
#
#
# $XConsortium: install.sh,v 1.2 89/12/18 14:47:22 jim Exp $
# $XConsortium: install.sh,v 1.2 89/12/18 14:47:22 jim Exp $
#
#
# This script is compatible with the BSD install script, but was written
# This script is compatible with the BSD install script, but was written
# from scratch.
# from scratch.
#
#
# set DOITPROG to echo to test this script
# set DOITPROG to echo to test this script
# Don't use :- since 4.3BSD and earlier shells don't like it.
# Don't use :- since 4.3BSD and earlier shells don't like it.
doit="${DOITPROG-}"
doit="${DOITPROG-}"
# put in absolute paths if you don't have them in your path; or use env. vars.
# put in absolute paths if you don't have them in your path; or use env. vars.
mvprog="${MVPROG-mv}"
mvprog="${MVPROG-mv}"
cpprog="${CPPROG-cp}"
cpprog="${CPPROG-cp}"
chmodprog="${CHMODPROG-chmod}"
chmodprog="${CHMODPROG-chmod}"
chownprog="${CHOWNPROG-chown}"
chownprog="${CHOWNPROG-chown}"
chgrpprog="${CHGRPPROG-chgrp}"
chgrpprog="${CHGRPPROG-chgrp}"
stripprog="${STRIPPROG-strip}"
stripprog="${STRIPPROG-strip}"
rmprog="${RMPROG-rm}"
rmprog="${RMPROG-rm}"
instcmd="$mvprog"
instcmd="$mvprog"
chmodcmd=""
chmodcmd=""
chowncmd=""
chowncmd=""
chgrpcmd=""
chgrpcmd=""
stripcmd=""
stripcmd=""
rmcmd="$rmprog -f"
rmcmd="$rmprog -f"
mvcmd="$mvprog"
mvcmd="$mvprog"
src=""
src=""
dst=""
dst=""
while [ x"$1" != x ]; do
while [ x"$1" != x ]; do
    case $1 in
    case $1 in
        -c) instcmd="$cpprog"
        -c) instcmd="$cpprog"
            shift
            shift
            continue;;
            continue;;
        -m) chmodcmd="$chmodprog $2"
        -m) chmodcmd="$chmodprog $2"
            shift
            shift
            shift
            shift
            continue;;
            continue;;
        -o) chowncmd="$chownprog $2"
        -o) chowncmd="$chownprog $2"
            shift
            shift
            shift
            shift
            continue;;
            continue;;
        -g) chgrpcmd="$chgrpprog $2"
        -g) chgrpcmd="$chgrpprog $2"
            shift
            shift
            shift
            shift
            continue;;
            continue;;
        -s) stripcmd="$stripprog"
        -s) stripcmd="$stripprog"
            shift
            shift
            continue;;
            continue;;
        *)  if [ x"$src" = x ]
        *)  if [ x"$src" = x ]
            then
            then
                src=$1
                src=$1
            else
            else
                dst=$1
                dst=$1
            fi
            fi
            shift
            shift
            continue;;
            continue;;
    esac
    esac
done
done
if [ x"$src" = x ]
if [ x"$src" = x ]
then
then
        echo "install:  no input file specified"
        echo "install:  no input file specified"
        exit 1
        exit 1
fi
fi
if [ x"$dst" = x ]
if [ x"$dst" = x ]
then
then
        echo "install:  no destination specified"
        echo "install:  no destination specified"
        exit 1
        exit 1
fi
fi
# If destination is a directory, append the input filename; if your system
# 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
# does not like double slashes in filenames, you may need to add some logic
if [ -d $dst ]
if [ -d $dst ]
then
then
        dst="$dst"/`basename $src`
        dst="$dst"/`basename $src`
fi
fi
# Make a temp file name in the proper directory.
# Make a temp file name in the proper directory.
dstdir=`dirname $dst`
dstdir=`dirname $dst`
dsttmp=$dstdir/#inst.$$#
dsttmp=$dstdir/#inst.$$#
# Move or copy the file name to the temp name
# Move or copy the file name to the temp name
$doit $instcmd $src $dsttmp
$doit $instcmd $src $dsttmp
# and set any options; do chmod last to preserve setuid bits
# and set any options; do chmod last to preserve setuid bits
if [ x"$chowncmd" != x ]; then $doit $chowncmd $dsttmp; fi
if [ x"$chowncmd" != x ]; then $doit $chowncmd $dsttmp; fi
if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dsttmp; fi
if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dsttmp; fi
if [ x"$stripcmd" != x ]; then $doit $stripcmd $dsttmp; fi
if [ x"$stripcmd" != x ]; then $doit $stripcmd $dsttmp; fi
if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dsttmp; fi
if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dsttmp; fi
# Now rename the file to the real destination.
# Now rename the file to the real destination.
$doit $rmcmd $dst
$doit $rmcmd $dst
$doit $mvcmd $dsttmp $dst
$doit $mvcmd $dsttmp $dst
exit 0
exit 0
 
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.