tazpanel view hardware.cgi @ rev 80

pkgs.cgi: Smaller button and better CSS integration
author Christophe Lincoln <pankso@slitaz.org>
date Wed Apr 13 12:40:15 2011 +0200 (2011-04-13)
parents ba8cd6b7b934
children 25602bc63ca7
line source
1 #!/bin/sh
2 #
3 # Hardware part of TazPanel - Devices, drivers, printing
4 #
5 # Copyright (C) 2011 SliTaz GNU/Linux - GNU gpl v3
6 #
7 echo "Content-Type: text/html"
8 echo ""
10 # Common functions from libtazpanel
11 . lib/libtazpanel
12 get_config
14 # Include gettext helper script.
15 . /usr/bin/gettext.sh
17 # Export package name for gettext.
18 TEXTDOMAIN='tazpanel'
19 export TEXTDOMAIN
21 TITLE="- Hardware"
23 #
24 # Commands
25 #
27 case "$QUERY_STRING" in
28 print*)
29 echo "TODO" ;;
30 modules*|modinfo=*)
31 query_string_parser
32 xhtml_header
33 cat << EOT
34 <div id="wrapper">
35 <h2>`gettext "Kernel modules"`</h2>
36 <div class="float-right">
37 <form method="get" action="$SCRIPT_NAME">
38 <input type="hidden" name="modules" />
39 <input type="text" name="search" />
40 </form>
41 </div>
42 <p>`gettext "Manage, search or get information about the Linux kernel modules`</p>
43 </div>
44 EOT
45 # Request may be modinfo output that we want in the page itself
46 case "$QUERY_STRING" in
47 modinfo=*)
48 echo '<strong>'
49 gettext "Detailed information for module: "; echo "$WANT"
50 echo '</strong>'
51 echo '<pre>'
52 modinfo $WANT
53 echo '</pre>' ;;
54 modprobe=*)
55 echo '<pre>'
56 modprobe -v $WANT
57 echo '</pre>' ;;
58 rmmod=*)
59 #modprobe -r $WANT
60 echo "Removing"
61 rmmod -w $WANT ;;
62 *search=*)
63 gettext "Matching result(s) for: "; echo "$VAR_1"
64 echo '<pre>'
65 modprobe -l | grep "$VAR_1" | while read line
66 do
67 name=$(basename $line)
68 mod=${name%.ko.gz}
69 echo "Module : <a href='$SCRIPT_NAME?modinfo=$mod'>$mod</a> "
70 done
71 echo '</pre>' ;;
72 esac
73 cat << EOT
74 `table_start`
75 <tr class="thead">
76 <td>`gettext "Module"`</td>
77 <td>`gettext "Size"`</td>
78 <td>`gettext "Used"`</td>
79 <td>`gettext "by"`</td>
80 </tr>
81 EOT
82 # Get the list of modules and link to modinfo
83 lsmod | grep ^[a-z] | while read MOD SIZE USED BY
84 do
85 cat << EOT
86 <tr>
87 <td><a href="$SCRIPT_NAME?modinfo=$MOD">$MOD</a></td>
88 <td>$SIZE</td>
89 <td>$USED</td>
90 <td>`echo $BY | sed s/","/" "/g`</td>
91 </tr>
92 EOT
93 done
94 table_end ;;
95 *)
96 #
97 # Default to summary with mounted filesystem, loaded modules
98 #
99 xhtml_header
101 cat << EOT
102 <div id="wrapper">
103 <h2>`gettext "Drivers &amp; Devices"`</h2>
104 <p>`gettext "Manage your computer hardware`</p>
105 </div>
106 <div>
107 <a class="button" href="$SCRIPT_NAME?modules">Kernel modules</a>
108 </div>
109 EOT
110 echo '<h3>Filesystem usage statistics</h3>'
111 echo '<pre>'
112 fdisk -l | fgrep Disk
113 echo '</pre>'
114 echo '<pre>'
115 df -h | grep ^/dev
116 echo '</pre>'
117 echo '<h3>lspci</h3>'
118 echo '<pre>'
119 lspci -k
120 echo '</pre>'
121 echo '<h3>lsusb</h3>'
122 echo '<pre>'
123 lsusb
124 echo '</pre>'
125 ;;
126 esac
128 xhtml_footer
129 exit 0