grml-info: improve checks for present browsers
[grml-scripts.git] / usr_bin / grml-info
1 #!/bin/zsh
2 # Filename:      grml-info
3 # Purpose:       start browser with documentation for grml
4 # Authors:       grml-team (grml.org), (c) Michael Prokop <mika@grml.org>
5 # Bug-Reports:   see http://grml.org/bugs/
6 # License:       This file is licensed under the GPL v2.
7 ################################################################################
8
9 local PAGE='/usr/share/doc/grml-docs/startpage.html'
10
11 . /etc/grml/script-functions
12
13 # do we have X?
14 if [ -n "$DISPLAY" ]; then
15    if check4progs dillo ; then
16       dillo $PAGE
17    elif check4progs firefox ; then
18       firefox $PAGE
19    elif check4progs x-www-browser ; then
20       x-www-browser $PAGE
21    elif check4progs Xdialog ; then
22       Xdialog --msgbox "Sorry, no usable X browser found." 0 0
23    fi
24 else # no X:
25    # do we have a real console?
26    if [[ $(tty) == /dev/tty* ]] ; then
27       # do we have framebuffer support?
28       if [ -c /dev/fb0 ] ; then
29          if check4progs links2 ; then
30             links2 -driver fb $PAGE
31          elif check4progs w3m ; then
32             w3m $PAGE
33          elif check4progs links ; then
34             links $PAGE
35          else
36             echo "Sorry, neither links2 nor w3m nor links available. Exiting.">&2
37             exit 20
38          fi
39       else # no, we don't have framebuffer
40          if check4progs w3m ; then
41             w3m $PAGE
42          elif check4progs links ; then
43             links $PAGE
44          elif check4progs links2 ; then
45             links2 $PAGE
46          else
47             echo "Sorry, neither w3m nor links nor links2 available. Exiting.">&2
48             exit 30
49          fi
50       fi
51    else # no, probably we are running inside GNU screen
52       if check4progs w3m ; then
53          w3m $PAGE
54       elif check4progs links2 ; then
55          links2 $PAGE
56       elif check4progs links ; then
57          links $PAGE
58       else
59          echo "Sorry, neither w3m nor links2 nor links available. Exiting.">&2
60          exit 40
61       fi
62    fi
63 fi
64
65 ## END OF FILE #################################################################