]> CyberLeo.Net >> Repos - FreeBSD/releng/9.2.git/blob - contrib/ipfilter/bsdinstall
- Copy stable/9 to releng/9.2 as part of the 9.2-RELEASE cycle.
[FreeBSD/releng/9.2.git] / contrib / ipfilter / bsdinstall
1 #! /bin/sh
2 #
3 #       @(#)install.sh  4.5     (Berkeley)      10/12/83
4 #
5 cmd=/bin/mv
6 strip=""
7 chmod="chmod 755"
8 if [ "`uname -s`" = "HP-UX" ] ; then
9         chown="chown root"
10         chgrp="chgrp bin"
11 else
12         chown="chown -f root"
13         chgrp="chgrp -f bin"
14 fi
15 while true ; do
16         case $1 in
17                 -s )    strip="strip"
18                         shift
19                         ;;
20                 -c )    cmd="cp"
21                         shift
22                         ;;
23                 -m )    chmod="chmod $2"
24                         shift
25                         shift
26                         ;;
27                 -o )    chown="chown -f $2"
28                         shift
29                         shift
30                         ;;
31                 -g )    chgrp="chgrp -f $2"
32                         shift
33                         shift
34                         ;;
35                 -d )    cmd="mkdir"
36                         shift
37                         ;;
38                 * )     break
39                         ;;
40         esac
41 done
42
43 if [ ! ${2-""} ]
44 then    echo "install: no destination specified"
45         exit 1
46 fi
47 if [ ${3-""} ]
48 then    echo "install: too many files specified -> $*"
49         exit 1
50 fi
51 if [ $1 = $2 -o $2 = . ]
52 then    echo "install: can't move $1 onto itself"
53         exit 1
54 fi
55 case $cmd in
56 /bin/mkdir )
57         file=$2/$1
58         ;;
59 * )
60         if [ '!' -f $1 ]
61         then    echo "install: can't open $1"
62                 exit 1
63         fi
64         if [ -d $2 ]
65         then    file=$2/$1
66         else    file=$2
67         fi
68         /bin/rm -f $file
69         ;;
70 esac
71
72 case $cmd in
73 /bin/mkdir )
74         if [ ! -d "$file" ]
75         then    $cmd $file
76         fi
77         ;;
78 * )
79         $cmd $1 $file
80         if [ $strip ]
81         then    $strip $file
82         fi
83         ;;
84 esac
85
86 $chown $file
87 $chgrp $file
88 $chmod $file