Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 120 lines (106 sloc) 2.614 kb
495f5aa @JohnSonnenschein initial import
JohnSonnenschein authored
1 #!/bin/sh -e
2 #
3 # CDDL HEADER START
4 #
5 # The contents of this file are subject to the terms of the
6 # Common Development and Distribution License (the "License").
7 # You may not use this file except in compliance with the License.
8 #
9 # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10 # or http://www.opensolaris.org/os/licensing.
11 # See the License for the specific language governing permissions
12 # and limitations under the License.
13 #
14 # When distributing Covered Code, include this CDDL HEADER in each
15 # file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16 # If applicable, add the following below this CDDL HEADER, with the
17 # fields enclosed by brackets "[]" replaced with your own identifying
18 # information: Portions Copyright [yyyy] [name of copyright owner]
19 #
20 # CDDL HEADER END
21 #
22 #
23 # Copyright 2009 Sun Microsystems, Inc. All rights reserved.
24 # Use is subject to license terms.
25 #
26 # Copyright (c) 2010 Joyent Inc.
27 #
28
29 # XXX We would ideally inherit PERL from Makefile.master.
30 # For now, we just set it here.
31
32 PERL=/usr/perl5/bin/perl
33 PYTHON=${PYTHON:-/usr/bin/python2.4}
34
35 _install()
36 {
37 _type=$1
38 _src=$2
39 _targ=$3
40 _perm=$4
41
42 case "$1" in
43 L)
44 # Install symbolic link file
45 rm -f $_targ
46 ln -s $_src $_targ
47 ;;
48 H)
49 # Install hard link
50 rm -f $_targ
51 ln $_src $_targ
52 ;;
53
54 E)
55 # Install executable ELF file
56 rm -f $_targ
57 cp $_src $_targ
58 chmod u+w $_targ
59 /usr/ccs/bin/strip $_targ
60 chmod $_perm $_targ
61 ;;
62
63 D)
64 # Install dynamic executable ELF library
65 rm -f $_targ
66 cp $_src $_targ
67 chmod u+w $_targ
68 chmod $_perm $_targ
69 ;;
70
71 N|S)
72 # Install normal or executable script file
73 rm -f $_targ
74 cp $_src $_targ
75 chmod $_perm $_targ
76 ;;
77
78 M)
79 # Install man page file
80 if [ -z "${MANSCRIPT}" ]
81 then
82 echo "MANSCRIPT not set"
83 exit 1
84 fi
85 rm -f $_targ
86 sed -f ${MANSCRIPT} $_src > $_targ
87 chmod $_perm $_targ
88 ;;
89
90 P)
91 # Install perl and python script file
92 SED_ARGS="-e 1s|^#\!.*perl|#\!${PERL}|"
93 if [ -n "${PYTHON}" ] ; then
94 SED_ARGS="${SED_ARGS} -e 1s|^#\!.*python[0-9\.]*|#\!${PYTHON}|"
95 fi
96 rm -f $_targ
97 sed ${SED_ARGS} <$_src >$_targ
98 chmod $_perm $_targ
99 ;;
100 esac
101
102 return
103 }
104
105 _fixup_perl()
106 {
107 _line="1"
108 case $1 in
109 -a) _line=""
110 shift ;;
111 esac
112
113 _file=$1
114
115 cp ${_file} ${_file}.orig
116 rm -f ${_file}
117 sed -e "${_line}s|^#\!.*perl|#\!${PERL}|" <${_file}.orig >${_file}
118 rm -f ${_file}.orig
119 }
Something went wrong with that request. Please try again.