slitaz-tools diff tinyutils/tazkeymap @ rev 578
Update scpbox.pt & subox.pt
author | Claudinei Pereira <claudinei@slitaz.org> |
---|---|
date | Fri Apr 29 16:10:46 2011 +0000 (2011-04-29) |
parents | 513cf2248bf4 |
children | cd1c6f4ddeb3 |
line diff
1.1 --- a/tinyutils/tazkeymap Fri Apr 29 11:27:26 2011 +0200 1.2 +++ b/tinyutils/tazkeymap Fri Apr 29 16:10:46 2011 +0000 1.3 @@ -6,16 +6,13 @@ 1.4 # (C) SliTaz GNU/Linux - 2011 <pankso@slitaz.org> - GNU gpl. 1.5 # 1.6 : ${DIALOG=dialog} 1.7 -export ICON="accessories-character-map" 1.8 1.9 # Check if user is root. 1.10 # 1.11 if test $(id -u) != 0; then 1.12 - echo "" 1.13 - echo "You must be root to run `basename $0`!" 1.14 - echo "Type 'su' and root password to become super-user." 1.15 - echo "" 1.16 - exit 1 1.17 + echo -e "\nYou must be root to run `basename $0`!" 1.18 + echo -e "Type 'su' and root password to become super-user.\n" 1.19 + exit 1 1.20 fi 1.21 1.22 # Get current keymap if it exists. 1.23 @@ -25,77 +22,85 @@ 1.24 CUR="none" 1.25 fi 1.26 1.27 -# Dialog menu. 1.28 -# 1.29 -exec 3>&1 1.30 -value=`$DIALOG --clear \ 1.31 - --title " SliTaz keymap configuration " \ 1.32 - --menu "\nPlease select your keymap, current config: $CUR" 15 70 5 \ 1.33 -"us" "USA" \ 1.34 -"fr_CH-latin1" "Suisse Romande" \ 1.35 -"fr-latin1" "France" \ 1.36 -"be-latin1" "Belgique" \ 1.37 -"br-abnt2" "Brazil" \ 1.38 -"cf" "Canada/Quebec" \ 1.39 -"croat" "Croat" \ 1.40 -"cz-lat2" "Czech" \ 1.41 -"de_CH-latin1" "Schweizer Deutsch" \ 1.42 -"de-latin1" "Deutchland" \ 1.43 -"dk-latin1" "Danemark" \ 1.44 -"dvorak" "Dvorak" \ 1.45 -"dvorak-r" "Dvorak (right-hand)" \ 1.46 -"dvorak-l" "Dvorak (left-hand)" \ 1.47 -"es" "Spain/Mexico" \ 1.48 -"fi-latin1" "Finland" \ 1.49 -"hu" "Hungria" \ 1.50 -"it" "Italia" \ 1.51 -"is-latin1" "Island" \ 1.52 -"jp106" "Japan" \ 1.53 -"nl2" "Netherlands" \ 1.54 -"no-latin1" "Norway" \ 1.55 -"pl2" "Poland" \ 1.56 -"pt-latin1" "Portugal" \ 1.57 -"ru" "Russia" \ 1.58 -"se-lat6" "Sweden" \ 1.59 -"sg-latin1" "Singapore " \ 1.60 -"trq" "Turkey" \ 1.61 -"uk" "United Kingdom" \ 1.62 -"us-acentos" "USA Acentos" \ 1.63 -2>&1 1>&3` 1.64 -retval=$? 1.65 -exec 3>&- 1.66 +# Load the selected kmap file from /usr/share/kbd/keymaps or Busybox kmaps. 1.67 +load_keymap() { 1.68 + if [ -x /bin/loadkeys ]; then 1.69 + loadkeys $kmap 1.70 + else 1.71 + loadkmap < /usr/share/kmap/$kmap.kmap 1.72 + fi 1.73 +} 1.74 1.75 -case $retval in 1.76 - 0) 1.77 - continue ;; 1.78 - 1) 1.79 - echo "Cancel pressed." 1.80 - exit 0 ;; 1.81 - 255) 1.82 - if test -n "$value" ; then 1.83 - echo "$value" 1.84 - else 1.85 - echo "ESC pressed." 1.86 - exit 0 1.87 - fi ;; 1.88 +case "$1" in 1.89 + init) 1.90 + # Used to configure keymap from cmdline or scripts 1.91 + kmap=$2 1.92 + echo "$kmap" > /etc/keymap.conf 1.93 + load_keymap ;; 1.94 + *) 1.95 + # Default to text mode dialog. 1.96 + exec 3>&1 1.97 + value=`$DIALOG --clear \ 1.98 + --title " SliTaz keymap configuration " \ 1.99 + --menu "\nPlease select your keymap, current config: $CUR" 15 70 5 \ 1.100 + "us" "USA" \ 1.101 + "fr_CH-latin1" "Suisse Romande" \ 1.102 + "fr-latin1" "France" \ 1.103 + "be-latin1" "Belgique" \ 1.104 + "br-abnt2" "Brazil" \ 1.105 + "cf" "Canada/Quebec" \ 1.106 + "croat" "Croat" \ 1.107 + "cz-lat2" "Czech" \ 1.108 + "de_CH-latin1" "Schweizer Deutsch" \ 1.109 + "de-latin1" "Deutchland" \ 1.110 + "dk-latin1" "Danemark" \ 1.111 + "dvorak" "Dvorak" \ 1.112 + "dvorak-r" "Dvorak (right-hand)" \ 1.113 + "dvorak-l" "Dvorak (left-hand)" \ 1.114 + "es" "Spain/Mexico" \ 1.115 + "fi-latin1" "Finland" \ 1.116 + "hu" "Hungria" \ 1.117 + "it" "Italia" \ 1.118 + "is-latin1" "Island" \ 1.119 + "jp106" "Japan" \ 1.120 + "nl2" "Netherlands" \ 1.121 + "no-latin1" "Norway" \ 1.122 + "pl2" "Poland" \ 1.123 + "pt-latin1" "Portugal" \ 1.124 + "ru" "Russia" \ 1.125 + "se-lat6" "Sweden" \ 1.126 + "sg-latin1" "Singapore " \ 1.127 + "trq" "Turkey" \ 1.128 + "uk" "United Kingdom" \ 1.129 + "us-acentos" "USA Acentos" \ 1.130 + 2>&1 1>&3` 1.131 + retval=$? 1.132 + exec 3>&- 1.133 + case $retval in 1.134 + 0) 1.135 + continue ;; 1.136 + 1) 1.137 + echo "Cancel pressed." 1.138 + exit 0 ;; 1.139 + 255) 1.140 + if test -n "$value" ; then 1.141 + echo "$value" 1.142 + else 1.143 + echo "ESC pressed." 1.144 + exit 0 1.145 + fi ;; 1.146 + esac 1.147 + # If it's a reconfiguration give an info message. 1.148 + if [ -s /etc/keymap.conf ]; then 1.149 + $DIALOG --clear \ 1.150 + --title " Keyboard mapping information\n" \ 1.151 + --msgbox " 1.152 + Please logout of your current session and login again to use $value 1.153 + keyboard.\n" 16 70 1.154 + fi 1.155 + kmap=$value 1.156 + echo "$kmap" > /etc/keymap.conf 1.157 + load_keymap ;; 1.158 esac 1.159 1.160 -# If it's a reconfiguration give an info message. 1.161 -if [ -s /etc/keymap.conf ]; then 1.162 - $DIALOG --clear \ 1.163 - --title " Keyboard mapping information\n" \ 1.164 - --msgbox " 1.165 -Please logout of your current session and login again to use $value 1.166 -keyboard.\n" 16 70 1.167 -fi 1.168 - 1.169 -# Now we can load the selected kmap file from /usr/share/kbd/keymaps. 1.170 -# 1.171 -echo "$value" > /etc/keymap.conf 1.172 -if [ -x /bin/loadkeys ]; then 1.173 - loadkeys $value 1.174 -else 1.175 - loadkmap < /usr/share/kmap/$value.kmap 1.176 -fi 1.177 - 1.178 exit 0