slitaz-tools view tinyutils/tazkeymap @ rev 582

Add: po/tazdrop/pt.po
author Claudinei Pereira <claudinei@slitaz.org>
date Fri Apr 29 20:35:11 2011 +0300 (2011-04-29)
parents 513cf2248bf4
children cd1c6f4ddeb3
line source
1 #!/bin/sh
2 #
3 # Tazkeymap - SliTaz GNU/Linux keymap config using loadkeys and dialog boxes.
4 # Configuration file is : /etc/keymap.conf
5 #
6 # (C) SliTaz GNU/Linux - 2011 <pankso@slitaz.org> - GNU gpl.
7 #
8 : ${DIALOG=dialog}
10 # Check if user is root.
11 #
12 if test $(id -u) != 0; then
13 echo -e "\nYou must be root to run `basename $0`!"
14 echo -e "Type 'su' and root password to become super-user.\n"
15 exit 1
16 fi
18 # Get current keymap if it exists.
19 if [ -s /etc/keymap.conf ]; then
20 CUR=`cat /etc/keymap.conf`
21 else
22 CUR="none"
23 fi
25 # Load the selected kmap file from /usr/share/kbd/keymaps or Busybox kmaps.
26 load_keymap() {
27 if [ -x /bin/loadkeys ]; then
28 loadkeys $kmap
29 else
30 loadkmap < /usr/share/kmap/$kmap.kmap
31 fi
32 }
34 case "$1" in
35 init)
36 # Used to configure keymap from cmdline or scripts
37 kmap=$2
38 echo "$kmap" > /etc/keymap.conf
39 load_keymap ;;
40 *)
41 # Default to text mode dialog.
42 exec 3>&1
43 value=`$DIALOG --clear \
44 --title " SliTaz keymap configuration " \
45 --menu "\nPlease select your keymap, current config: $CUR" 15 70 5 \
46 "us" "USA" \
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 "trq" "Turkey" \
74 "uk" "United Kingdom" \
75 "us-acentos" "USA Acentos" \
76 2>&1 1>&3`
77 retval=$?
78 exec 3>&-
79 case $retval in
80 0)
81 continue ;;
82 1)
83 echo "Cancel pressed."
84 exit 0 ;;
85 255)
86 if test -n "$value" ; then
87 echo "$value"
88 else
89 echo "ESC pressed."
90 exit 0
91 fi ;;
92 esac
93 # If it's a reconfiguration give an info message.
94 if [ -s /etc/keymap.conf ]; then
95 $DIALOG --clear \
96 --title " Keyboard mapping information\n" \
97 --msgbox "
98 Please logout of your current session and login again to use $value
99 keyboard.\n" 16 70
100 fi
101 kmap=$value
102 echo "$kmap" > /etc/keymap.conf
103 load_keymap ;;
104 esac
106 exit 0