# Authors: grml-team (grml.org), (c) Matthias Kopfermann <maddi@grml.org>
# Bug-Reports: see http://grml.org/bugs/
# License: This file is licensed under the GPL v2.
-# Latest change: Don Nov 23 22:32:29 CET 2006 [mika]
################################################################################
-if . /etc/grml/script-functions ; then
- check4progs xmodmap loadkeys dumpkeys || exit 1
+if [[ -f /etc/grml/script-functions ]] ; then
+ source /etc/grml/script-functions \
+ && check4progs xmodmap loadkeys dumpkeys
+fi
+if [[ -f /etc/grml/lsb-functions ]] ; then
+ source /etc/grml/lsb-functions
+else
+ einfo() { echo "$*" ; }
+ eerror() { echo "$*" ; }
+ eend() { echo "$*" ; }
fi
-. /etc/grml/lsb-functions || ( alias einfo=echo ; alias eerror=echo; alias eend=echo )
emulate zsh
-autoload -U colors ; colors
if [[ -z $DISPLAY ]] ; then # test if X is not running when calling us
- if [[ $UID != 0 ]] ; then # test if user root did invoke this command
+ if [ $(id -u) != 0 ] ; then # test if user root did invoke this command
eerror "As of Linux 2.6.15 you need root permissions for changing"
- eerror "the keyboard on console using loadkeys for security reasons."
+ eerror "the keyboard on console using loadkeys for security reasons."
eerror "Run this program with root permissions. Exiting." ; eend 1
exit 1
fi
( einfo "caps-ctrl - switching caps lock and control key."
loadkeys <<- EOT
- keycode 58 = `repeat 15 echo -n 'Control '`
- keycode 29 = `repeat 7 echo -n 'Caps_Lock '`
- EOT
+ keycode 58 = $(repeat 15 echo -n 'Control ')
+ keycode 29 = $(repeat 7 echo -n 'Caps_Lock ')
+ EOT
eend $?
) || (
einfo "caps-ctrl - switching caps lock and control key."
loadkeys <<- EOT
- keycode 58 = `repeat 15 echo -n 'Caps_Lock '`
- keycode 29 = `repeat 7 echo -n 'Control '`
- EOT
+ keycode 58 = $(repeat 15 echo -n 'Caps_Lock ')
+ keycode 29 = $(repeat 7 echo -n 'Control ')
+ EOT
eend $?
)
xmodmap -pke | grep 'Caps_Lock' > /dev/null || (
xmodmap - <<- EOT
keycode 66 = Caps_Lock
- EOT
+ EOT
)
xmodmap - <<- EOT
add lock = Caps_Lock
add Control = Control_L
!add Control = Control_R
- EOT
+ EOT
eend $?
)
fi # end of test if X or console is used