Bug#605777: workaround for backspace key deletes forwards on the kFreeBSD console

2011-01-18 Thread Petr Salinger

The integration should be into /etc/init.d/kbdcontrol,
by adding two targets, like keymap-native and keymap-debian.

May be it can be run even semi-automatically, by
detecting whether the /etc/inittab uses cons25 or cons25-debian
and noop or alter keymap.


Yes, I like the latter (auto detection) part. Another solution could be a
debconf question in kbdcontrol (though it might be too late for this).


Attached is the proposed new /etc/init.d/kbdcontrol.
The current default is
FLAVOUR=auto

Should be the default auto or native ?

Is there still a time to do freebsd-utils upload ?
The only change against current one would be the new 
/etc/init.d/kbdcontrol script.


Cheers
Petr#! /bin/sh
### BEGIN INIT INFO
# Provides: kbdcontrol
# Required-Start:   $local_fs $remote_fs
# Required-Stop:
# Default-Start:S
# Default-Stop:
# Short-Description:Set keymap
# Description:  Set the Console keymap
### END INIT INFO
#
# skeleton  example file to build /etc/init.d/ scripts.
#   This file should be used to construct scripts for /etc/init.d.
#
#   Written by Miquel van Smoorenburg miqu...@cistron.nl.
#   Modified for Debian 
#   by Ian Murdock imurd...@gnu.ai.mit.edu.
#
# Version:  @(#)skeleton  1.9  26-Feb-2001  miqu...@cistron.nl
#

set -e

PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
which kbdcontrol /dev/null

# in general, keymap layout can be
# native:  the plain FreeBSD/cons25 layout
# debian:  the Debian Policy 9.8 (Keyboard configuration) conforming, aka 
cons25-debian
# auto:scan /etc/inittab and guess the right one
FLAVOUR=auto

# for auto do the guess
if [ $FLAVOUR = auto ]
then
  if grep -q -e respawn:/sbin/getty.*cons25-debian /etc/inittab
  then
FLAVOUR=debian
  fi
fi


alter_to_debian_keymap () {
# change keymap layout to Debian Policy 9.8 (Keyboard configuration) 
conforming

# 014   deldelbs bs deldelbs bs  O
# 142   deldelbs bs deldelbs bs  O

# 103   fkey61 fkey61 fkey61 fkey61 fkey61 fkey61 boot   fkey61  O
# 231   fkey61 fkey61 fkey61 fkey61 fkey61 fkey61 boot   fkey61  O

# in following part change only first one, do not change the rest 
(decimal separator)

# 083   fkey61 '.''.''.''.''.'boot   bootN
# 211   fkey61 '.''.''.''.''.'boot   bootN

echo -n Altering to policy conforming cons25-debian layout...
TMPFILE=`mktemp -t keymap.XX` || exit 1

kbdcontrol -d | sed \
  -e s/^  083   del   /  083   fkey61/ \
  -e s/^  211   del   /  211   fkey61/ \
  -e s/^  083   bs/  083   fkey61/ \
  -e s/^  211   bs/  211   fkey61/ \
  -e s/^  014   .*/  014   deldelbs bs deldel
bs bs  O/ \
  -e s/^  142   .*/  142   deldelbs bs deldel
bs bs  O/ \
  -e s/^  103   .*/  103   fkey61 fkey61 fkey61 fkey61 fkey61 fkey61 
boot   fkey61  O/ \
  -e s/^  231   .*/  231   fkey61 fkey61 fkey61 fkey61 fkey61 fkey61 
boot   fkey61  O/ \
   $TMPFILE

kbdcontrol -l $TMPFILE  
rm -f $TMPFILE
  
# and generate  ESC [ 3 ~ for fkey61  
SEQ=`/bin/echo -n -e \\\033[3~`
#echo $SEQ | od -ax
kbdcontrol -f 61 $SEQ
echo done.
}


alter_to_native_keymap () {
# change keymap layout to usual cons25

# 014   bs bs deldelbs bs deldel O
# 142   bs bs deldelbs bs deldel O

echo -n Altering to native cons25 layout...
TMPFILE=`mktemp -t keymap.XX` || exit 1

kbdcontrol -d | sed \
  -e s/^  014   .*/  014   bs bs deldelbs bs 
deldel O/ \
  -e s/^  142   .*/  142   bs bs deldelbs bs 
deldel O/ \
   $TMPFILE

kbdcontrol -l $TMPFILE  
rm -f $TMPFILE
  
# and generate del for fkey61  
SEQ=`/bin/echo -n -e 177`
#echo $SEQ | od -ax
kbdcontrol -f 61 $SEQ
echo done.
}


do_start() {
if test -e /etc/kbdcontrol.conf ; then
echo -n Loading console keymap...
kbdcontrol -l `grep -v ^# /etc/kbdcontrol.conf`  /dev/console
echo done.
fi
}


case $1 in
  start|)
do_start
if [ $FLAVOUR = debian ]
then
alter_to_debian_keymap  /dev/console
fi
;;
  restart|reload|force-reload)
echo Error: argument '$1' not supported 2
exit 3
;;
  stop)
# No-op
;;
  keymap-native)
alter_to_native_keymap  /dev/console
;;
  keymap-debian)
alter_to_debian_keymap  /dev/console
;;
  *)
echo Usage: $0 

Bug#605777: workaround for backspace key deletes forwards on the kFreeBSD console

2011-01-18 Thread Sven Joachim
On 2011-01-18 09:17 +0100, Petr Salinger wrote:

 The integration should be into /etc/init.d/kbdcontrol,
 by adding two targets, like keymap-native and keymap-debian.

 May be it can be run even semi-automatically, by
 detecting whether the /etc/inittab uses cons25 or cons25-debian
 and noop or alter keymap.

 Yes, I like the latter (auto detection) part. Another solution could be a
 debconf question in kbdcontrol (though it might be too late for this).

 Attached is the proposed new /etc/init.d/kbdcontrol.
 The current default is
 FLAVOUR=auto

 Should be the default auto or native ?

 Is there still a time to do freebsd-utils upload ?
 The only change against current one would be the new
 /etc/init.d/kbdcontrol script.

 Cheers
   Petr

 #! /bin/sh
 ### BEGIN INIT INFO
 # Provides: kbdcontrol
 # Required-Start:   $local_fs $remote_fs
 # Required-Stop:
 # Default-Start:S
 # Default-Stop:
 # Short-Description:Set keymap
 # Description:  Set the Console keymap
 ### END INIT INFO
 #
 # skeletonexample file to build /etc/init.d/ scripts.
 # This file should be used to construct scripts for /etc/init.d.
 #
 # Written by Miquel van Smoorenburg miqu...@cistron.nl.
 # Modified for Debian 
 # by Ian Murdock imurd...@gnu.ai.mit.edu.
 #
 # Version:@(#)skeleton  1.9  26-Feb-2001  miqu...@cistron.nl
 #

 set -e

 PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
 which kbdcontrol /dev/null

Please add  || exit 0 to not fail if kbdcontrol is removed but not
purged.

 # in general, keymap layout can be
 # native:  the plain FreeBSD/cons25 layout
 # debian:  the Debian Policy 9.8 (Keyboard configuration) conforming, aka 
 cons25-debian
 # auto:scan /etc/inittab and guess the right one
 FLAVOUR=auto

 # for auto do the guess
 if [ $FLAVOUR = auto ]
 then
   if grep -q -e respawn:/sbin/getty.*cons25-debian /etc/inittab

This will match lines that are commented out.

Cheers,
   Sven



-- 
To UNSUBSCRIBE, email to debian-bugs-rc-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org



Bug#605777: workaround for backspace key deletes forwards on the kFreeBSD console

2011-01-10 Thread Petr Salinger

The change for freebsd-utils will be some new script like

  kbdcontrol -d | sed ... | kbdcontrol -l
  kbdcontrol -f 61 ESC[3~
  TERM=cons25-debian


Attached is the mentioned script. It have to be run directly on console
or by sh keymap-policy.sh  /dev/console
The keymap is altered system wide, i.e. on all virtual consoles.
And you have to manually set TERM=cons25-debian aftewards.

The (current) reset back is
  /etc/init.d/kbdcontrol start
  kbdcontrol -F
  TERM=cons25

Please could you test whether it work with your
native national keymap as expected ?

The expected installed (and running) packages versions are:
 freebsd-utils 8.1-3.1
 kfreebsd-8 8.1+dfsg-7.1
 ncurses 5.7+20100313-5

RFC part:
The integration should be into /etc/init.d/kbdcontrol,
by adding two targets, like keymap-native and keymap-debian.

May be it can be run even semi-automatically, by
detecting whether the /etc/inittab uses cons25 or cons25-debian
and noop or alter keymap.

Many thanks

Petr


keymap-policy.sh
Description: Bourne shell script


Bug#605777: workaround for backspace key deletes forwards on the kFreeBSD console

2011-01-10 Thread Sven Joachim
On 2011-01-10 12:27 +0100, Petr Salinger wrote:

 The change for freebsd-utils will be some new script like

   kbdcontrol -d | sed ... | kbdcontrol -l
   kbdcontrol -f 61 ESC[3~
   TERM=cons25-debian

 Attached is the mentioned script. It have to be run directly on console
 or by sh keymap-policy.sh  /dev/console
 The keymap is altered system wide, i.e. on all virtual consoles.
 And you have to manually set TERM=cons25-debian aftewards.

 The (current) reset back is
   /etc/init.d/kbdcontrol start
   kbdcontrol -F
   TERM=cons25

 Please could you test whether it work with your
 native national keymap as expected ?

Works fine with german.iso.kbd in /etc/kbdcontrol.conf, thanks.

Cheers,
   Sven



-- 
To UNSUBSCRIBE, email to debian-bugs-rc-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org



Bug#605777: workaround for backspace key deletes forwards on the kFreeBSD console

2011-01-10 Thread Modestas Vainius
Hello,

On pirmadienis 10 Sausis 2011 13:27:51 Petr Salinger wrote:
  The change for freebsd-utils will be some new script like
  
kbdcontrol -d | sed ... | kbdcontrol -l
kbdcontrol -f 61 ESC[3~
TERM=cons25-debian
 
 Attached is the mentioned script. It have to be run directly on console
 or by sh keymap-policy.sh  /dev/console
 The keymap is altered system wide, i.e. on all virtual consoles.
 And you have to manually set TERM=cons25-debian aftewards.
 
 The (current) reset back is
/etc/init.d/kbdcontrol start
kbdcontrol -F
TERM=cons25
 
 Please could you test whether it work with your
 native national keymap as expected ?

It works fine. Both shell and vim behave as I expect now.

 The expected installed (and running) packages versions are:
   freebsd-utils 8.1-3.1
   kfreebsd-8 8.1+dfsg-7.1
   ncurses 5.7+20100313-5
 
 RFC part:
 The integration should be into /etc/init.d/kbdcontrol,
 by adding two targets, like keymap-native and keymap-debian.
 
 May be it can be run even semi-automatically, by
 detecting whether the /etc/inittab uses cons25 or cons25-debian
 and noop or alter keymap.

Yes, I like the latter (auto detection) part. Another solution could be a 
debconf question in kbdcontrol (though it might be too late for this).

What's more, I think this issue (with short instructions whatever the final 
integration part ends up being) warrants a note in release notes.

-- 
Modestas Vainius mo...@debian.org


signature.asc
Description: This is a digitally signed message part.