tazpanel view hardware.cgi @ rev 46

Add hardware.cgi, tiny fix in pkgs.cgi and add a TODO list
author Christophe Lincoln <pankso@slitaz.org>
date Fri Apr 08 05:59:24 2011 +0200 (2011-04-08)
parents
children cf15cb2ff715
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 *)
31 #
32 # Default to summary with mounted filesystem, loaded modules
33 #
34 xhtml_header
35 cat << EOT
36 <div id="wrapper">
37 <h2>`gettext "Drivers &amp; Devices"`</h2>
38 <p>`gettext "Manage your computer hardware`</p>
39 </div>
40 EOT
41 echo '<pre>'
42 fdisk -l | fgrep Disk
43 echo '</pre>'
44 echo '<h3>Filesystem usage statistics</h3>'
45 echo '<pre>'
46 df -h | grep ^/dev
47 echo '</pre>'
48 echo '<h3>Loaded kernel modules</h3>'
49 # We may want modinfi output
51 case "$QUERY_STRING" in
52 modinfo=*)
53 mod=${QUERY_STRING#modinfo=}
54 gettext "Detailled information for module:"; echo " $mod"
55 echo '<pre>'
56 modinfo $mod
57 echo '</pre>' ;;
58 rmmod=*)
59 mod=${QUERY_STRING#rmmod=}
60 modprobe -r $mod ;;
61 esac
62 cat << EOT
63 `table_start`
64 <tr class="thead">
65 <td>`gettext "Module"`</td>
66 <td>`gettext "Size"`</td>
67 <td>`gettext "Used"`</td>
68 <td>`gettext "by"`</td>
69 </tr>
70 EOT
71 # Get the list of modules and link to modinfo
72 lsmod | grep ^[a-z] | while read MOD SIZE USED BY
73 do
74 cat << EOT
75 <tr>
76 <td><a href="$SCRIPT_NAME?modinfo=$MOD">$MOD</a></td>
77 <td>$SIZE</td>
78 <td>$USED</td>
79 <td>`echo $BY | sed s/","/" "/g`</td>
80 </tr>
81 EOT
82 done
83 table_end
84 echo '<h3>lspci</h3>'
85 echo '<pre>'
86 lspci
87 echo '</pre>'
88 ;;
89 esac
91 xhtml_footer
92 exit 0