]> granicus.if.org Git - linux-pam/blob - conf/install
Relevant BUGIDs: 530428
[linux-pam] / conf / install
1 #!/bin/sh
2 #
3 # [This file was lifted from an X distribution. There was no explicit
4 # copyright in the file, but the following text was associated with it.
5 # should anyone from the X Consortium wish to alter the following
6 # text. Please email <morgan@parc.power.net> Thanks. ]
7 #
8 # --------------------------
9 # The X Consortium maintains and distributes the X Window System and
10 # related software and documentation in coordinated releases. A release
11 # consists of two distinct parts:
12
13 # 1) Specifications and Sample implementations of X Consortium
14 # standards, and
15
16 # 2) software and documentation contributed by the general X Consortium
17 # community.
18
19 # The timing and contents of a release are determined by the Consortium
20 # staff based on the needs and desires of the Members and the advice of
21 # the Advisory Board, tempered by the resource constraints of the
22 # Consortium.
23
24 # Members have access to all X Consortium produced software and
25 # documentation prior to release to the public. Each Member can receive
26 # pre-releases and public releases at no charge. In addition, Members
27 # have access to software and documentation while it is under
28 # development, and can periodically request snapshots of the development
29 # system at no charge.
30
31 # The X Consortium also maintains an electronic mail system for
32 # reporting problems with X Consortium produced software and
33 # documentation. Members have access to all bug reports, as well as all
34 # software patches as they are incrementally developed by the Consortium
35 # staff between releases.
36
37 # In general, all materials included in X Consortium releases are
38 # copyrighted and contain permission notices granting unrestricted use,
39 # sales and redistribution rights provided that the copyrights and the
40 # permission notices are left intact. All materials are provided "as
41 # is," without express or implied warranty.
42 # --------------------------
43 #
44 # This accepts bsd-style install arguments and makes the appropriate calls
45 # to the System V install.
46 #
47
48 flags=""
49 dst=""
50 src=""
51 dostrip=""
52 owner=""
53 mode=""
54
55 while [ x$1 != x ]; do
56     case $1 in 
57         -c) shift
58             continue;;
59
60         -m) flags="$flags $1 $2 "
61             mode="$2"
62             shift
63             shift
64             continue;;
65
66         -o) flags="$flags -u $2 "
67             owner="$2"
68             shift
69             shift
70             continue;;
71
72         -g) flags="$flags $1 $2 "
73             shift
74             shift
75             continue;;
76
77         -s) dostrip="strip"
78             shift
79             continue;;
80
81         *)  if [ x$src = x ] 
82             then
83                 src=$1
84             else
85                 dst=$1
86             fi
87             shift
88             continue;;
89     esac
90 done
91
92 case "$mode" in
93 "")
94         ;;
95 *)
96         case "$owner" in
97         "")
98                 flags="$flags -u root"
99                 ;;
100         esac
101         ;;
102 esac
103
104 if [ x$src = x ] 
105 then
106         echo "$0:  no input file specified"
107         exit 1
108 fi
109
110 if [ x$dst = x ] 
111 then
112         echo "$0:  no destination specified"
113         exit 1
114 fi
115
116
117 # set up some variable to be used later
118
119 rmcmd=""
120 srcdir="."
121
122 # if the destination isn't a directory we'll need to copy it first
123
124 if [ ! -d $dst ]
125 then
126         dstbase=`basename $dst`
127         cp $src /tmp/$dstbase
128         rmcmd="rm -f /tmp/$dstbase"
129         src=$dstbase
130         srcdir=/tmp
131         dst="`echo $dst | sed 's,^\(.*\)/.*$,\1,'`"
132         if [ x$dst = x ]
133         then
134                 dst="."
135         fi
136 fi
137
138
139 # If the src file has a directory, copy it to /tmp to make install happy
140
141 srcbase=`basename $src`
142
143 if [ "$src" != "$srcbase" -a "$src" != "./$srcbase" ] 
144 then
145         cp $src /tmp/$srcbase
146         src=$srcbase
147         srcdir=/tmp
148         rmcmd="rm -f /tmp/$srcbase"
149 fi
150
151 # do the actual install
152
153 if [ -f /usr/sbin/install ]
154 then
155         installcmd=/usr/sbin/install
156 elif [ -f /etc/install ]
157 then
158         installcmd=/etc/install
159 else
160         installcmd=install
161 fi
162
163 # This rm is commented out because some people want to be able to
164 # install through symbolic links.  Uncomment it if it offends you.
165 rm -f $dst/$srcbase
166 (cd $srcdir ; $installcmd -f $dst $flags $src)
167
168 if [ x$dostrip = xstrip ]
169 then
170         strip $dst/$srcbase
171 fi
172
173 # and clean up
174
175 $rmcmd
176
177 exit
178