File: sinstall.sh

package info (click to toggle)
vile 9.6m-1
  • links: PTS
  • area: main
  • in suites: lenny
  • size: 8,196 kB
  • ctags: 8,459
  • sloc: ansic: 90,876; lex: 9,514; sh: 3,223; cpp: 3,137; perl: 2,928; makefile: 785; awk: 276
file content (75 lines) | stat: -rwxr-xr-x 1,201 bytes parent folder | download | duplicates (11)
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
#!/bin/sh
# $Header: /usr/build/vile/vile/RCS/sinstall.sh,v 1.1 1998/11/14 15:24:04 tom Exp $
#
# Install Perl scripts, adjusting for the correct pathname
#	$1 = name of perl program
#	$2 = install-program 
# The last two arguments are the source and target, install's options, if any,
# fall between.

SOURCE=
TARGET=
INSTALL=

if test $# = 0 ; then
	echo '? no parameter for $PERL'
	exit 1
else
	test -z "$PERL" && PERL="$1"
	shift
fi

while test $# != 0
do
	if test $# = 1 ; then
		TARGET="$1"
	elif test $# = 2 ; then
		SOURCE="$1"
	else
		INSTALL="$INSTALL $1"
	fi
	shift
done

if test -z "$INSTALL" ; then
	echo '? no parameter for $INSTALL'
	exit 1
fi

if test -z "$SOURCE" ; then
	echo '? no parameter for $SOURCE'
	exit 1
fi

if test -z "$TARGET" ; then
	echo '? no parameter for $TARGET'
	exit 1
fi

case $PERL in #(vi
/*)	#(vi
	;;
*)
	IFS="${IFS= 	}"; ac_save_ifs="$IFS"; IFS="${IFS}:"
	for p in $PATH
	do
		if test -f $p/$PERL ; then
			PERL="$p/$PERL"
			break
		fi
	done
	IFS="$ac_save_ifs"
	;;
esac

TEMP=sinstall.$$
trap "rm -f $TEMP; exit 99" 1 2 5 15
sed -e "s@/usr/bin/perl@$PERL@g" $SOURCE >$TEMP

$INSTALL $TEMP $TARGET
if test $? != 0 ; then
	rm -f $TEMP
	exit 1
fi
rm -f $TEMP