~eugenenuke/ubuntu/wily/console-setup/fix-for-1565542

« back to all changes in this revision

Viewing changes to debian/keyboard-configuration.postinst

  • Committer: Bazaar Package Importer
  • Author(s): Anton Zinoviev
  • Date: 2009-11-13 18:03:11 UTC
  • mto: (3.2.4 squeeze)
  • mto: This revision was merged to the branch mainline in revision 82.
  • Revision ID: james.westby@ubuntu.com-20091113180311-bjggr7j6mryc1pzm
Tags: 1.47
* Separate the keyboard configuration in a new package
  keyboard-configuration.  No font configuration in console-setup-mini
  and console-setup-udeb.  Thanks to Celejar, Luís Picciochi Oliveira,
  Francesco Poli and Bill Brelsford.  
  Closes: #542003, #548837, #546983, #548262, #536600, #536614.
* Use CONSOLE_MAP configuration variable instead of ACM (to be the same
  as kbd).
* Use Uni2 instead of Uni1 when no good default codeset can be detected.
  Its better to have one more fully supported language (Greek) than two
  unsupported right to left languages (Arabic and Hebrew).
* Configuration variable KMAP for personnal keymaps.  Thanks to Samuel
  Thibault, closes: #546740.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!/bin/sh
 
2
 
 
3
set -e
 
4
 
 
5
# Source debconf library.
 
6
. /usr/share/debconf/confmodule
 
7
 
 
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 $?
 
11
fi
 
12
 
 
13
## KEYBOARD_PRESENT ## Will be replaced by keyboard_present function
 
14
 
 
15
# keyboard_present () {
 
16
#     if there is a keyboard; then
 
17
#       return 0
 
18
#     else
 
19
#       return 1
 
20
#     fi
 
21
# }
 
22
 
 
23
CONFIGFILE=/etc/default/keyboard
 
24
 
 
25
if [ "$1" = "configure" ]; then
 
26
    
 
27
    db_get keyboard-configuration/modelcode
 
28
    model="$RET"
 
29
 
 
30
    db_get keyboard-configuration/layoutcode
 
31
    layout="$RET"
 
32
 
 
33
    db_get keyboard-configuration/variantcode
 
34
    variant="$RET"
 
35
 
 
36
    db_get keyboard-configuration/optionscode
 
37
    options="$RET"
 
38
 
 
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
 
43
    fi
 
44
 
 
45
    # Ensure we do not mess up the config file's ownership and permissions.
 
46
    cp -a -f $CONFIGFILE $CONFIGFILE.tmp
 
47
 
 
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
 
53
        fi
 
54
    done    
 
55
    
 
56
    sed \
 
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
 
62
    
 
63
    mv -f $CONFIGFILE.tmp $CONFIGFILE
 
64
fi
 
65
 
 
66
# In d-i debhelper doesn't use /etc/init.d scripts
 
67
if \
 
68
    [ -f /usr/share/console-setup-mini/keyboard ] && keyboard_present
 
69
then
 
70
    setupcon --force --save
 
71
fi
 
72
 
 
73
#DEBHELPER#