blob: ce1e6d7782e1fd640f09990ff995174261ff0fbe (
about) (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
|
#!/bin/sh
# Copyright 1993, 1999, 2002 Patrick Volkerding, Moorhead, MN.
# Copyright 2009, 2023 Patrick J. Volkerding, Sebeka, MN, USA
# Use and redistribution covered by the same terms as the "setup" script.
TMP=/var/log/setup/tmp
RDIR=/dev/tty4
if [ ! -d $TMP ]; then
mkdir -p $TMP
fi
while [ 0 ]; do
# Construct the list of available keymaps:
MAPLIST="$(cd /usr/share/kbd/keymaps/i386 ; find azerty bepo carpalx colemak dvorak fgGIod neo olpc qwerty qwertz | grep / | grep .map.gz$ | rev | cut -f 2- -d . | rev | less | sort | less | sed "s|^|\"|g" | sed "s|$|\" \"\" |g" | tr -d "\n")"
cat << EOF > $TMP/select_keymap.sh
dialog --title "KEYBOARD MAP SELECTION" --menu "You may select one \
of the following keyboard maps. If you do not select a keyboard \
map, 'us.map' (the US keyboard map) is the default. Use the UP/DOWN \
arrow keys and PageUp/PageDown to scroll \
through the whole list of choices." \
22 55 11 \
"qwerty/us.map" "" "qwerty/uk.map" "" $MAPLIST \
2> $TMP/SeTkeymap
EOF
sh $TMP/select_keymap.sh
if [ ! $? = 0 ]; then
rm -f $TMP/SeTkeymap $TMP/select_keymap.sh
exit
fi
rm -f $TMP/select_keymap.sh
MAPNAME="$(cat $TMP/SeTkeymap)"
MAPNAME="$(basename $MAPNAME)"
echo $MAPNAME > $TMP/SeTkeymap
loadkeys -q $MAPNAME
while [ 0 ]; do
# Match the dialog colors a little while doing the keyboard test:
setterm -background cyan -foreground black -blank 0
clear
cat << EOF
OK, the new map is now installed. You may now test it by typing
anything you want. To quit testing the keyboard, enter 1 on a
line by itself to accept the map and go on, or 2 on a line by
itself to reject the current keyboard map and select a new one.
EOF
echo -n " "
read REPLY
if [ "$REPLY" = "1" -o "$REPLY" = "2" ]; then
break;
fi
done
setterm -background black -foreground white -blank 0
if [ "$REPLY" = "1" ]; then
# Make a persistent (P) copy so starting setup won't erase it:
cp $TMP/SeTkeymap $TMP/Pkeymap
break;
else
rm -f $TMP/$MAPNAME
rm -f $TMP/SeTkeymap $TMP/Pkeymap
# Clear bad selection:
loadkeys -q us.map
continue;
fi
done
|