X-Git-Url: http://git.grml.org/?a=blobdiff_plain;f=usr_bin%2Fgrml-info;h=1f31776cd3b61d3e19bd0571efc9a63cf4d26504;hb=5b0c6b200fe0a76b7a78c984733defdb3120ea6a;hp=86b9904f41535d3127a299560c5632d60003bd34;hpb=e720deae78f1eda5e6f62629606c194f16796762;p=grml-scripts.git diff --git a/usr_bin/grml-info b/usr_bin/grml-info index 86b9904..1f31776 100755 --- a/usr_bin/grml-info +++ b/usr_bin/grml-info @@ -1,37 +1,83 @@ #!/bin/zsh # Filename: grml-info -# Purpose: start browser with documentation for grml +# Purpose: start browser with documentation for Grml (based) system # Authors: grml-team (grml.org), (c) Michael Prokop # Bug-Reports: see http://grml.org/bugs/ # License: This file is licensed under the GPL v2. -# Latest change: Fre Jul 07 22:42:18 CEST 2006 [mika] ################################################################################ -local PAGE='/usr/share/doc/grml-docs/startpage.html' +# allow customisation +[ -n "$distri" ] || distri=grml -# do we have X? -if ! [ -n "$DISPLAY" ]; then - # is it grml-small? - if grep -q small /etc/grml_version ; then - links $PAGE - else - # do we have a real console? - if [[ $(tty) == /dev/tty* ]] ; then - # do we have framebuffer support? - if [ -c /dev/fb0 ] ; then - links2 -driver fb $PAGE - else - # no, we don't have framebuffer - w3m $PAGE - fi - # no, probably we are running inside GNU screen - else - w3m $PAGE - fi - fi -# oh, we have X! +if [ -r "/usr/share/doc/${distri}-docs/index.html" ] ; then + # support easy customisation, file doesn't exist + # by default on mainline Grml + local PAGE="/usr/share/doc/${distri}-docs/index.html" else - dillo $PAGE + local PAGE='/usr/share/doc/grml-docs/startpage.html' +fi + +. /etc/grml/script-functions + +# do we have X? +if [ -n "$DISPLAY" ] ; then + if check4progs dillo &>/dev/null ; then + dillo $PAGE + elif check4progs xlinks2 &>/dev/null ; then + xlinks2 -mode 640x480 $PAGE + elif check4progs firefox &>/dev/null ; then + firefox $PAGE + elif check4progs x-www-browser &>/dev/null ; then + x-www-browser $PAGE + elif check4progs Xdialog &>/dev/null ; then + Xdialog --msgbox "Sorry, no usable X browser (dillo, xlinks2, firefox,...) found." 0 0 + exit 1 + elif check4progs gdialog &>/dev/null ; then + gdialog --msgbox "Sorry, no usable X browser (dillo, xlinks2, firefox,...) found." 0 0 + exit 1 + elif check4progs zenity &>/dev/null ; then + zenity --info --text="Sorry, no usable X browser (dillo, xlinks2, firefox,...) found." + exit 1 + fi +else # no X: + # do we have a real console? + if [[ $(tty) == /dev/tty* ]] ; then + # do we have framebuffer support? + if [ -c /dev/fb0 ] ; then + if check4progs links2 &>/dev/null ; then + links2 -driver fb $PAGE + elif check4progs w3m &>/dev/null; then + w3m $PAGE + elif check4progs links &>/dev/null ; then + links $PAGE + else + echo "Sorry, neither links2 nor w3m nor links available. Exiting.">&2 + exit 1 + fi + else # no, we don't have framebuffer + if check4progs w3m &>/dev/null ; then + w3m $PAGE + elif check4progs links &>/dev/null ; then + links $PAGE + elif check4progs links2 &>/dev/null ; then + links2 $PAGE + else + echo "Sorry, neither w3m nor links nor links2 available. Exiting.">&2 + exit 1 + fi + fi + else # no, probably we are running inside GNU screen + if check4progs w3m &>/dev/null ; then + w3m $PAGE + elif check4progs links2 &>/dev/null ; then + links2 $PAGE + elif check4progs links &>/dev/null ; then + links $PAGE + else + echo "Sorry, neither w3m nor links2 nor links available. Exiting.">&2 + exit 1 + fi + fi fi ## END OF FILE #################################################################