Require xlock in grml-lock if DISPLAY is set. [Closes: issue768]
[grml-scripts.git] / usr_bin / grml-lock
index 6b0bf59..a46d681 100755 (executable)
@@ -4,17 +4,16 @@
 # Authors:       grml-team (grml.org), (c) Michael Prokop <mika@grml.org>
 # Bug-Reports:   see http://grml.org/bugs/
 # License:       This file is licensed under the GPL v2.
-# Latest change: Mon Jun 04 22:49:37 CEST 2007 [mika]
 ################################################################################
 
 PN="$0"
 
 if [ -r /etc/grml/script-functions ] ; then
    . /etc/grml/script-functions
-   if [ -x /usr/bin/X ] ; then
-      check4progs vlock xlock sudo chpasswd dialog || { echo "Sorry, can't continue. Exiting.">&2 ; exit 1 }
-   else
+   if [ -z "$DISPLAY" ] ; then
       check4progs vlock sudo chpasswd dialog || { echo "Sorry, can't continue. Exiting.">&2 ; exit 1 }
+  else
+      check4progs xlock sudo chpasswd dialog || { echo "Sorry, can't continue. Exiting.">&2 ; exit 1 }
    fi
 fi