slitaz-tools view tinyutils/tazkeymap @ rev 431
Auto-install non-free firmware (to avoid wifi confusion for users)
author | Rohit Joshi <jozee@slitaz.org> |
---|---|
date | Mon Feb 22 13:05:37 2010 +0000 (2010-02-22) |
parents | db0e82bebc70 |
children | f70b81b03d05 |
line source
1 #!/bin/sh
2 #
3 # Tazkeymap - SliTaz GNU/Linux keymap config using loadkeys and dialog boxes.
4 # Configuration file is : /etc/kbd.conf
5 #
6 # (C) SliTaz GNU/Linux - 20080427 <pankso@slitaz.org> - GNU gpl.
7 #
8 : ${DIALOG=tazdialog}
9 export ICON="accessories-character-map"
11 # Script functions.
12 status()
13 {
14 local CHECK=$?
15 echo -en "\\033[70G[ "
16 if [ $CHECK = 0 ]; then
17 echo -en "\\033[1;33mOK"
18 else
19 echo -en "\\033[1;31mFailed"
20 fi
21 echo -e "\\033[0;39m ]"
22 }
24 # Check if user is root.
25 #
26 if test $(id -u) != 0; then
27 echo ""
28 echo "You must be root to run `basename $0`!"
29 echo "Type 'su' and root password to become super-user."
30 echo ""
31 exit 1
32 fi
34 # Get current keymap if it exists.
35 if [ -s /etc/keymap.conf ]; then
36 CUR=`cat /etc/keymap.conf`
37 else
38 CUR="none"
39 fi
41 # Dialog menu.
42 #
43 exec 3>&1
44 value=`$DIALOG --clear \
45 --title " SliTaz keymap configuration " \
46 --menu "\nPlease select your keymap, current config: $CUR" 15 70 5 \
47 "fr_CH-latin1" "Suisse Romande" \
48 "fr-latin1" "France" \
49 "be-latin1" "Belgique" \
50 "br-abnt2" "Brazil" \
51 "cf" "Canada/Quebec" \
52 "croat" "Croat" \
53 "cz-lat2" "Czech" \
54 "de_CH-latin1" "Schweizer Deutsch" \
55 "de-latin1" "Deutchland" \
56 "dk-latin1" "Danemark" \
57 "dvorak" "Dvorak" \
58 "dvorak-r" "Dvorak (right-hand)" \
59 "dvorak-l" "Dvorak (left-hand)" \
60 "es" "Spain/Mexico" \
61 "fi-latin1" "Finland" \
62 "hu" "Hungria" \
63 "it" "Italia" \
64 "is-latin1" "Island" \
65 "jp106" "Japan" \
66 "nl2" "Netherlands" \
67 "no-latin1" "Norway" \
68 "pl2" "Poland" \
69 "pt-latin1" "Portugal" \
70 "ru" "Russia" \
71 "se-lat6" "Sweden" \
72 "sg-latin1" "Singapore " \
73 "uk" "United Kingdom" \
74 "us-acentos" "USA Acentos" \
75 "us" "USA" \
76 2>&1 1>&3`
77 retval=$?
78 exec 3>&-
80 case $retval in
81 0)
82 continue ;;
83 1)
84 echo "Cancel pressed."
85 exit 0 ;;
86 255)
87 if test -n "$value" ; then
88 echo "$value"
89 else
90 echo "ESC pressed."
91 exit 0
92 fi ;;
93 esac
95 # If it's a reconfiguration give an info message.
96 if [ -s /etc/keymap.conf ]; then
97 $DIALOG --clear \
98 --title " Keyboard mapping information\n" \
99 --msgbox "
100 Please logout of your current session and login again to use $value
101 keyboard.\n" 16 70
102 fi
104 # Now we can load the selected kmap file from /usr/share/kbd/keymaps.
105 #
106 echo "$value" > /etc/keymap.conf
107 if [ -x /bin/loadkeys ]; then
108 loadkeys $value
109 else
110 loadkmap < /usr/share/kmap/$value.kmap
111 fi
113 exit 0