slitaz-tools view tinyutils/tazkmap @ rev 340
tazx: Moved doc to Handbook
author | Christophe Lincoln <pankso@slitaz.org> |
---|---|
date | Mon May 04 23:12:18 2009 +0200 (2009-05-04) |
parents | 841f4dd95ea2 |
children | b37eb30a508b |
line source
1 #!/bin/sh
2 #
3 # Tazkmap - SliTaz GNU/Linux BusyBox keymap config using dialog boxes.
4 # Configuration file is : /etc/kmap.conf
5 #
6 # 20080412 <pankso@slitaz.org> - GNU gpl.
7 #
8 : ${DIALOG=dialog}
10 # Script functions.
11 status()
12 {
13 local CHECK=$?
14 echo -en "\\033[70G[ "
15 if [ $CHECK = 0 ]; then
16 echo -en "\\033[1;33mOK"
17 else
18 echo -en "\\033[1;31mFailed"
19 fi
20 echo -e "\\033[0;39m ]"
21 }
23 # Check if user is root.
24 #
25 if test $(id -u) != 0; then
26 echo ""
27 echo "You must be root to run `basename $0`!"
28 echo "Type 'su' and root password to become super-user."
29 echo ""
30 exit 1
31 fi
33 # Dialog menu.
34 #
35 exec 3>&1
36 value=`$DIALOG --clear \
37 --title " SliTaz kmap configuration " \
38 --menu \
39 "Séléctionnez votre clavier - Select your keymap." 15 70 5 \
40 "fr_CH" "Suisse français." \
41 "fr" "Français" \
42 "be" "Belge" \
43 "ca" "Canadian" \
44 "cz" "Czech" \
45 "de" "Deutch" \
46 "en" "English UK" \
47 "es" "Spanish" \
48 "it" "Italiano" \
49 "jp" "Japanese" \
50 "us" "USA" \
51 2>&1 1>&3`
52 retval=$?
53 exec 3>&-
55 case $retval in
56 0)
57 echo -n "$value selected... "
58 status ;;
59 1)
60 echo "Cancel pressed."
61 exit 0 ;;
62 255)
63 if test -n "$value" ; then
64 echo "$value"
65 else
66 echo "ESC pressed."
67 exit 0
68 fi ;;
69 esac
71 # Export selected value.
72 #
73 echo -n "Exporting $value to $value.kmap..."
74 export KMAP=$value.kmap
75 status
77 # Now we can load the selected kmap file from /usr.
78 #
79 echo -n "Creating config file : /etc/kmap.conf"
80 echo "KMAP=$KMAP" > /etc/kmap.conf
81 status
83 echo -n "Loading keymap : $KMAP..."
84 /sbin/loadkmap < /usr/share/kmap/$KMAP
85 status
87 exit 0