From: Michael Prokop Date: Wed, 6 Jul 2011 23:51:31 +0000 (+0200) Subject: wm-ng: make sure fluxbox is present, otherwise fall back to x-window-manager or error... X-Git-Tag: v1.4.6~1 X-Git-Url: http://git.grml.org/?p=grml-scripts.git;a=commitdiff_plain;h=e2295813ea9693d34f541a790eff8ec387bbb107 wm-ng: make sure fluxbox is present, otherwise fall back to x-window-manager or error out. 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. --- diff --git a/usr_bin/wm-ng b/usr_bin/wm-ng index 0e62170..1660848 100755 --- a/usr_bin/wm-ng +++ b/usr_bin/wm-ng @@ -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 $?