5
# Source debconf library.
6
. /usr/share/debconf/confmodule
8
# In d-i the config script is not executed automatically
9
if [ -f /usr/share/console-setup-mini/keyboard-configuration.config ]; then
10
/usr/share/console-setup-mini/keyboard-configuration.config || exit $?
13
## KEYBOARD_PRESENT ## Will be replaced by keyboard_present function
15
# keyboard_present () {
16
# if there is a keyboard; then
23
CONFIGFILE=/etc/default/keyboard
25
if [ "$1" = "configure" ]; then
27
db_get keyboard-configuration/modelcode
30
db_get keyboard-configuration/layoutcode
33
db_get keyboard-configuration/variantcode
36
db_get keyboard-configuration/optionscode
39
if [ ! -e $CONFIGFILE ]; then
40
cat /usr/share/doc/keyboard-configuration/examples/keyboard \
41
/usr/share/console-setup-mini/keyboard \
42
2>/dev/null >$CONFIGFILE || true
45
# Ensure we do not mess up the config file's ownership and permissions.
46
cp -a -f $CONFIGFILE $CONFIGFILE.tmp
48
# If the admin deleted or commented some variables but then set
49
# them via debconf, (re-)add them to the conffile.
50
for var in XKBMODEL XKBLAYOUT XKBVARIANT XKBOPTIONS; do
51
if ! grep "^ *${var}=" $CONFIGFILE >/dev/null; then
52
echo "${var}=" >>$CONFIGFILE
57
-e "s|^ *XKBMODEL=.*|XKBMODEL=\"$model\"|" \
58
-e "s|^ *XKBLAYOUT=.*|XKBLAYOUT=\"$layout\"|" \
59
-e "s|^ *XKBVARIANT=.*|XKBVARIANT=\"$variant\"|" \
60
-e "s|^ *XKBOPTIONS=.*|XKBOPTIONS=\"$options\"|" \
61
<$CONFIGFILE >$CONFIGFILE.tmp
63
mv -f $CONFIGFILE.tmp $CONFIGFILE
66
# In d-i debhelper doesn't use /etc/init.d scripts
68
[ -f /usr/share/console-setup-mini/keyboard ] && keyboard_present
70
setupcon --force --save