blob: a8f4344b7794a73a4b6d654756650c9aa32e6ff4 (
plain)
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
|
#!/bin/sh
# --- BEGIN COPYRIGHT BLOCK ---
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation;
# version 2.1 of the License.
#
# This library is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor,
# Boston, MA 02110-1301 USA
#
# Copyright (C) 2007 Red Hat, Inc.
# All rights reserved.
# --- END COPYRIGHT BLOCK ---
# Check to insure that this script's original invocation directory
# has not been deleted!
CWD=`/bin/pwd > /dev/null 2>&1`
if [ $? -ne 0 ] ; then
echo "Cannot invoke '$0' from non-existent directory!"
exit 255
fi
###############################################################################
## (1) Specify variables used by this script. ##
###############################################################################
PRODUCT=[PKI_PRODUCT]
SUBSYSTEM=[PKI_SUBSYSTEM]
COMMAND=[PKI_COMMAND]
###############################################################################
## (2) Define helper functions. ##
###############################################################################
invalid_operating_system() {
echo
echo "ERROR: '$0' does not execute on the '$1' operating system!"
echo
}
invalid_architecture() {
echo
echo "ERROR: '$0' does not execute on the '$1' architecture!"
echo
}
###############################################################################
## (3) Set environment variables. ##
## ##
## Set the LD_LIBRARY_PATH environment variable to determine the ##
## search order this command wrapper uses to find shared libraries. ##
## ##
## Set the PATH environment variable to determine the search ##
## order this command wrapper uses to find binary executables. ##
## ##
## NOTE: Since the wrappers themselves are ALWAYS located in ##
## "/usr/bin" on 32-bit and 64-bit Linux as well as both ##
## 32-bit Solaris and 64-bit Solaris, this directory ##
## will always be excluded from the search path. ##
## ##
## Additionally, since "/bin" is nothing more than a symbolic ##
## link to "/usr/bin" on Solaris, this directory will also ##
## always be excluded from the search path on this platform. ##
## ##
###############################################################################
OS=`pkiname`
ARCHITECTURE=`pkiarch`
if [ "${OS}" = "Linux" ] ; then
if [ "${ARCHITECTURE}" = "i386" ] ; then
LD_LIBRARY_PATH=/usr/lib/java:/usr/lib:/lib
LD_LIBRARY_PATH=/usr/lib/${PRODUCT}:${LD_LIBRARY_PATH}
LD_LIBRARY_PATH=/usr/lib/${PRODUCT}/${SUBSYSTEM}:${LD_LIBRARY_PATH}
LD_LIBRARY_PATH=/usr/lib/dirsec:${LD_LIBRARY_PATH}
LD_LIBRARY_PATH=/usr/lib/java/dirsec:${LD_LIBRARY_PATH}
export LD_LIBRARY_PATH
PATH=/usr/lib/${PRODUCT}:/bin
PATH=/usr/lib/${PRODUCT}/${SUBSYSTEM}:${PATH}
export PATH
elif [ "${ARCHITECTURE}" = "x86_64" ] ; then
LD_LIBRARY_PATH=/usr/lib/java:/usr/lib:/lib
LD_LIBRARY_PATH=/usr/lib/${PRODUCT}:${LD_LIBRARY_PATH}
LD_LIBRARY_PATH=/usr/lib/${PRODUCT}/${SUBSYSTEM}:${LD_LIBRARY_PATH}
LD_LIBRARY_PATH=/usr/lib/dirsec:${LD_LIBRARY_PATH}
LD_LIBRARY_PATH=/usr/lib/java/dirsec:${LD_LIBRARY_PATH}
LD_LIBRARY_PATH=/usr/lib64/java:/usr/lib64:/lib64:${LD_LIBRARY_PATH}
LD_LIBRARY_PATH=/usr/lib64/${PRODUCT}:${LD_LIBRARY_PATH}
LD_LIBRARY_PATH=/usr/lib64/${PRODUCT}/${SUBSYSTEM}:${LD_LIBRARY_PATH}
LD_LIBRARY_PATH=/usr/lib64/dirsec:${LD_LIBRARY_PATH}
LD_LIBRARY_PATH=/usr/lib64/java/dirsec:${LD_LIBRARY_PATH}
export LD_LIBRARY_PATH
PATH=/usr/lib/${PRODUCT}
PATH=/usr/lib/${PRODUCT}/${SUBSYSTEM}:${PATH}
PATH=/usr/lib64/${PRODUCT}:/bin:${PATH}
PATH=/usr/lib64/${PRODUCT}/${SUBSYSTEM}:${PATH}
export PATH
else
invalid_architecture "${ARCHITECTURE}"
exit 255
fi
elif [ "${OS}" = "SunOS" ] ; then
if [ "${ARCHITECTURE}" = "sparc" ] ; then
LD_LIBRARY_PATH=/usr/lib/java:/usr/lib:/lib
LD_LIBRARY_PATH=/usr/lib/${PRODUCT}:${LD_LIBRARY_PATH}
LD_LIBRARY_PATH=/usr/lib/${PRODUCT}/${SUBSYSTEM}:${LD_LIBRARY_PATH}
LD_LIBRARY_PATH=/usr/lib/dirsec:${LD_LIBRARY_PATH}
LD_LIBRARY_PATH=/usr/lib/java/dirsec:${LD_LIBRARY_PATH}
export LD_LIBRARY_PATH
PATH=/usr/lib/${PRODUCT}
PATH=/usr/lib/${PRODUCT}/${SUBSYSTEM}:${PATH}
export PATH
elif [ "${ARCHITECTURE}" = "sparcv9" ] ; then
LD_LIBRARY_PATH=/usr/lib/java:/usr/lib:/lib
LD_LIBRARY_PATH=/usr/lib/${PRODUCT}:${LD_LIBRARY_PATH}
LD_LIBRARY_PATH=/usr/lib/${PRODUCT}/${SUBSYSTEM}:${LD_LIBRARY_PATH}
LD_LIBRARY_PATH=/usr/lib/dirsec:${LD_LIBRARY_PATH}
LD_LIBRARY_PATH=/usr/lib/java/dirsec:${LD_LIBRARY_PATH}
LD_LIBRARY_PATH=/usr/lib/sparcv9:/lib/sparcv9:${LD_LIBRARY_PATH}
LD_LIBRARY_PATH=/usr/lib/sparcv9/java:${LD_LIBRARY_PATH}
LD_LIBRARY_PATH=/usr/lib/sparcv9/${PRODUCT}:${LD_LIBRARY_PATH}
LD_LIBRARY_PATH=/usr/lib/sparcv9/${PRODUCT}/${SUBSYSTEM}:${LD_LIBRARY_PATH}
LD_LIBRARY_PATH=/usr/lib/sparcv9/dirsec:${LD_LIBRARY_PATH}
LD_LIBRARY_PATH=/usr/lib/sparcv9/java/dirsec:${LD_LIBRARY_PATH}
export LD_LIBRARY_PATH
PATH=/usr/lib/${PRODUCT}
PATH=/usr/lib/${PRODUCT}/${SUBSYSTEM}:${PATH}
PATH=/usr/lib/sparcv9/${PRODUCT}:${PATH}
PATH=/usr/lib/sparcv9/${PRODUCT}/${SUBSYSTEM}:${PATH}
export PATH
else
invalid_architecture "${ARCHITECTURE}"
exit 255
fi
else
invalid_operating_system "${OS}"
exit 255
fi
###############################################################################
## (4) Execute the binary executable specified by this command wrapper ##
## based upon the preset LD_LIBRARY_PATH and PATH environment variables.##
###############################################################################
ORIGINAL_IFS=${IFS}
IFS=:
for dir in ${PATH}
do
if [ -x ${dir}/${COMMAND} ]
then
IFS=${ORIGINAL_IFS}
${dir}/${COMMAND} "$@"
exit $?
fi
done
echo "Unable to find \"${COMMAND}\" in \"${PATH}\"!"
exit 255
|