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