c181fd110937b84a591ce1bb4450127cb45e05a4
[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 # Latest change: Son Mär 09 13:57:29 CET 2008 [mika]
8 ################################################################################
9
10 local PAGE='/usr/share/doc/grml-docs/startpage.html'
11
12 . /etc/grml/script-functions
13
14 # do we have X?
15 if [ -n "$DISPLAY" ]; then
16    if check4progs dillo ; then
17       dillo $PAGE
18    elif check4progs firefox ; then
19       firefox $PAGE
20    elif check4progs x-www-browser ; then
21       x-www-browser $PAGE
22    elif check4progs Xdialog ; then
23       Xdialog --msgbox "Sorry, no usable X browser found." 0 0
24    fi
25 else # no X:
26    # is it grml-small?
27    if grep -q small /etc/grml_version ; then
28       check4progs links && links $PAGE || { echo "Sorry, links not available. Exiting.">&2 ; exit 10 }
29    else
30       # do we have a real console?
31       if [[ $(tty) == /dev/tty* ]] ; then
32          # do we have framebuffer support?
33          if [ -c /dev/fb0 ] ; then
34             if check4progs links2 ; then
35                links2 -driver fb $PAGE
36             elif check4progs w3m ; then
37                w3m $PAGE
38             else
39                echo "Sorry, neither links2 nor w3m available. Exiting.">&2
40                exit 20
41             fi
42          else
43             # no, we don't have framebuffer
44             check4progs w3m && w3m $PAGE || { echo "Sorry, w3m not available. Exiting.">&2 ; exit 30 }
45          fi
46       else
47         # no, probably we are running inside GNU screen
48         check4progs w3m && w3m $PAGE || { echo "Sorry, w3m not available. Exiting.">&2 ; exit 40 }
49       fi
50    fi
51 fi
52
53 ## END OF FILE #################################################################