Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
X
xvfb-run-patches
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
steinbac
xvfb-run-patches
Commits
1faaa116
Commit
1faaa116
authored
8 years ago
by
steinbac
Browse files
Options
Downloads
Patches
Plain Diff
initial upload
parents
Branches
master
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
README.md
+3
-0
3 additions, 0 deletions
README.md
centos/6.x/xvfb-run
+206
-0
206 additions, 0 deletions
centos/6.x/xvfb-run
centos/7.x/xvfb-run
+8
-0
8 additions, 0 deletions
centos/7.x/xvfb-run
with
217 additions
and
0 deletions
README.md
0 → 100644
+
3
−
0
View file @
1faaa116
# XVFB-RUN PATCHES
Here are patched versions of /usr/bin/xvfb-run to allow multiple xvfb-run processes on one machine.
This diff is collapsed.
Click to expand it.
centos/6.x/xvfb-run
0 → 100755
+
206
−
0
View file @
1faaa116
#!/bin/sh
#######################################################################
#
# 17-sep-2013: the original script does not properly check the existence
# of sockets belonging to previous instances of Xvfb. The wrong display
# is thus assigned, causing execution to fail. The following line has
# been modified below to fix that:
#
# < while [ -e /tmp/.X11-unix/X$i ]; do
# ---
# > while [ -f /tmp/.X$i-lock ]; do
#
#######################################################################
# --- 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 #### Oscar, 05-nov-2013: wrong filename!
while
[
-e
/tmp/.X11-unix/X
$i
]
;
do
#### this is the right name
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
"
#### Oscar, 05-nov-2013: SERVERNUM was fixed at 99 up there, and -a is not
#### the default option, so users running this are expected to collide at
#### display 99. we enforce a dynamic value here. -a will re-assign it if
#### specified in the command line, which is ok
SERVERNUM
=
$(
find_free_servernum
)
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
=
"
$(
mktemp
--directory
--tmpdir
$PROGNAME
.XXXXXX
)
"
AUTHFILE
=
$(
mktemp
-p
"
$XVFB_RUN_TMPDIR
"
Xauthority.XXXXXX
)
fi
# Start Xvfb.
MCOOKIE
=
$(
mcookie
)
XAUTHORITY
=
$AUTHFILE
xauth
source
-
<<
EOF
>>"
$ERRORFILE
" 2>&1
add :
$SERVERNUM
$XAUTHPROTO
$MCOOKIE
EOF
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:
This diff is collapsed.
Click to expand it.
centos/7.x/xvfb-run
0 → 100755
+
8
−
0
View file @
1faaa116
#!/bin/sh
# -d should deal with the different users' displays better than the
# old -a did in CentOS 6.x. without -d, whether with or without -a,
# the original script needs a fix to work
exec
/usr/bin/xvfb-run
-d
"
$@
"
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment