xref: /titanic_41/usr/src/lib/brand/solaris10/cmd/s10_python_wrapper.sh (revision 6a634c9dca3093f3922e4b7ab826d7bdf17bf78e)
1#!/bin/sh
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# Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
23#
24
25#
26# This script is invoked by python-governed executable wrappers from within
27# s10-branded zones.  It uses the native python and native linker.
28# The only consumer is currently the zfs command which uses python for
29# a few of its subcommands.
30#
31# All native executables must be run using the native linker.
32# By default, the kernel loads the linker at /lib/ld.so.1, which
33# in an s10 zone is the s10 linker.  Hence when we run the native
34# executable below, we explicitly specify /.SUNWnative/lib/ld.so.1 as our 32-
35# bit linker and /.SUNWnative/lib/64/ld.so.1 as our 64-bit linker.
36# For convience we define "n" to be the native path prefix.
37#
38pyname=$0
39n=/.SUNWnative
40
41PYTHONPATH=/.SUNWnative/usr/lib/python2.6/vendor-packages
42export PYTHONPATH
43
44# This wrapper is running in the S10 zone so there is no L10N for the
45# following error msg.
46if [ ! -f $n$pyname ]; then
47	echo "Error: \"$pyname\" is not installed in the global zone"
48	exit 1
49fi
50
51exec $n/usr/lib/brand/solaris10/s10_native \
52    $n/lib/ld.so.1 \
53    -e LD_NOENVIRON=1 \
54    -e LD_NOCONFIG=1 \
55    -e LD_PRELOAD_32=s10_npreload.so.1 \
56    -e LD_PRELOAD_64=s10_npreload.so.1 \
57    -e LD_LIBRARY_PATH_32="$n/lib:$n/usr/lib:$n/usr/lib/mps" \
58    -e LD_LIBRARY_PATH_64="$n/lib/64:$n/usr/lib/64:$n/usr/lib/mps/64" \
59    $n/usr/bin/python2.6 $n$pyname "$@"
60