1 | #!/bin/ksh93
|
---|
2 | #
|
---|
3 | # Based on mesa_vendor_select from Solaris 11.3 with the following copyright:
|
---|
4 | #
|
---|
5 | # Copyright (c) 2006, 2011, Oracle and/or its affiliates. All rights reserved.
|
---|
6 | #
|
---|
7 | # Permission is hereby granted, free of charge, to any person obtaining a
|
---|
8 | # copy of this software and associated documentation files (the "Software"),
|
---|
9 | # to deal in the Software without restriction, including without limitation
|
---|
10 | # the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
---|
11 | # and/or sell copies of the Software, and to permit persons to whom the
|
---|
12 | # Software is furnished to do so, subject to the following conditions:
|
---|
13 | #
|
---|
14 | # The above copyright notice and this permission notice (including the next
|
---|
15 | # paragraph) shall be included in all copies or substantial portions of the
|
---|
16 | # Software.
|
---|
17 | #
|
---|
18 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
---|
19 | # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
---|
20 | # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
---|
21 | # THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
---|
22 | # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
---|
23 | # FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
---|
24 | # DEALINGS IN THE SOFTWARE.
|
---|
25 | #
|
---|
26 | #
|
---|
27 |
|
---|
28 | LINKDIR=/system/volatile/opengl
|
---|
29 | MESA_SELECT=/lib/opengl/ogl_select/mesa_vendor_select
|
---|
30 |
|
---|
31 | PATH=/usr/bin:/usr/sbin
|
---|
32 |
|
---|
33 | ARCH="$(uname -p)"
|
---|
34 |
|
---|
35 | case "${ARCH}" in
|
---|
36 | i386) ;;
|
---|
37 | *) exit 1 ;; # Unsupported architecture
|
---|
38 | esac
|
---|
39 |
|
---|
40 | # We need Mesa for the parts we do not supply.
|
---|
41 | if [[ ! -x "${MESA_SELECT}" ]]; then
|
---|
42 | exit 0
|
---|
43 | fi
|
---|
44 |
|
---|
45 | if [[ $# -eq 1 ]] && [[ $1 == "identify" ]] ; then
|
---|
46 | # Probe time. Check whether this system supports pass-through.
|
---|
47 | # If so, emit an identity string attaching us to the current
|
---|
48 | # console identifier.
|
---|
49 | if /usr/bin/VBoxClient --check3d ; then
|
---|
50 | print "$(constype) vbox"
|
---|
51 | fi
|
---|
52 | return 0
|
---|
53 | fi
|
---|
54 |
|
---|
55 | # Make a file link. $1 is the source path, $2 is the target path
|
---|
56 | function make_link {
|
---|
57 | if [[ $# != 2 ]]; then
|
---|
58 | return
|
---|
59 | fi
|
---|
60 | if [[ -h $2 ]]; then
|
---|
61 | rm -f $2
|
---|
62 | fi
|
---|
63 | ln -sf $1 $2
|
---|
64 | }
|
---|
65 |
|
---|
66 | # Start by setting up Mesa, as we use that for everything except the user
|
---|
67 | # libraries.
|
---|
68 | ${MESA_SELECT}
|
---|
69 |
|
---|
70 | # User libraries
|
---|
71 | if [[ -f ${LINKDIR}/lib/libGL.so.1 ]] && [[ -f /usr/lib/VBoxOGL.so ]] ; then
|
---|
72 | make_link /usr/lib/VBoxOGL.so ${LINKDIR}/lib/libGL.so.1
|
---|
73 | fi
|
---|
74 | if [[ -f ${LINKDIR}/lib/i386/libGL.so.1 ]] && \
|
---|
75 | [[ -f /usr/lib/i386/VBoxOGL.so ]] ; then
|
---|
76 | make_link /usr/lib/i386/VBoxOGL.so ${LINKDIR}/lib/i386/libGL.so.1
|
---|
77 | fi
|
---|
78 | if [[ -f ${LINKDIR}/lib/amd64/libGL.so.1 ]] && \
|
---|
79 | [[ -f /usr/lib/amd64/VBoxOGL.so ]] ; then
|
---|
80 | make_link /usr/lib/amd64/VBoxOGL.so ${LINKDIR}/lib/amd64/libGL.so.1
|
---|
81 | fi
|
---|
82 |
|
---|
83 | return 0
|
---|