Release new version 2.13.0
[grml-scripts.git] / usr_bin / grml-info
1 #!/bin/zsh
2 # Filename:      grml-info
3 # Purpose:       start browser with documentation for Grml (based) system
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 # allow customisation
10 [ -n "$distri" ] || distri=grml
11
12 if [ -r "/usr/share/doc/${distri}-docs/index.html" ] ; then
13   # support easy customisation, file doesn't exist
14   # by default on mainline Grml
15   local PAGE="/usr/share/doc/${distri}-docs/index.html"
16 else
17   local PAGE='/usr/share/doc/grml-docs/startpage.html'
18 fi
19
20 . /etc/grml/script-functions
21
22 # do we have X?
23 if [ -n "$DISPLAY" ] ; then
24    if check4progs dillo &>/dev/null ; then
25      dillo $PAGE
26    elif check4progs xlinks2 &>/dev/null ; then
27      xlinks2 -mode 640x480 $PAGE
28    elif check4progs firefox &>/dev/null ; then
29      firefox $PAGE
30    elif check4progs x-www-browser &>/dev/null ; then
31      x-www-browser $PAGE
32    elif check4progs zenity &>/dev/null ; then
33      zenity --no-wrap --error --text="Sorry, no usable X browser (dillo, xlinks2, firefox,...) found."
34      exit 1
35    elif check4progs Xdialog &>/dev/null ; then
36      Xdialog --msgbox "Sorry, no usable X browser (dillo, xlinks2, firefox,...) found." 0 0
37      exit 1
38    fi
39 else # no X:
40    # do we have a real console?
41    if [[ $(tty) == /dev/tty* ]] ; then
42       # do we have framebuffer support?
43       if [ -c /dev/fb0 ] ; then
44          if check4progs links2 &>/dev/null ; then
45             links2 -driver fb $PAGE
46          elif check4progs w3m &>/dev/null; then
47             w3m $PAGE
48          elif check4progs links &>/dev/null ; then
49             links $PAGE
50          else
51             echo "Sorry, neither links2 nor w3m nor links available. Exiting.">&2
52             exit 1
53          fi
54       else # no, we don't have framebuffer
55          if check4progs w3m &>/dev/null ; then
56             w3m $PAGE
57          elif check4progs links &>/dev/null ; then
58             links $PAGE
59          elif check4progs links2 &>/dev/null ; then
60             links2 $PAGE
61          else
62             echo "Sorry, neither w3m nor links nor links2 available. Exiting.">&2
63             exit 1
64          fi
65       fi
66    else # no, probably we are running inside GNU screen
67       if check4progs w3m &>/dev/null ; then
68          w3m $PAGE
69       elif check4progs links2 &>/dev/null ; then
70          links2 $PAGE
71       elif check4progs links &>/dev/null ; then
72          links $PAGE
73       else
74          echo "Sorry, neither w3m nor links2 nor links available. Exiting.">&2
75          exit 1
76       fi
77    fi
78 fi
79
80 ## END OF FILE #################################################################