Commit | Line | Data |
---|---|---|
e804469b C |
1 | #! /bin/sh |
2 | # | |
0f4556f1 | 3 | # @(#)install.sh 4.5 (Berkeley) 10/12/83 |
e804469b C |
4 | # |
5 | cmd=/bin/mv | |
6 | strip="" | |
7 | chmod="/bin/chmod 755" | |
8 | chown="/etc/chown -f root" | |
0f4556f1 | 9 | chgrp="/bin/chgrp -f staff" |
e804469b C |
10 | while true ; do |
11 | case $1 in | |
12 | -s ) strip="/bin/strip" | |
13 | shift | |
14 | ;; | |
15 | -c ) cmd="/bin/cp" | |
16 | shift | |
17 | ;; | |
18 | -m ) chmod="/bin/chmod $2" | |
19 | shift | |
20 | shift | |
21 | ;; | |
22 | -o ) chown="/etc/chown -f $2" | |
23 | shift | |
24 | shift | |
25 | ;; | |
0f4556f1 C |
26 | -g ) chgrp="/bin/chgrp -f $2" |
27 | shift | |
28 | shift | |
29 | ;; | |
e804469b C |
30 | * ) break |
31 | ;; | |
32 | esac | |
33 | done | |
34 | ||
35 | if [ ! ${2-""} ] | |
36 | then echo "install: no destination specified" | |
37 | exit 1 | |
38 | fi | |
39 | if [ ${3-""} ] | |
40 | then echo "install: too many files specified -> $*" | |
41 | exit 1 | |
42 | fi | |
43 | if [ $1 = $2 -o $2 = . ] | |
44 | then echo "install: can't move $1 onto itself" | |
45 | exit 1 | |
46 | fi | |
0f4556f1 C |
47 | if [ '!' -f $1 ] |
48 | then echo "install: can't open $1" | |
49 | exit 1 | |
50 | fi | |
e804469b C |
51 | if [ -d $2 ] |
52 | then file=$2/$1 | |
53 | else file=$2 | |
54 | fi | |
55 | /bin/rm -f $file | |
56 | $cmd $1 $file | |
57 | if [ $strip ] | |
58 | then $strip $file | |
59 | fi | |
60 | $chown $file | |
0f4556f1 | 61 | $chgrp $file |
e804469b | 62 | $chmod $file |