Remove various scripts
[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 Xdialog &>/dev/null ; then
33      Xdialog --msgbox "Sorry, no usable X browser (dillo, xlinks2, firefox,...) found." 0 0
34      exit 1
35    elif check4progs gdialog &>/dev/null ; then
36      gdialog --msgbox "Sorry, no usable X browser (dillo, xlinks2, firefox,...) found." 0 0
37      exit 1
38    elif check4progs zenity &>/dev/null ; then
39      zenity --info --text="Sorry, no usable X browser (dillo, xlinks2, firefox,...) found."
40      exit 1
41    fi
42 else # no X:
43    # do we have a real console?
44    if [[ $(tty) == /dev/tty* ]] ; then
45       # do we have framebuffer support?
46       if [ -c /dev/fb0 ] ; then
47          if check4progs links2 &>/dev/null ; then
48             links2 -driver fb $PAGE
49          elif check4progs w3m &>/dev/null; then
50             w3m $PAGE
51          elif check4progs links &>/dev/null ; then
52             links $PAGE
53          else
54             echo "Sorry, neither links2 nor w3m nor links available. Exiting.">&2
55             exit 1
56          fi
57       else # no, we don't have framebuffer
58          if check4progs w3m &>/dev/null ; then
59             w3m $PAGE
60          elif check4progs links &>/dev/null ; then
61             links $PAGE
62          elif check4progs links2 &>/dev/null ; then
63             links2 $PAGE
64          else
65             echo "Sorry, neither w3m nor links nor links2 available. Exiting.">&2
66             exit 1
67          fi
68       fi
69    else # no, probably we are running inside GNU screen
70       if check4progs w3m &>/dev/null ; then
71          w3m $PAGE
72       elif check4progs links2 &>/dev/null ; then
73          links2 $PAGE
74       elif check4progs links &>/dev/null ; then
75          links $PAGE
76       else
77          echo "Sorry, neither w3m nor links2 nor links available. Exiting.">&2
78          exit 1
79       fi
80    fi
81 fi
82
83 ## END OF FILE #################################################################