Skip to content
Commits on Source (3)
  • Eli Schwartz's avatar
    debian/local/xvfb-run: Fix use of deprecated tempfile utility · fdabbaca
    Eli Schwartz authored and Julien Cristau's avatar Julien Cristau committed
    tempfile is pretty well guaranteed to not be available on other
    distributions, and continuing to use it over mktemp just encourages bad
    scripting practices.
    
    It was unnecessary here anyway as the parent directory was already
    securely created and it was only being used to combine file creation and
    variable assignment in one command (by taking advantage of the fact that
    tempfile, when given a hardcoded filename, will also print the same
    filename back to you). It makes much more sense to simply set the
    variable, and `touch` the file separately.
    fdabbaca
  • Eli Schwartz's avatar
    debian/local/xvfb-run: Use builtin `case` to test variable value, rather than external `expr` · 72da781e
    Eli Schwartz authored and Julien Cristau's avatar Julien Cristau committed
    This is both faster and more pretty. Because case statements are just
    that awesome.
    72da781e
  • Julien Cristau's avatar
    xvfb-run: use "command -v" rather than "which" · 819b2f0c
    Julien Cristau authored
    Using a shell builtin is preferable to an external command, and "which"
    may not be available on some systems such as Arch Linux.
    
    This is not currently strictly conformant with Debian policy as "command
    -v" is not part of SUSv3, but policy is in the process of being updated,
    see bug#864615.
    
    Debian bug#889676
    819b2f0c
......@@ -22,9 +22,9 @@ XAUTHPROTO=.
# 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
case "$DEFCOLUMNS" in
*[!0-9]*|'') DEFCOLUMNS=80 ;;
esac
# Display a message, wrapping lines at the terminal width.
message () {
......@@ -134,7 +134,7 @@ if [ -z "$*" ]; then
exit 2
fi
if ! which xauth >/dev/null; then
if ! command -v xauth >/dev/null; then
error "xauth command not found"
exit 3
fi
......@@ -146,8 +146,9 @@ trap clean_up EXIT
# directory to house one.
if [ -z "$AUTHFILE" ]; then
XVFB_RUN_TMPDIR="$(mktemp -d -t $PROGNAME.XXXXXX)"
AUTHFILE="$XVFB_RUN_TMPDIR/Xauthority"
# Create empty file to avoid xauth warning
AUTHFILE=$(tempfile -n "$XVFB_RUN_TMPDIR/Xauthority")
touch "$AUTHFILE"
fi
# Start Xvfb.
......