1821N/A#!/bin/sh -f
1821N/A#
2362N/A# Copyright (c) 2009, Oracle and/or its affiliates. All rights reserved.
1821N/A# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
1821N/A#
1821N/A# This code is free software; you can redistribute it and/or modify it
1821N/A# under the terms of the GNU General Public License version 2 only, as
2362N/A# published by the Free Software Foundation. Oracle designates this
1821N/A# particular file as subject to the "Classpath" exception as provided
2362N/A# by Oracle in the LICENSE file that accompanied this code.
1821N/A#
1821N/A# This code is distributed in the hope that it will be useful, but WITHOUT
1821N/A# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
1821N/A# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
1821N/A# version 2 for more details (a copy is included in the LICENSE file that
1821N/A# accompanied this code).
1821N/A#
1821N/A# You should have received a copy of the GNU General Public License version
1821N/A# 2 along with this work; if not, write to the Free Software Foundation,
1821N/A# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
1821N/A#
2362N/A# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
2362N/A# or visit www.oracle.com if you need additional information or have any
2362N/A# questions.
1821N/A#
1821N/A
1821N/A#
1821N/A# Original Author: Tim Bell
1821N/A#
1821N/Ausage() {
1821N/A echo "Starts up an Xvfb dummy X server with fvwm2 window manager"
1821N/A echo " usage:"
1821N/A echo " ${0} display_number_file"
1821N/A echo " display_number_file gets display number when it's ready"
1821N/A exit
1821N/A }
1821N/A#
1821N/AcurrentDir=`pwd`
1821N/Arm -f $1
1821N/ADD=":$$"
1821N/ADISPLAY=${DD}
1821N/Aexport DISPLAY
1821N/Acd /tmp
1821N/A#
1821N/Aif [ ! -x "/usr/bin/X11/Xvfb" ]; then
1821N/A # We have Solaris-flavored X windows, and the /usr/openwin Xvfb is
1821N/A # a simple wrapper script around the Xsun server. Massage the
1821N/A # arguments: server number must be first; others are slightly
1821N/A # different.
1821N/A #
1821N/A # Also the default Visual Class (DirectColor) triggers an awt bug
1821N/A # (probably 4131533/6505852) and some tests will loop endlessly
1821N/A # when they hit the display. The workaround is:
1821N/A # 1) Ask for PseudoColor instead.
1821N/A # 2) Omit 32-bit depth.
1821N/A /usr/bin/nohup /usr/openwin/bin/Xvfb ${DISPLAY} -dev vfb screen 0 1280x1024x24 pixdepths 8 16 24 defclass PseudoColor > ${currentDir}/nohup.$$ 2>&1 &
1821N/Aelse
1821N/A # Linux...
1821N/A /usr/bin/nohup /usr/bin/X11/Xvfb -fbdir ${currentDir} -pixdepths 8 16 24 32 ${DISPLAY} > ${currentDir}/nohup.$$ 2>&1 &
1821N/Afi
1821N/AWM="/usr/bin/X11/fvwm2"
1821N/Aif [ ! -x ${WM} ] ; then
1821N/A WM="/opt/sfw/bin/fvwm2"
1821N/Afi
1821N/A#
1821N/A# Wait for Xvfb to initialize:
1821N/Asleep 5
1821N/A#
1821N/Aif [ -x "${WM}" ]; then
1821N/A# 2 JCK tests require a window manager
1821N/A# mwm fails (key name errors) and twm fails (hangs),
1821N/A# but fvwm2 works well.
1821N/A /usr/bin/nohup ${WM} -display ${DISPLAY} -replace -f /dev/null > ${currentDir}/nohup.$$ 2>&1 &
1821N/Aelse
1821N/A echo "Error: ${WM} not found"
1821N/A exit 1
1821N/Afi
1821N/A#
1821N/A# Wait some more to see if the xhost command gets through:
1821N/Asleep 10
1821N/A# Allow access to all - this is a brute force approach,
1821N/A# but I do not see how it could be a security problem...
1821N/ADISPLAY="${DD}" xhost +
1821N/A#
1821N/Aecho "Virtual frame buffer started on ${DISPLAY}"
1821N/Aecho "$$" > $1
1821N/Await