tazpanel view hardware.cgi @ rev 69

Fix query_string_parser used from a form (&)
author Christophe Lincoln <pankso@slitaz.org>
date Tue Apr 12 02:55:40 2011 +0200 (2011-04-12)
parents 95dc2475f4ae
children ba8cd6b7b934
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 info on 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 mod=${QUERY_STRING#modinfo=}
49 gettext "Detailed information for module:"; echo " $mod"
50 echo '<pre>'
51 modinfo $mod
52 echo '</pre>' ;;
53 rmmod=*)
54 mod=${QUERY_STRING#rmmod=}
55 modprobe -r $mod ;;
56 esac
57 cat << EOT
58 `table_start`
59 <tr class="thead">
60 <td>`gettext "Module"`</td>
61 <td>`gettext "Size"`</td>
62 <td>`gettext "Used"`</td>
63 <td>`gettext "by"`</td>
64 </tr>
65 EOT
66 # Get the list of modules and link to modinfo
67 lsmod | grep ^[a-z] | while read MOD SIZE USED BY
68 do
69 cat << EOT
70 <tr>
71 <td><a href="$SCRIPT_NAME?modinfo=$MOD">$MOD</a></td>
72 <td>$SIZE</td>
73 <td>$USED</td>
74 <td>`echo $BY | sed s/","/" "/g`</td>
75 </tr>
76 EOT
77 done
78 table_end ;;
79 *)
80 #
81 # Default to summary with mounted filesystem, loaded modules
82 #
83 xhtml_header
85 cat << EOT
86 <div id="wrapper">
87 <h2>`gettext "Drivers &amp; Devices"`</h2>
88 <p>`gettext "Manage your computer hardware`</p>
89 </div>
90 <div>
91 <a class="button" href="$SCRIPT_NAME?modules">Kernel modules</a>
92 </div>
93 EOT
94 echo '<h3>Filesystem usage statistics</h3>'
95 echo '<pre>'
96 fdisk -l | fgrep Disk
97 echo '</pre>'
98 echo '<pre>'
99 df -h | grep ^/dev
100 echo '</pre>'
101 echo '<h3>lspci</h3>'
102 echo '<pre>'
103 lspci -k
104 echo '</pre>'
105 echo '<h3>lsusb</h3>'
106 echo '<pre>'
107 lsusb
108 echo '</pre>'
109 ;;
110 esac
112 xhtml_footer
113 exit 0