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