wm-ng: make sure fluxbox is present, otherwise fall back to x-window-manager or error...
authorMichael Prokop <mika@grml.org>
Wed, 6 Jul 2011 23:51:31 +0000 (01:51 +0200)
committerMichael Prokop <mika@grml.org>
Wed, 6 Jul 2011 23:51:33 +0000 (01:51 +0200)
If fluxbox is not installed but wm-ng is present
then make sure wm-ng tries to fall back to
the configured x-window-manager, unless it
points back to fluxbox or wm-ng again.
Otherwise error out with an according error message.

usr_bin/wm-ng

index 0e62170..1660848 100755 (executable)
@@ -6,11 +6,19 @@
 # License:       This file is licensed under the GPL v2.
 ################################################################################
 
-gkrellm -g -1+26 &
-
-(sleep 2; idesk &) &
-
-fluxbox
+# start Grml's fluxbox setup only if fluxbo is present
+if [ -x "$(which fluxbox 2>/dev/null)" ] ; then
+  gkrellm -g -1+26 &
+  (sleep 2; idesk &) &
+  fluxbox
+elif [ "$(basename $(readlink -f $(which x-window-manager 2>/dev/null)))" != "fluxbox" ] && \
+     [ "$(basename $(readlink -f $(which x-window-manager 2>/dev/null)))" != "$(basename $0)" ] ; then
+    # fall back unless it's set to fluxbox or points back to wm-ng
+    x-window-manager
+else
+  echo "Error: fluxbox not present + x-window-manager is not an alternative neither." >&2
+  exit 1
+fi
 
 exit $?