tazpanel view hardware.cgi @ rev 67

remove debug_info and put code in header
author Christophe Lincoln <pankso@slitaz.org>
date Tue Apr 12 02:47:00 2011 +0200 (2011-04-12)
parents 8f60cbb66259
children 26811cbf12d8
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 <p>`gettext "Manage and get info about the Linux kernel modules`</p>
37 </div>
38 EOT
39 # Request may be modinfo output that we want in the page itself
40 case "$QUERY_STRING" in
41 modinfo=*)
42 mod=${QUERY_STRING#modinfo=}
43 gettext "Detailed information for module:"; echo " $mod"
44 echo '<pre>'
45 modinfo $mod
46 echo '</pre>' ;;
47 rmmod=*)
48 mod=${QUERY_STRING#rmmod=}
49 modprobe -r $mod ;;
50 esac
51 cat << EOT
52 `table_start`
53 <tr class="thead">
54 <td>`gettext "Module"`</td>
55 <td>`gettext "Size"`</td>
56 <td>`gettext "Used"`</td>
57 <td>`gettext "by"`</td>
58 </tr>
59 EOT
60 # Get the list of modules and link to modinfo
61 lsmod | grep ^[a-z] | while read MOD SIZE USED BY
62 do
63 cat << EOT
64 <tr>
65 <td><a href="$SCRIPT_NAME?modinfo=$MOD">$MOD</a></td>
66 <td>$SIZE</td>
67 <td>$USED</td>
68 <td>`echo $BY | sed s/","/" "/g`</td>
69 </tr>
70 EOT
71 done
72 table_end ;;
73 *)
74 #
75 # Default to summary with mounted filesystem, loaded modules
76 #
77 xhtml_header
79 cat << EOT
80 <div id="wrapper">
81 <h2>`gettext "Drivers &amp; Devices"`</h2>
82 <p>`gettext "Manage your computer hardware`</p>
83 </div>
84 <div>
85 <a class="button" href="$SCRIPT_NAME?modules">Kernel modules</a>
86 </div>
87 EOT
88 echo '<h3>Filesystem usage statistics</h3>'
89 echo '<pre>'
90 fdisk -l | fgrep Disk
91 echo '</pre>'
92 echo '<pre>'
93 df -h | grep ^/dev
94 echo '</pre>'
95 echo '<h3>lspci</h3>'
96 echo '<pre>'
97 lspci -k
98 echo '</pre>'
99 echo '<h3>lsusb</h3>'
100 echo '<pre>'
101 lsusb
102 echo '</pre>'
103 ;;
104 esac
106 xhtml_footer
107 exit 0