diff --git a/xlog2xconf.sh b/xlog2xconf.sh new file mode 100644 index 0000000..89a6507 --- /dev/null +++ b/xlog2xconf.sh @@ -0,0 +1,83 @@ +#!/bin/sh +# +# Create minimal xorg.conf extracted from Xorg..log +# +# -c (use to specify configfile to create) +# -e (edit file with $EDITOR after creation) +# -f (overwrite existing ) +# -l (use to specify X logfile to read) +# + +if [ $UID -ne 0 ]; then + echo "You must be root" + exit 1 +fi + +configfile=/etc/X11/xorg.conf +editor=false +overwrite=false +logfile=/var/log/Xorg.0.log + +while getopts ":c:efl:" opt; do + case $opt in + c ) configfile=${OPTARG} + ;; + e ) editor=true + ;; + f ) overwrite=true + ;; + l ) logfile=${OPTARG} + ;; + * ) echo 'usage: minimal-xconfig [-c ] [-e] [-f] [-l ]' + exit 1 + ;; + esac +done + +if [ ! -f $logfile ]; then + echo "$logfile does not exist." + echo "Use \"-l \" to specify a different logfile." + exit 1 +fi + +if ! grep -q -- "(==) --- Start of built-in configuration ---" $logfile; then + echo "$logfile does not contain the required xorg.conf section." + echo "Probably it uses a regular xorg.conf." + echo "Use \"-l \" to specify a different logfile." + exit 1 +fi + +if [ -f $configfile -a "$overwrite" == "false" ]; then + echo "$configfile already exists." + echo "Use \"-f\" to overwrite or \"-c \" to specify a different configfile." + exit 1 +fi + +begin=false + +cat $logfile | \ +while read line; do + if [ "$begin" == "true" ]; then + if echo $line | grep -q -- "(==) --- End of built-in configuration ---"; then + break + else + if ! echo $line | grep -q ^Section; then + if ! echo $line | grep -q ^EndSection; then + echo -n " " + fi + fi + echo $line + test "$line" == "EndSection" && echo + fi + elif echo $line | grep -q -- "(==) --- Start of built-in configuration ---"; then + begin=true + fi +done > $configfile + +if [ "$editor" == "true" ]; then + $EDITOR $configfile +else + echo "created $configfile" +fi + +exit 0 diff --git a/xorg-x11-server.changes b/xorg-x11-server.changes index fe2b51e..3cf8a0b 100644 --- a/xorg-x11-server.changes +++ b/xorg-x11-server.changes @@ -1,3 +1,9 @@ +------------------------------------------------------------------- +Sun Dec 13 11:52:48 CET 2009 - sndirsch@suse.de + +- added xlog2xconf, which is a script to create a minimal xorg.conf + extracted from Xorg..log + ------------------------------------------------------------------- Sun Nov 29 17:43:43 CET 2009 - sndirsch@suse.de diff --git a/xorg-x11-server.spec b/xorg-x11-server.spec index caf1c1c..c67e55f 100644 --- a/xorg-x11-server.spec +++ b/xorg-x11-server.spec @@ -33,7 +33,7 @@ BuildRequires: libjpeg-devel Url: http://xorg.freedesktop.org/ %define EXPERIMENTAL 0 Version: 7.4 -Release: 63 +Release: 64 License: GPLv2+ ; MIT License (or similar) BuildRoot: %{_tmppath}/%{name}-%{version}-build Group: System/X11/Servers/XF86_4 @@ -61,6 +61,7 @@ Source4: xorgcfg.tar.bz2 Source5: modprobe.nvidia %endif Source7: xorg-docs-1.4.tar.bz2 +Source8: xlog2xconf.sh Patch1: fpic.diff Patch2: p_default-module-path.diff Patch6: pu_fixes.diff @@ -421,6 +422,7 @@ mkdir -p %buildroot/var/adm/fillup-templates install -m 644 %_sourcedir/sysconfig.displaymanager.template \ %buildroot/var/adm/fillup-templates/sysconfig.displaymanager-%name %endif +install -m 755 %_sourcedir/xlog2xconf.sh %buildroot/usr/bin/xlog2xconf %clean rm -rf "$RPM_BUILD_ROOT" @@ -560,6 +562,7 @@ exit 0 %endif %ifnarch s390 s390x %verify(not mode) /usr/bin/Xorg +/usr/bin/xlog2xconf %endif %ifnarch s390 s390x /usr/bin/cvt