Resync with Debian's 1.157.1-1
[live-initramfs-grml.git] / scripts / live-bottom / 19keyboard
1 #!/bin/sh
2
3 #set -e
4
5 # initramfs-tools header
6
7 PREREQ=""
8
9 prereqs()
10 {
11         echo "${PREREQ}"
12 }
13
14 case "${1}" in
15         prereqs)
16                 prereqs
17                 exit 0
18                 ;;
19 esac
20
21 # live-initramfs header
22
23 if [ -n "${NOCONSOLEKEYBOARD}" ]
24 then
25         exit 0
26 fi
27
28 . /scripts/live-functions
29
30 log_begin_msg "Setting up console keyboard"
31
32 # live-initramfs script
33
34 kbd=
35 cslayout=
36 csvariant=
37 csmodel=
38
39 # commandline
40 if [ -n "${KBD}" ]
41 then
42         kbd="${KBD}"
43 else
44         kbd=us
45 fi
46
47 really_export kbd
48
49 if [ -n "${KLAYOUT}" ]
50 then
51         cslayout="${KLAYOUT}"
52 fi
53
54 if [ -n "${KVARIANT}" ]
55 then
56         csvariant="${KVARIANT}"
57 fi
58
59 if [ -n "${KMODEL}" ]
60 then
61         csmodel="${KMODEL}"
62 fi
63
64 if [ -x /root/bin/setupcon ] && [ -f /root/etc/default/console-setup ]
65 then
66         if [ "${cslayout}" ]
67         then
68                 chroot /root sed -i "s/^XKBLAYOUT=.*/XKBLAYOUT=\"${cslayout}\"/" \
69                 /etc/default/console-setup
70
71                 if [ "${csvariant}" ]
72                 then
73                         chroot /root sed -i "s/^XKBVARIANT=.*/XKBVARIANT=\"${csvariant}\"/" \
74                         /etc/default/console-setup
75                 else
76                         live-preseed /root console-setup/variantcode '' false
77                 fi
78
79                 if [ "${csmodel}" ]
80                 then
81                         chroot /root sed -i "s/^XKBMODEL=.*/XKBMODEL=\"${csmodel}\"/" \
82                         /etc/default/console-setup
83                 else
84                         live-preseed /root console-setup/modelcode '' false
85                 fi
86         else
87                 live-preseed /root console-setup/layoutcode '' false
88                 live-preseed /root console-setup/variantcode '' false
89                 live-preseed /root console-setup/modelcode '' false
90         fi
91
92         live-preseed /root console-setup/optionscode '' false
93         live-preseed /root console-setup/codesetcode '' false
94
95         sed -i 's/CONSOLE_SCREEN=$/CONSOLE_SCREEN=setupcon/; t END; b; : END; n; b END' /root/etc/init.d/usplash
96 elif [ -e /root/usr/sbin/install-keymap ]
97 then
98         chroot /root /usr/sbin/install-keymap ${kbd}
99         live-preseed /root debian-installer/keymap "${kbd}"
100         live-preseed /root kbd-chooser/method "${kbd}"
101 fi
102
103 log_end_msg