Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
PojavLauncherTeam
GitHub Repository: PojavLauncherTeam/mobile
Path: blob/master/test/jdk/start-Xvfb.sh
40675 views
1
#!/bin/sh -f
2
#
3
# Copyright (c) 2009, Oracle and/or its affiliates. All rights reserved.
4
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5
#
6
# This code is free software; you can redistribute it and/or modify it
7
# under the terms of the GNU General Public License version 2 only, as
8
# published by the Free Software Foundation. Oracle designates this
9
# particular file as subject to the "Classpath" exception as provided
10
# by Oracle in the LICENSE file that accompanied this code.
11
#
12
# This code is distributed in the hope that it will be useful, but WITHOUT
13
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
14
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
15
# version 2 for more details (a copy is included in the LICENSE file that
16
# accompanied this code).
17
#
18
# You should have received a copy of the GNU General Public License version
19
# 2 along with this work; if not, write to the Free Software Foundation,
20
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
21
#
22
# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
23
# or visit www.oracle.com if you need additional information or have any
24
# questions.
25
#
26
27
#
28
# Original Author: Tim Bell
29
#
30
usage() {
31
echo "Starts up an Xvfb dummy X server with fvwm2 window manager"
32
echo " usage:"
33
echo " ${0} display_number_file"
34
echo " display_number_file gets display number when it's ready"
35
exit
36
}
37
#
38
currentDir=`pwd`
39
rm -f $1
40
DD=":$$"
41
DISPLAY=${DD}
42
export DISPLAY
43
cd /tmp
44
#
45
if [ ! -x "/usr/bin/X11/Xvfb" ]; then
46
# We have Solaris-flavored X windows, and the /usr/openwin Xvfb is
47
# a simple wrapper script around the Xsun server. Massage the
48
# arguments: server number must be first; others are slightly
49
# different.
50
#
51
# Also the default Visual Class (DirectColor) triggers an awt bug
52
# (probably 4131533/6505852) and some tests will loop endlessly
53
# when they hit the display. The workaround is:
54
# 1) Ask for PseudoColor instead.
55
# 2) Omit 32-bit depth.
56
/usr/bin/nohup /usr/openwin/bin/Xvfb ${DISPLAY} -dev vfb screen 0 1280x1024x24 pixdepths 8 16 24 defclass PseudoColor > ${currentDir}/nohup.$$ 2>&1 &
57
else
58
# Linux...
59
/usr/bin/nohup /usr/bin/X11/Xvfb -fbdir ${currentDir} -pixdepths 8 16 24 32 ${DISPLAY} > ${currentDir}/nohup.$$ 2>&1 &
60
fi
61
WM="/usr/bin/X11/fvwm2"
62
#
63
# Wait for Xvfb to initialize:
64
sleep 5
65
#
66
if [ -x "${WM}" ]; then
67
# 2 JCK tests require a window manager
68
# mwm fails (key name errors) and twm fails (hangs),
69
# but fvwm2 works well.
70
/usr/bin/nohup ${WM} -display ${DISPLAY} -replace -f /dev/null > ${currentDir}/nohup.$$ 2>&1 &
71
else
72
echo "Error: ${WM} not found"
73
exit 1
74
fi
75
#
76
# Wait some more to see if the xhost command gets through:
77
sleep 10
78
# Allow access to all - this is a brute force approach,
79
# but I do not see how it could be a security problem...
80
DISPLAY="${DD}" xhost +
81
#
82
echo "Virtual frame buffer started on ${DISPLAY}"
83
echo "$$" > $1
84
wait
85
86