tazpanel view hardware.cgi @ rev 52

Tiny edits and make pot
author Paul Issott <paul@slitaz.org>
date Sun Apr 10 11:23:06 2011 +0000 (2011-04-10)
parents cf15cb2ff715
children efb242465a63
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 debug_info
36 cat << EOT
37 <div id="wrapper">
38 <h2>`gettext "Drivers &amp; Devices"`</h2>
39 <p>`gettext "Manage your computer hardware`</p>
40 </div>
41 EOT
42 echo '<pre>'
43 fdisk -l | fgrep Disk
44 echo '</pre>'
45 echo '<h3>Filesystem usage statistics</h3>'
46 echo '<pre>'
47 df -h | grep ^/dev
48 echo '</pre>'
49 echo '<h3>Loaded kernel modules</h3>'
50 # Request may be modinfo output
51 case "$QUERY_STRING" in
52 modinfo=*)
53 mod=${QUERY_STRING#modinfo=}
54 gettext "Detailed 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