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

Subversion Repositories or1k

[/] [or1k/] [trunk/] [insight/] [tk/] [unix/] [install-sh] - Blame information for rev 1765

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 578 markom
#!/bin/sh
2
#
3
# install - install a program, script, or datafile
4
# This comes from X11R5 (mit/util/scripts/install.sh).
5
#
6
# Copyright 1991 by the Massachusetts Institute of Technology
7
#
8
# Permission to use, copy, modify, distribute, and sell this software and its
9
# documentation for any purpose is hereby granted without fee, provided that
10
# the above copyright notice appear in all copies and that both that
11
# copyright notice and this permission notice appear in supporting
12
# documentation, and that the name of M.I.T. not be used in advertising or
13
# publicity pertaining to distribution of the software without specific,
14
# written prior permission.  M.I.T. makes no representations about the
15
# suitability of this software for any purpose.  It is provided "as is"
16
# without express or implied warranty.
17
#
18
# This script is compatible with the BSD install script, but was written
19
# from scratch.
20
#
21
 
22
 
23
# set DOITPROG to echo to test this script
24
 
25
# Don't use :- since 4.3BSD and earlier shells don't like it.
26
doit="${DOITPROG-}"
27
 
28
 
29
# put in absolute paths if you don't have them in your path; or use env. vars.
30
 
31
mvprog="${MVPROG-mv}"
32
cpprog="${CPPROG-cp}"
33
chmodprog="${CHMODPROG-chmod}"
34
chownprog="${CHOWNPROG-chown}"
35
chgrpprog="${CHGRPPROG-chgrp}"
36
stripprog="${STRIPPROG-strip}"
37
rmprog="${RMPROG-rm}"
38
 
39
instcmd="$mvprog"
40
chmodcmd=""
41
chowncmd=""
42
chgrpcmd=""
43
stripcmd=""
44
rmcmd="$rmprog -f"
45
mvcmd="$mvprog"
46
src=""
47
dst=""
48
 
49
while [ x"$1" != x ]; do
50
    case $1 in
51
        -c) instcmd="$cpprog"
52
            shift
53
            continue;;
54
 
55
        -m) chmodcmd="$chmodprog $2"
56
            shift
57
            shift
58
            continue;;
59
 
60
        -o) chowncmd="$chownprog $2"
61
            shift
62
            shift
63
            continue;;
64
 
65
        -g) chgrpcmd="$chgrpprog $2"
66
            shift
67
            shift
68
            continue;;
69
 
70
        -s) stripcmd="$stripprog"
71
            shift
72
            continue;;
73
 
74
        *)  if [ x"$src" = x ]
75
            then
76
                src=$1
77
            else
78
                dst=$1
79
            fi
80
            shift
81
            continue;;
82
    esac
83
done
84
 
85
if [ x"$src" = x ]
86
then
87
        echo "install:  no input file specified"
88
        exit 1
89
fi
90
 
91
if [ x"$dst" = x ]
92
then
93
        echo "install:  no destination specified"
94
        exit 1
95
fi
96
 
97
 
98
# If destination is a directory, append the input filename; if your system
99
# does not like double slashes in filenames, you may need to add some logic
100
 
101
if [ -d $dst ]
102
then
103
        dst="$dst"/`basename $src`
104
fi
105
 
106
# Make a temp file name in the proper directory.
107
 
108
dstdir=`dirname $dst`
109
dsttmp=$dstdir/#inst.$$#
110
 
111
# Move or copy the file name to the temp name
112
 
113
$doit $instcmd $src $dsttmp
114
 
115
# and set any options; do chmod last to preserve setuid bits
116
 
117
if [ x"$chowncmd" != x ]; then $doit $chowncmd $dsttmp; fi
118
if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dsttmp; fi
119
if [ x"$stripcmd" != x ]; then $doit $stripcmd $dsttmp; fi
120
if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dsttmp; fi
121
 
122
# Now rename the file to the real destination.
123
 
124
$doit $rmcmd $dst
125
$doit $mvcmd $dsttmp $dst
126
 
127
 
128
exit 0

powered by: WebSVN 2.1.0

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