add xvfb-run to Xvfb package
This commit is contained in:
parent
b4b3d379ea
commit
1b89ad9379
@ -19,7 +19,7 @@
|
|||||||
Summary: X.Org X11 X server
|
Summary: X.Org X11 X server
|
||||||
Name: xorg-x11-server
|
Name: xorg-x11-server
|
||||||
Version: 1.5.1
|
Version: 1.5.1
|
||||||
Release: 2%{?dist}
|
Release: 3%{?dist}
|
||||||
URL: http://www.x.org
|
URL: http://www.x.org
|
||||||
License: MIT
|
License: MIT
|
||||||
Group: User Interface/X
|
Group: User Interface/X
|
||||||
@ -40,6 +40,9 @@ Source1: gitignore
|
|||||||
Source10: 10-x11-keymap.fdi
|
Source10: 10-x11-keymap.fdi
|
||||||
Source11: fedora-setup-keyboard
|
Source11: fedora-setup-keyboard
|
||||||
|
|
||||||
|
# Useful xvfb-run script
|
||||||
|
Source20: http://svn.exactcode.de/t2/trunk/package/xorg/xorg-server/xvfb-run.sh
|
||||||
|
|
||||||
# OpenGL compositing manager feature/optimization patches.
|
# OpenGL compositing manager feature/optimization patches.
|
||||||
Patch100: xorg-x11-server-1.1.0-no-move-damage.patch
|
Patch100: xorg-x11-server-1.1.0-no-move-damage.patch
|
||||||
Patch101: xserver-1.4.99-dont-backfill-bg-none.patch
|
Patch101: xserver-1.4.99-dont-backfill-bg-none.patch
|
||||||
@ -213,6 +216,8 @@ application for Xdmx would be to unify a 4 by 4 grid of 1280x1024 displays
|
|||||||
%package Xvfb
|
%package Xvfb
|
||||||
Summary: A X Windows System virtual framebuffer X server.
|
Summary: A X Windows System virtual framebuffer X server.
|
||||||
Group: User Interface/X
|
Group: User Interface/X
|
||||||
|
# xvfb-run is GPLv2, rest is MIT
|
||||||
|
License: MIT and GPLv2
|
||||||
Obsoletes: xorg-x11-Xvfb
|
Obsoletes: xorg-x11-Xvfb
|
||||||
Requires: xorg-x11-server-common >= %{version}-%{release}
|
Requires: xorg-x11-server-common >= %{version}-%{release}
|
||||||
Provides: Xvfb
|
Provides: Xvfb
|
||||||
@ -346,6 +351,8 @@ cp hw/xfree86/{xorgconf.cpp,Options} %{inst_srcdir}/hw/xfree86
|
|||||||
cp hw/xfree86/common/{vesamodes,extramodes} %{inst_srcdir}/hw/xfree86/common
|
cp hw/xfree86/common/{vesamodes,extramodes} %{inst_srcdir}/hw/xfree86/common
|
||||||
cp hw/xfree86/utils/xorgconfig/Cards{,98} %{inst_srcdir}/hw/xfree86/utils/xorgconfig/
|
cp hw/xfree86/utils/xorgconfig/Cards{,98} %{inst_srcdir}/hw/xfree86/utils/xorgconfig/
|
||||||
|
|
||||||
|
install -m 0755 %{SOURCE20} $RPM_BUILD_ROOT%{_bindir}/xfvb-run
|
||||||
|
|
||||||
find . -type f | egrep '.*\.(c|h|am|ac|inc|m4|h.in|pc.in|man.pre|pl|txt)$' |
|
find . -type f | egrep '.*\.(c|h|am|ac|inc|m4|h.in|pc.in|man.pre|pl|txt)$' |
|
||||||
xargs tar cf - | (cd %{inst_srcdir} && tar xf -)
|
xargs tar cf - | (cd %{inst_srcdir} && tar xf -)
|
||||||
|
|
||||||
@ -476,6 +483,7 @@ rm -rf $RPM_BUILD_ROOT
|
|||||||
%files Xvfb
|
%files Xvfb
|
||||||
%defattr(-,root,root,-)
|
%defattr(-,root,root,-)
|
||||||
%{_bindir}/Xvfb
|
%{_bindir}/Xvfb
|
||||||
|
%{_bindir}/xvfb-run
|
||||||
%{_mandir}/man1/Xvfb.1*
|
%{_mandir}/man1/Xvfb.1*
|
||||||
|
|
||||||
|
|
||||||
@ -501,6 +509,9 @@ rm -rf $RPM_BUILD_ROOT
|
|||||||
|
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Tue Sep 30 2008 Tom "spot" Callaway <tcallawa@redhat.com> 1.5.1-3
|
||||||
|
- add xvfb-run helper script to Xvfb package
|
||||||
|
|
||||||
* Thu Sep 25 2008 Dave Airlie <airlied@redhat.com> 1.5.1-2
|
* Thu Sep 25 2008 Dave Airlie <airlied@redhat.com> 1.5.1-2
|
||||||
- fix crash with x11perf on r500 modesetting
|
- fix crash with x11perf on r500 modesetting
|
||||||
|
|
||||||
|
187
xvfb-run.sh
Normal file
187
xvfb-run.sh
Normal file
@ -0,0 +1,187 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
# --- T2-COPYRIGHT-NOTE-BEGIN ---
|
||||||
|
# This copyright note is auto-generated by ./scripts/Create-CopyPatch.
|
||||||
|
#
|
||||||
|
# T2 SDE: package/.../xorg-server/xvfb-run.sh
|
||||||
|
# Copyright (C) 2005 The T2 SDE Project
|
||||||
|
# Copyright (C) XXXX - 2005 Debian
|
||||||
|
#
|
||||||
|
# More information can be found in the files COPYING and README.
|
||||||
|
#
|
||||||
|
# This program is free software; you can redistribute it and/or modify
|
||||||
|
# it under the terms of the GNU General Public License as published by
|
||||||
|
# the Free Software Foundation; version 2 of the License. A copy of the
|
||||||
|
# GNU General Public License can be found in the file COPYING.
|
||||||
|
# --- T2-COPYRIGHT-NOTE-END ---
|
||||||
|
|
||||||
|
# $Id$
|
||||||
|
# from: http://necrotic.deadbeast.net/xsf/XFree86/trunk/debian/local/xvfb-run
|
||||||
|
|
||||||
|
# This script starts an instance of Xvfb, the "fake" X server, runs a command
|
||||||
|
# with that server available, and kills the X server when done. The return
|
||||||
|
# value of the command becomes the return value of this script.
|
||||||
|
#
|
||||||
|
# If anyone is using this to build a Debian package, make sure the package
|
||||||
|
# Build-Depends on xvfb, xbase-clients, and xfonts-base.
|
||||||
|
|
||||||
|
set -e
|
||||||
|
|
||||||
|
PROGNAME=xvfb-run
|
||||||
|
SERVERNUM=99
|
||||||
|
AUTHFILE=
|
||||||
|
ERRORFILE=/dev/null
|
||||||
|
STARTWAIT=3
|
||||||
|
XVFBARGS="-screen 0 640x480x8"
|
||||||
|
LISTENTCP="-nolisten tcp"
|
||||||
|
XAUTHPROTO=.
|
||||||
|
|
||||||
|
# Query the terminal to establish a default number of columns to use for
|
||||||
|
# displaying messages to the user. This is used only as a fallback in the event
|
||||||
|
# the COLUMNS variable is not set. ($COLUMNS can react to SIGWINCH while the
|
||||||
|
# script is running, and this cannot, only being calculated once.)
|
||||||
|
DEFCOLUMNS=$(stty size 2>/dev/null | awk '{print $2}') || true
|
||||||
|
if ! expr "$DEFCOLUMNS" : "[[:digit:]]\+$" >/dev/null 2>&1; then
|
||||||
|
DEFCOLUMNS=80
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Display a message, wrapping lines at the terminal width.
|
||||||
|
message () {
|
||||||
|
echo "$PROGNAME: $*" | fmt -t -w ${COLUMNS:-$DEFCOLUMNS}
|
||||||
|
}
|
||||||
|
|
||||||
|
# Display an error message.
|
||||||
|
error () {
|
||||||
|
message "error: $*" >&2
|
||||||
|
}
|
||||||
|
|
||||||
|
# Display a usage message.
|
||||||
|
usage () {
|
||||||
|
if [ -n "$*" ]; then
|
||||||
|
message "usage error: $*"
|
||||||
|
fi
|
||||||
|
cat <<EOF
|
||||||
|
Usage: $PROGNAME [OPTION ...] COMMAND
|
||||||
|
Run COMMAND (usually an X client) in a virtual X server environment.
|
||||||
|
Options:
|
||||||
|
-a --auto-servernum try to get a free server number, starting at
|
||||||
|
--server-num
|
||||||
|
-e FILE --error-file=FILE file used to store xauth errors and Xvfb
|
||||||
|
output (default: $ERRORFILE)
|
||||||
|
-f FILE --auth-file=FILE file used to store auth cookie
|
||||||
|
(default: ./.Xauthority)
|
||||||
|
-h --help display this usage message and exit
|
||||||
|
-n NUM --server-num=NUM server number to use (default: $SERVERNUM)
|
||||||
|
-l --listen-tcp enable TCP port listening in the X server
|
||||||
|
-p PROTO --xauth-protocol=PROTO X authority protocol name to use
|
||||||
|
(default: xauth command's default)
|
||||||
|
-s ARGS --server-args=ARGS arguments (other than server number and
|
||||||
|
"-nolisten tcp") to pass to the Xvfb server
|
||||||
|
(default: "$XVFBARGS")
|
||||||
|
-w DELAY --wait=DELAY delay in seconds to wait for Xvfb to start
|
||||||
|
before running COMMAND (default: $STARTWAIT)
|
||||||
|
EOF
|
||||||
|
}
|
||||||
|
|
||||||
|
# Find a free server number by looking at .X*-lock files in /tmp.
|
||||||
|
find_free_servernum() {
|
||||||
|
# Sadly, the "local" keyword is not POSIX. Leave the next line commented in
|
||||||
|
# the hope Debian Policy eventually changes to allow it in /bin/sh scripts
|
||||||
|
# anyway.
|
||||||
|
#local i
|
||||||
|
|
||||||
|
i=$SERVERNUM
|
||||||
|
while [ -f /tmp/.X$i-lock ]; do
|
||||||
|
i=$(($i + 1))
|
||||||
|
done
|
||||||
|
echo $i
|
||||||
|
}
|
||||||
|
|
||||||
|
# Parse the command line.
|
||||||
|
ARGS=$(getopt --options +ae:f:hn:lp:s:w: \
|
||||||
|
--long auto-servernum,error-file:auth-file:,help,server-num:,listen-tcp,xauth-protocol:,server-args:,wait: \
|
||||||
|
--name "$PROGNAME" -- "$@")
|
||||||
|
GETOPT_STATUS=$?
|
||||||
|
|
||||||
|
if [ $GETOPT_STATUS -ne 0 ]; then
|
||||||
|
error "internal error; getopt exited with status $GETOPT_STATUS"
|
||||||
|
exit 6
|
||||||
|
fi
|
||||||
|
|
||||||
|
eval set -- "$ARGS"
|
||||||
|
|
||||||
|
while :; do
|
||||||
|
case "$1" in
|
||||||
|
-a|--auto-servernum) SERVERNUM=$(find_free_servernum) ;;
|
||||||
|
-e|--error-file) ERRORFILE="$2"; shift ;;
|
||||||
|
-f|--auth-file) AUTHFILE="$2"; shift ;;
|
||||||
|
-h|--help) SHOWHELP="yes" ;;
|
||||||
|
-n|--server-num) SERVERNUM="$2"; shift ;;
|
||||||
|
-l|--listen-tcp) LISTENTCP="" ;;
|
||||||
|
-p|--xauth-protocol) XAUTHPROTO="$2"; shift ;;
|
||||||
|
-s|--server-args) XVFBARGS="$2"; shift ;;
|
||||||
|
-w|--wait) STARTWAIT="$2"; shift ;;
|
||||||
|
--) shift; break ;;
|
||||||
|
*) error "internal error; getopt permitted \"$1\" unexpectedly"
|
||||||
|
exit 6
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
shift
|
||||||
|
done
|
||||||
|
|
||||||
|
if [ "$SHOWHELP" ]; then
|
||||||
|
usage
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -z "$*" ]; then
|
||||||
|
usage "need a command to run" >&2
|
||||||
|
exit 2
|
||||||
|
fi
|
||||||
|
|
||||||
|
if ! which xauth >/dev/null; then
|
||||||
|
error "xauth command not found"
|
||||||
|
exit 3
|
||||||
|
fi
|
||||||
|
|
||||||
|
# If the user did not specify an X authorization file to use, set up a temporary
|
||||||
|
# directory to house one.
|
||||||
|
if [ -z "$AUTHFILE" ]; then
|
||||||
|
XVFB_RUN_TMPDIR="${TMPDIR:-/tmp}/$PROGNAME.$$"
|
||||||
|
if ! mkdir -p -m 700 "$XVFB_RUN_TMPDIR"; then
|
||||||
|
error "temporary directory $XVFB_RUN_TMPDIR already exists"
|
||||||
|
exit 4
|
||||||
|
fi
|
||||||
|
AUTHFILE=$(mktemp -p "$XVFB_RUN_TMPDIR" Xauthority)
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Start Xvfb.
|
||||||
|
MCOOKIE=$(mcookie)
|
||||||
|
XAUTHORITY=$AUTHFILE xauth add ":$SERVERNUM" "$XAUTHPROTO" "$MCOOKIE" \
|
||||||
|
>"$ERRORFILE" 2>&1
|
||||||
|
XAUTHORITY=$AUTHFILE Xvfb ":$SERVERNUM" $XVFBARGS $LISTENTCP >"$ERRORFILE" \
|
||||||
|
2>&1 &
|
||||||
|
XVFBPID=$!
|
||||||
|
sleep "$STARTWAIT"
|
||||||
|
|
||||||
|
# Start the command and save its exit status.
|
||||||
|
set +e
|
||||||
|
DISPLAY=:$SERVERNUM XAUTHORITY=$AUTHFILE "$@" 2>&1
|
||||||
|
RETVAL=$?
|
||||||
|
set -e
|
||||||
|
|
||||||
|
# Kill Xvfb now that the command has exited.
|
||||||
|
kill $XVFBPID
|
||||||
|
|
||||||
|
# Clean up.
|
||||||
|
XAUTHORITY=$AUTHFILE xauth remove ":$SERVERNUM" >"$ERRORFILE" 2>&1
|
||||||
|
if [ -n "$XVFB_RUN_TMPDIR" ]; then
|
||||||
|
if ! rm -r "$XVFB_RUN_TMPDIR"; then
|
||||||
|
error "problem while cleaning up temporary directory"
|
||||||
|
exit 5
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Return the executed command's exit status.
|
||||||
|
exit $RETVAL
|
||||||
|
|
||||||
|
# vim:set ai et sts=4 sw=4 tw=80:
|
Loading…
Reference in New Issue
Block a user