#!/bin/sh # if [ ! "$UID" = "0" ]; then echo echo "[$LOGNAME] You need to run this script as root." echo "Try one of these to run it as root: # sudo kmapset" echo " # su -c kmapset" echo exit fi if ! type -all dialog >/dev/null 2>&1 ; then echo "Can't find 'dialog', i can't run without 'dialog' on your system." exit fi if [ ! $DISPLAY = "" ]; then DCMD="Xdialog --wrap" CMD="rxvt -e " else DCMD="dialog" CMD="" fi TMP=/tmp if [ ! -d $TMP ]; then mkdir -p $TMP fi RC() { cat < $TMP/SeTkeymap if [ $? -gt 0 ]; then rm -f $TMP/SeTkeymap echo exit fi MAPNAME="`cat $TMP/SeTkeymap`" loadkeys $MAPNAME 1>/dev/null 2>$TMP/error || ERROR=YES if [ "$ERROR" = "YES" ]; then echo "There was a error loading the $MAPNAME keymap." > $TMP/error.msg echo "You can chose another keymap or cancel." >> $TMP/error.msg echo >> $TMP/error.msg $DCMD --title "LOADKEYS ERROR!" --msgbox "`cat $TMP/error.msg $TMP/error`" 10 62 unset ERROR rm -f $TMP/SeTkeymap rm -f $TMP/error* continue; fi while [ 0 ]; do $DCMD --title "KEYBOARD TEST" --inputbox \ "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 exit, or 2 on a line by \ itself to reject the current keyboard map and select a new one." \ 11 70 2> $TMP/keytest if [ $? = 1 ]; then rm -f $TMP/keytest rm -f $TMP/SeTkeymap rm -f $TMP/error* break; fi REPLY="`cat $TMP/keytest`" if [ "$REPLY" = "1" ]; then RC > /etc/rc.d/rc.keymap echo "XKEYBOARD=\"$MAPNAME\"" >> /etc/sysconfig/vector chmod 755 /etc/rc.d/rc.keymap rm -f $TMP/keytest rm -f $TMP/SeTkeymap rm -f $TMP/error* echo exit else rm -f $TMP/keytest rm -f $TMP/SeTkeymap rm -f $TMP/error* break; fi done done