~ubuntu-branches/ubuntu/vivid/xresprobe/vivid

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#!/bin/sh
# usage: xprobe.sh driver
# Copyright (C) 2004 Canonical Ltd.
# Author: Daniel Stone <daniel.stone@ubuntu.com>
# 
#  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.
#
#  This program is distributed in the hope that it will be useful,
#  but WITHOUT ANY WARRANTY; without even the implied warranty of
#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#  GNU General Public License for more details.
#
#  You should have received a copy of the GNU General Public License with
#  the Debian GNU/Linux distribution in file /usr/share/common-licenses/GPL-2;
#  if not, write to the Free Software Foundation, Inc., 59 Temple Place,
#  Suite 330, Boston, MA  02111-1307  USA
#
# On Debian systems, the complete text of the GNU General Public
# License, version 2, can be found in /usr/share/common-licenses/GPL-2.

DATAPATH="/usr/share/xresprobe"

DRIVER="$1"
if [ -z "$DRIVER" ]; then
  echo "Driver name must be specified on the command line."
  exit 1
fi

set -e
if [ -z "$TMPDIR" ]; then
	TMPDIR="/tmp"
fi
XDIR="$TMPDIR/xprobe.$$"
TMPCONF="$XDIR/xorg.conf"
TMPLOG="$XDIR/xorg.log"
TMPOUT="$XDIR/xorg-stdout.log"

mkdir -m700 "$XDIR"
sed -e "s/::DRIVER::/$DRIVER/;" < "$DATAPATH/xorg.conf" > "$TMPCONF"
set +e

if [ "$DRIVER" = "vesa" ]; then
  /usr/bin/Xorg :67 -ac -probeonly -logfile "$TMPLOG" > "$TMPOUT" 2>&1
else
  /usr/bin/Xorg :67 -ac -probeonly -logfile "$TMPLOG" -config "$TMPCONF" > "$TMPOUT" 2>&1
fi

echo "$XDIR"
exit 0