]> git.sesse.net Git - rdpsrv/blob - Xserver/config/util/bsdinst.sh
Support RDP5 logon packets.
[rdpsrv] / Xserver / config / util / bsdinst.sh
1 #!/bin/sh
2
3 # $XFree86: xc/config/util/bsdinst.sh,v 3.3 1996/12/23 05:56:13 dawes Exp $
4 #
5 # This accepts bsd-style install arguments and makes the appropriate calls
6 # to the System V install.
7 # $XConsortium: bsdinst.sh /main/8 1996/09/28 16:16:11 rws $
8
9 flags=""
10 dst=""
11 src=""
12 dostrip=""
13 owner=""
14 group=""
15 mode=""
16 bargs=$*
17
18 while [ x$1 != x ]; do
19     case $1 in 
20         -c) shift
21             continue;;
22
23         -m) flags="$flags $1 $2 "
24             mode="$2"
25             shift
26             shift
27             continue;;
28
29         -o) flags="$flags -u $2 "
30             owner="$2"
31             shift
32             shift
33             continue;;
34
35         -g) flags="$flags $1 $2 "
36             group="$2"
37             shift
38             shift
39             continue;;
40
41         -s) dostrip="strip"
42             shift
43             continue;;
44
45         *)  if [ x$src = x ] 
46             then
47                 src=$1
48             else
49                 dst=$1
50             fi
51             shift
52             continue;;
53     esac
54 done
55
56 if [ x$src = x ] 
57 then
58         echo "$0:  no input file specified"
59         exit 1
60 fi
61
62 if [ x$dst = x ] 
63 then
64         echo "$0:  no destination specified"
65         exit 1
66 fi
67
68 if [ -x /usr/ucb/install ]
69 then
70         if [ -d "$dst" ]
71         then
72                 dst=$dst/`basename "$src"`
73         fi
74         case "$group" in
75         "")
76                 bargs="-g other $bargs"
77                 ;;
78         esac
79         /usr/ucb/install $bargs
80         if [ x$dostrip = xstrip -a -x /usr/bin/mcs ]
81         then
82                 /usr/bin/mcs -d $dst
83         fi
84         exit 0
85 fi
86         
87 case "$mode" in
88 "")
89         ;;
90 *)
91         case "$owner" in
92         "")
93                 flags="$flags -u root"
94                 ;;
95         esac
96         ;;
97 esac
98
99
100 # set up some variable to be used later
101
102 rmcmd=""
103 srcdir="."
104
105 # if the destination isn't a directory we'll need to copy it first
106
107 if [ ! -d $dst ]
108 then
109         dstbase=`basename $dst`
110         cp $src /tmp/$dstbase
111         rmcmd="rm -f /tmp/$dstbase"
112         src=$dstbase
113         srcdir=/tmp
114         dst="`echo $dst | sed 's,^\(.*\)/.*$,\1,'`"
115         if [ x$dst = x ]
116         then
117                 dst="."
118         fi
119 fi
120
121
122 # If the src file has a directory, copy it to /tmp to make install happy
123
124 srcbase=`basename $src`
125
126 if [ "$src" != "$srcbase" ] && [ "$src" != "./$srcbase" ] 
127 then
128         cp $src /tmp/$srcbase
129         src=$srcbase
130         srcdir=/tmp
131         rmcmd="rm -f /tmp/$srcbase"
132 fi
133
134 # do the actual install
135
136 if [ -f /usr/sbin/install ]
137 then
138         installcmd=/usr/sbin/install
139 elif [ -f /etc/install ]
140 then
141         installcmd=/etc/install
142 else
143         installcmd=install
144 fi
145
146 # This rm is commented out because some people want to be able to
147 # install through symbolic links.  Uncomment it if it offends you.
148 # rm -f $dst/$srcbase
149 (cd $srcdir ; $installcmd -f $dst $flags $src)
150
151 if [ x$dostrip = xstrip ]
152 then
153         strip $dst/$srcbase
154         if [ -x /usr/bin/mcs ]
155         then
156                 /usr/bin/mcs -d $dst/$srcbase
157         fi
158 fi
159
160 if [ x$mode != x ]
161 then
162         chmod $mode $dst/$srcbase
163 fi
164
165 # and clean up
166
167 $rmcmd
168