On Wed, Mar 25, 2009 at 07:55:54PM +0100, Julien Cristau wrote:
> On Wed, 2009-03-25 at 20:09 +0200, Anton Zinoviev wrote:
> > 
> > It is not only your script - the parsing of console-setup doesn't allow 
> > spaces between options so this will require a patch too.
> 
> It should be easy to remove the spaces directly from the awk script, if
> you want to avoid touching other parts of console-setup for that.  Let
> me know if I should prepare an updated patch.

I decided it is best to do both, so after some reading of the mawk 
manual ;) I added in console-setup support for spaces and made the 
awk-script remove them. I also made the script to ignore lines such as

Option          "XkbModel"      "pc"104"

Since this is a grave bug I decided to build and upload the package now.  
However I am not 100% sure about the syntax of xorg.conf, so if you want 
you can check that the new variant of the script works properly.
:) I have attached it.

BTW, the xorg.conf of Celejar discovered another bug in Debconf 
configuration of console-setup:

       xkblayout=us,il
       xkbvariant=dvorak, 

became

       xkblayout=us,il
       xkbvariant=,

I fixed this too.

Anton Zinoviev

#!/usr/bin/awk -f

{
    $0 = tolower($0);
    sub("#.*","")
    xkb = "";
}

/^[ \t]*section[ \t]+"inputdevice"/,/^[ \t]*endsection/ {
    if ($1 == "option") {
        if ($2 == "\"xkbmodel\"") {
            xkb = "XKBMODEL";
        } else if ($2 == "\"xkblayout\"") {
            xkb = "XKBLAYOUT";
        } else if ($2 == "\"xkbvariant\"") {
            xkb = "XKBVARIANT";
        } else if ($2 == "\"xkboptions\"") {
            xkb = "XKBOPTIONS"; 
        }
        $1 = "";
        $2 = "";
    }
}

xkb != "" && /^[ \t]*\"[^"]+\"[ \t]*$/ {
    sub("^[ \t]*\"", "");
    sub("\".*", "");
    gsub("[ \t]", "");
    print xkb "=\"" $0 "\"";
}

Reply via email to