File: install.sh.in

package info (click to toggle)
libtiff3 3.4beta037-4
  • links: PTS
  • area: main
  • in suites: hamm
  • size: 2,732 kB
  • ctags: 3,274
  • sloc: ansic: 32,425; sh: 2,610; makefile: 1,515
file content (246 lines) | stat: -rw-r--r-- 6,679 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
#! @SCRIPT_SH@
#	$Header: /d1/sam/tiff/port/RCS/install.sh.in,v 1.20 1997/08/29 21:48:53 sam Exp $
#
# @WARNING@
#
# HylaFAX Facsimile Software
#
# Copyright (c) 1990-1997 Sam Leffler
# Copyright (c) 1991-1997 Silicon Graphics, Inc.
# HylaFAX is a trademark of Silicon Graphics
# 
# Permission to use, copy, modify, distribute, and sell this software and 
# its documentation for any purpose is hereby granted without fee, provided
# that (i) the above copyright notices and this permission notice appear in
# all copies of the software and related documentation, and (ii) the names of
# Sam Leffler and Silicon Graphics may not be used in any advertising or
# publicity relating to the software without the specific, prior written
# permission of Sam Leffler and Silicon Graphics.
# 
# THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, 
# EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY 
# WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  
# 
# IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
# ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
# OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
# WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF 
# LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE 
# OF THIS SOFTWARE.
#

#
# Warning, this file was automatically created by the HylaFAX configure script
#
# VERSION:	@VERSION@
# DATE:		@DATE@
# TARGET:	@TARGET@
#

#
# Shell script to emulate Silicon Graphics install program.
# We emulate the non-standard interface used by install so
# that we can build SGI inst packages on SGI systems.  Note
# that we cannot emulate everything because we don't maintain
# a history of installed software; thus we cannot tell when
# configuration files have been modified and save old copies.
#
# NB: we don't do chown/chmod/chgrp by default; it must be
#     explicitly set on the command line.
#

#
# install [options] files ...
# 
# Options are:
#
# -o		save existing target foo as OLDfoo
# -O		remove existing target foo, if it fails save as OLDfoo
# -m mode	set mode of installed target
# -u uid	set uid of installed target
# -g gid	set gid of installed target
# -root path	set ROOT directory for target pathnames
# -dir		create directories
# -fifo		create FIFO special files
# -ln path	create hard link
# -lns path	create symbolic link
# -src path	source pathname different from target
# -f dir	install files in the target directory ROOT/dir
# -F dir	like -f, but create directories that do not exist
# -v		echo actions
# -idb stuff	specify package and, optionally, do special work
#
preopts=
postopts=
SaveFirst=no
HasSource=yes
RemoveFirst=no
NoUpdate=no
Suggested=no
Updated=no

CMD=cp
SRC=
FILES=
DESTDIR=
CHMOD=":"
CHOWN=":"
CHGRP=":"
RM="rm -f"
MV="mv @MV_F@"
ECHO=echo
VERBOSE=":"
STRIP="@STRIP@"
CMP=cmp

TARGETS=
while [ x"$1" != x ]
do
    arg=$1
    case $arg in
    -m)		shift; CHMOD="@CHMOD@ $1";;
    -u)		shift; CHOWN="@CHOWN@ $1";;
    -g)		shift; CHGRP="@CHGRP@ $1";;
    -o)		SaveFirst=yes;;
    -O)		RemoveFirst=yes; SaveFirst=yes;;
    -root)	shift; ROOT=$1;;
    -dir)	CMD=mkdir; HasSource=no;
		RM=":"; STRIP=":"
		;;
    -fifo)	CMD=@MKFIFO@; HasSource=no;
		x=`echo $CMD | @SED@ 's;.*/;;'`;
		test $x = mknod && postopts="p";
		STRIP=":"
		;;
    -ln)	shift; CMD=@LN@; SRC="$1"
		STRIP=":"
		;;
    -lns)	shift; CMD=@LN@; preopts="@LN_S@"; SRC="$1"
		STRIP=":"
		;;
    -src)	shift; SRC="$1";;
    -[fF])	shift; DESTDIR="$1";;
    -idb)	shift; opt="$1"
		case "$opt" in
		*config\(update\)*)	Updated=yes;;
		*config\(suggest\)*)	Suggested=yes;;
		*config\(noupdate\)*)	NoUpdate=yes;;
		*nostrip*)		STRIP=":";;
		esac
		;;
    # these are skipped/not handled
    -new|-rawidb|-blk|-chr) shift;;
    -v)		VERBOSE=$ECHO;;
    -*) 	;;
    *)		TARGETS="$TARGETS $arg";;
    esac
    shift
done

#
# Install the specified target.
#
install()
{
    src=$1 target=$2
    if [ $RemoveFirst = yes -a -f $target ]; then
	$VERBOSE "$RM $target"
	$RM $target
    fi
    if [ $SaveFirst = yes -a -f $target ]; then
	bf=`echo $src | @SED@ 's;.*/;;'`
	$VERBOSE "$MV $target $ROOT/$DESTDIR/OLD$bf"
	$MV $target $ROOT/$DESTDIR/OLD$bf
    fi
    if [ -z "$SRC" -a $HasSource = yes ]; then
	$VERBOSE "$CMD $preopts $src $target $postopts"
	$CMD $preopts $f $target $postopts
    else
	$VERBOSE "$CMD $preopts $SRC $target $postopts"
	$CMD $preopts $SRC $target $postopts
    fi
    if [ $? -eq 0 ]; then
	$VERBOSE "$CHOWN $target"
	$CHOWN $target
	$VERBOSE "$CHGRP $target"
	$CHGRP $target
	$VERBOSE "$CHMOD $target"
	$CHMOD $target
	if [ $STRIP != ":" -a -x $ROOT/$DESTDIR/$f ]; then
	    $STRIP $target >/dev/null 2>&1 || true
	    $VERBOSE "$STRIP $target"
	fi
    fi
}

if [ $Suggested = yes ]; then
    #
    # A suggested file.  If an existing target does
    # not exist, then install it.  Otherwise, install
    # it as target.N if it's different from the current
    # installed target.
    #
    # NB: cannot be used with a special file 'cuz we
    #     use test -f to see if the file exists.
    #
    for f in $TARGETS; do
	t=$ROOT/$DESTDIR/$f
	if [ -f $t ]; then
	    if [ -z "$SRC" -a $HasSource = yes ]; then
		$CMP -s $f $t || {
		    $ECHO "*** Warning, target has local changes, installing $f as $t.N"
		    install $f $t.N;
		}
	    else
		$CMP -s $SRC $t || {
		    $ECHO "*** Warning, target has local changes, installing $f as $t.N"
		    install $f $t.N
		}
	    fi
	else
	    install $f $t
	fi
    done
elif [ $Updated = yes ]; then
    #
    # A file to be updated.  If an existing target does
    # not exist, then install it.  Otherwise, install
    # it as target and save the old version as target.O
    # if the old version is different from the current
    # installed target.
    #
    # NB: cannot be used with a special file 'cuz we
    #     use test -f to see if the file exists.
    #
    for f in $TARGETS; do
	t=$ROOT/$DESTDIR/$f
	if [ -f $t ]; then
	    if [ -z "$SRC" -a $HasSource = yes ]; then
		$CMP -s $f $t || $MV $t $t.O
	    else
		$CMP -s $SRC $t || $MV $t $t.O
	    fi
	fi
	install $f $t
    done
elif [ $NoUpdate = yes ]; then
    #
    # A file that is never to be updated; the target
    # is created only if it does not exist.
    #
    # NB: cannot be used with a special file 'cuz we
    #     use test -f to see if the file exists.
    #
    for f in $TARGETS; do
	t=$ROOT/$DESTDIR/$f
	test -f $t || install $f $t
    done
else
    #
    # Normal case, a target that should be installed
    # with the existing copy, optionally, saved first.
    #
    for f in $TARGETS; do
	install $f $ROOT/$DESTDIR/$f
    done
fi