[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Preliminary patches for console-setup (for g-i)



First, I want to thank you for your work.  I will upload fixed packages 
in the next hour.

On Tue, Feb 16, 2010 at 01:34:57AM +0100, Cyril Brulebois wrote:
> 
>  - 0001-Try-and-cp-console-setup-as-well.patch: I've described its
>    effects in [1].
> 
>     1. http://lists.debian.org/debian-boot/2010/02/msg00334.html
>
>  if keyboard_present; then
>      mkdir -p /target/etc/default
> +    cp -a /etc/default/console-setup /target/etc/default/
>      cp -a /etc/default/keyboard /target/etc/default/
>      apt-install keyboard-configuration || true
>      apt-install console-setup || true

I don't understand the copying of /etc/default/console-setup. 
This file simply doesn't exist.

>  - 0002-Call-setxkbmap-in-postinst-if-available.patch: Checks for
>    setxkbmap, for $DISPLAY, and for keyboard_present before calling
>    setxkbmap accordingly. That's what I mentioned at the end of [1].
>
> @@ -70,4 +70,10 @@ then
>      setupcon --force --save
>  fi
>  
> +# There's no 'which' in d-i's shell:
> +SETXKBMAP=/usr/bin/setxkbmap
> +if [ -x "$SETXKBMAP" ] && [ ! -z "$DISPLAY" ] && keyboard_present; then
> +    $SETXKBMAP "$layout" "$variant" $options
> +fi
> +
>  #DEBHELPER#

In the patch I commited I moved setxkbmap near the setupcon because I 
want it executed only in d-i environment.  Although there are some 
people who want setupcon to configure the X keyboard (me too) I'd prefer 
not to implement this until there is someone who can take care for the 
X-related problems.

>  - 0003-Try-and-preseed-a-bit-using-internal-stuff-only-for.patch:

This is what caused the problems you observed:

1. The config script didn't test properly that it is executed d-i environment

2. Because of this it attempted to ask the model question.  This was 
impossible because the udeb had no strings for the keyboard models 
(to save space).

3. In result the postinst writes XKBMODEL="" in the configuration file.

4. Then the main package installed in /target.  It asked its questions 
because nobody told it not to do so.

5. Then a sanity check caused the model question to be asked for second 
time in the postinst (because of XKBMODEL="" in the configuration file, 
which should be impossible).

The correct scenario is this:

1. The udeb asks it questions and creates a configuration file.  

2. /usr/lib/base-installer.d/20console-setup copies the configuration 
file in /target

3. It also marks the questions of keyboard-configuration as seen (I 
haven't tested this).

4. The main package doesn't reask the questions because their seen flags 
are true.

>  if keyboard_present; then
> -    mkdir -p /target/etc/default
> -    cp -a /etc/default/console-setup /target/etc/default/
> -    cp -a /etc/default/keyboard /target/etc/default/
> +    # Disable direct copy:
> +    #mkdir -p /target/etc/default
> +    #cp -a /etc/default/console-setup /target/etc/default/
> +    #cp -a /etc/default/keyboard /target/etc/default/
> +
> +    # Try and preseed instead:
> +    for i in layoutcode modelcode optionscode variantcode; do
> +    db_get keyboard-configuration/$i
> +    LC_ALL=C chroot /target debconf-set-selections <<EOF
> +d-i keyboard-configuration/$i string $RET
> +EOF
> +    done
> +
> +    # Trigger installation:
>      apt-install keyboard-configuration || true
>      apt-install console-setup || true
>  fi

The preseeding approach you used also works but I think it is more 
dangerous because a bug could result in bad values and maybe even 
unusable keyboard.  On the other hand if the configuration file is 
copyed in /target the bugs would only cause some questions to be asked 
twice.

Anton Zinoviev


Reply to: