[2] | 1 | #!/bin/sh -f
|
---|
| 2 | #
|
---|
[278] | 3 | # Copyright (c) 2009, Oracle and/or its affiliates. All rights reserved.
|
---|
[2] | 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
|
---|
[278] | 8 | # published by the Free Software Foundation. Oracle designates this
|
---|
[2] | 9 | # particular file as subject to the "Classpath" exception as provided
|
---|
[278] | 10 | # by Oracle in the LICENSE file that accompanied this code.
|
---|
[2] | 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 | #
|
---|
[278] | 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.
|
---|
[2] | 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 | if [ ! -x ${WM} ] ; then
|
---|
| 63 | WM="/opt/sfw/bin/fvwm2"
|
---|
| 64 | fi
|
---|
| 65 | #
|
---|
| 66 | # Wait for Xvfb to initialize:
|
---|
| 67 | sleep 5
|
---|
| 68 | #
|
---|
| 69 | if [ -x "${WM}" ]; then
|
---|
| 70 | # 2 JCK tests require a window manager
|
---|
| 71 | # mwm fails (key name errors) and twm fails (hangs),
|
---|
| 72 | # but fvwm2 works well.
|
---|
| 73 | /usr/bin/nohup ${WM} -display ${DISPLAY} -replace -f /dev/null > ${currentDir}/nohup.$$ 2>&1 &
|
---|
| 74 | else
|
---|
| 75 | echo "Error: ${WM} not found"
|
---|
| 76 | exit 1
|
---|
| 77 | fi
|
---|
| 78 | #
|
---|
| 79 | # Wait some more to see if the xhost command gets through:
|
---|
| 80 | sleep 10
|
---|
| 81 | # Allow access to all - this is a brute force approach,
|
---|
| 82 | # but I do not see how it could be a security problem...
|
---|
| 83 | DISPLAY="${DD}" xhost +
|
---|
| 84 | #
|
---|
| 85 | echo "Virtual frame buffer started on ${DISPLAY}"
|
---|
| 86 | echo "$$" > $1
|
---|
| 87 | wait
|
---|