Update caps-ctrl (thx, wuehlmaus).
authorMichael Prokop <mika@grml.org>
Sun, 21 Mar 2010 22:24:56 +0000 (23:24 +0100)
committerMichael Prokop <mika@grml.org>
Sun, 21 Mar 2010 22:24:56 +0000 (23:24 +0100)
debian/changelog
usr_bin/caps-ctrl

index 803a5c2..d9d777b 100644 (file)
@@ -1,3 +1,11 @@
+grml-scripts (1.2.11) UNRELEASED; urgency=low
+
+  [ Matthias Kopfermann ]
+  * caps-ctrl: make sure the script works on non-Grml systems
+    as well.
+
+ -- Michael Prokop <mika@grml.org>  Sun, 21 Mar 2010 23:24:35 +0100
+
 grml-scripts (1.2.10) unstable; urgency=low
 
   * grml-hostname: address xauth issue when changing hostname
index dfaec76..b4bd3cc 100755 (executable)
@@ -6,10 +6,17 @@
 # License:       This file is licensed under the GPL v2.
 ################################################################################
 
-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
 
@@ -26,7 +33,7 @@ if [[ -z $DISPLAY  ]] ; then # test if X is not running when calling us
            loadkeys <<- EOT
            keycode 58 = $(repeat 15 echo -n 'Control ')
            keycode 29 = $(repeat 7 echo -n 'Caps_Lock ')
-               EOT
+                EOT
            eend $?
 
         ) || (
@@ -35,7 +42,7 @@ if [[ -z $DISPLAY  ]] ; then # test if X is not running when calling us
            loadkeys <<- EOT
            keycode 58 = $(repeat 15 echo -n 'Caps_Lock ')
            keycode 29 = $(repeat 7 echo -n 'Control ')
-               EOT
+                EOT
            eend $?
          )
 
@@ -47,7 +54,7 @@ else     # running under X
         xmodmap -pke | grep 'Caps_Lock' > /dev/null || (
         xmodmap - <<- EOT
         keycode 66 = Caps_Lock
-               EOT
+                EOT
         )
 
         xmodmap - <<- EOT
@@ -63,7 +70,7 @@ else     # running under X
         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