]>
git.ipfire.org Git - thirdparty/xfsprogs-dev.git/blob - install-sh
3 # Copyright (c) 2000-2001 Silicon Graphics, Inc. All Rights Reserved.
5 # This program is free software; you can redistribute it and/or modify it
6 # under the terms of version 2 of the GNU General Public License as
7 # published by the Free Software Foundation.
9 # This program is distributed in the hope that it would be useful, but
10 # WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
13 # Further, this software is distributed without any warranty that it is
14 # free of the rightful claim of any third person regarding infringement
15 # or the like. Any license provided herein, whether implied or
16 # otherwise, applies only to this software file. Patent licenses, if
17 # any, provided herein do not apply to combinations of this program with
18 # other software, or any other product whatsoever.
20 # You should have received a copy of the GNU General Public License along
21 # with this program; if not, write the Free Software Foundation, Inc., 59
22 # Temple Place - Suite 330, Boston MA 02111-1307, USA.
24 # Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy,
25 # Mountain View, CA 94043, or:
29 # For further information regarding this notice, see:
31 # http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
35 # This script emulates bsd install and also recognises
36 # two environment variables, with the following semantics :-
38 # $DIST_MANIFEST - if set, the name of the file to append manifest
39 # information in the following format:
40 # File : f mode owner group src target
41 # Directory: d mode owner group target
42 # Symlink : l linkval target
44 # $DIST_ROOT - if set, prepend to target
46 # The sematics of all combinations of these two variables
49 # $DIST_MANIFEST? $DIST_ROOT? | Copy? Append Manifest?
50 # -----------------------------+--------------------------
51 # not set not set | yes no
52 # not set set | yes no
53 # set not set | no yes
57 echo "Usage: $prog [-o owner] [-g group] [-m mode] -d directory"
58 echo "or $prog [-D] [-o owner] [-g group] [-m mode] file directory/file"
59 echo "or $prog [-o owner] [-g group] [-m mode] file [file ...] directory"
60 echo "or $prog -S file target (creates \"target\" symlink)"
61 echo "or $prog -T lt_arg [-o owner] [-g group] [-m mode] libtool.lai directory"
63 echo "The \$DIST_MANIFEST and \$DIST_ROOT environment variables affect the"
64 echo "behaviour of this command - see comments in the script."
65 echo "The -D flag is only available for the second usage, and causes"
66 echo "the target directory to be created before installing the file."
74 if [ $# -eq 3 ] ; then
77 if [ $_st -ne 0 ] ; then
78 if [ $REAL_UID != '0' ] ; then
79 if [ ! -f $DIST_ROOT/.chown.quiet
] ; then
80 echo '==============================================='
81 echo Ownership of files under
${DIST_ROOT:-/}
82 echo cannot be changed
83 echo '==============================================='
84 if [ -n "$DIST_ROOT" ] ; then
85 touch $DIST_ROOT/.chown.quiet
99 echo $
* |
sed -e 's/\/\//\//g' >>${DIST_MANIFEST:-/dev/null}
114 # default is to install and don't append manifest
118 [ -n "$DIST_MANIFEST" -a -z "$DIST_ROOT" ] && INSTALL
=false
119 [ -n "$DIST_MANIFEST" ] && MANIFEST
="_manifest"
121 [ $# -eq 0 ] && _usage
125 CP
=cp; LN
=ln; MKDIR
=mkdir
; CHMOD
=chmod; CHOWN
=_chown
127 CP
=true
; LN
=true
; MKDIR
=true
; CHMOD
=true
; CHOWN
=true
130 [ -n "$DIST_ROOT" -a $REAL_UID -ne 0 ] && CHOWN
=true
132 while getopts "Dcm:d:S:o:g:T:" c $
*
144 DIRMODE
=`expr $OPTARG`
155 dir
=$DIST_ROOT/$OPTARG
168 shift `expr $OPTIND - 1`
185 $CHOWN $OWNER $GROUP $dir
188 $MANIFEST d
$DIRMODE $OWNER $GROUP ${dir#$DIST_ROOT}
192 # fourth usage (symlink)
200 $LN -s -f $symlink $target
202 $MANIFEST l
$symlink ${target#$DIST_ROOT}
206 # -T (install libs built by libtool)
213 # source the libtool variables
214 if [ ! -f $libtool_lai ]
216 echo "$prog: Unable to find libtool library file $libtool_lai"
224 # Loop until we find libfoo.so.x.y.z, then break out.
225 for solib
in $library_names
227 # does it have enough parts? libfoo.so.x.y.z == 5
228 cnt
=`echo "$solib" | sed -e 's/\./ /g' | wc -w`
231 install_name
=$target/$solib
232 $CP $solib $install_name
234 $MANIFEST f
$FILEMODE $OWNER $GROUP $HERE/$solib ${install_name#$DIST_ROOT}
243 # ln -s libfoo.so.x.y.z to libfoo.so.x
244 from_parts
=5 # libfoo.so.x.y.z
245 to_parts
=3 # libfoo.so.x
248 # ln -s libfoo.so.x to libfoo.so
249 from_parts
=3 # libfoo.so.x
250 to_parts
=2 # libfoo.so
253 echo "$prog: -T $lt_install invalid"
258 # Loop until we find the names, then break out.
259 for solib
in $library_names
261 # does it have enough parts?
262 cnt
=`echo "$solib" | sed -e 's/\./ /g' | wc -w`
263 if [ $cnt -eq $from_parts ]
266 elif [ $cnt -eq $to_parts ]
271 if [ -n "$from_name" ] && [ -n "$to_name" ]
273 install_name
=$target/$to_name
274 $LN -s -f $from_name $install_name
276 $MANIFEST l
$from_name ${install_name#$DIST_ROOT}
282 install_name
=$target/$old_library
283 $CP $old_library $install_name
285 $MANIFEST f
$FILEMODE $OWNER $GROUP $HERE/$old_library ${install_name#$DIST_ROOT}
288 echo "$prog: -T $lt_install invalid"
294 old_lib|so_dot_version
)
297 $CHMOD $FILEMODE $install_name
298 $CHOWN $OWNER $GROUP $install_name
315 mkdir
-p `dirname $dir`
323 $CHMOD $FILEMODE $dir/$f
327 $CHOWN $OWNER $GROUP $dir/$f
330 $MANIFEST f
$FILEMODE $OWNER $GROUP $HERE/$f ${dir#$DIST_ROOT}/$f
332 $CHMOD $FILEMODE $dir
336 $CHOWN $OWNER $GROUP $dir
339 $MANIFEST f
$FILEMODE $OWNER $GROUP $HERE/$dir ${dir#$DIST_ROOT}
358 # echo DIR=$dir list=\"$list\"
365 $CHMOD $FILEMODE $dir/$f
369 $CHOWN $OWNER $GROUP $dir/$f
372 $MANIFEST f
$FILEMODE $OWNER $GROUP $HERE/$f ${dir#$DIST_ROOT}/$f
374 [ $status -ne 0 ] && break