tazpanel view hardware.cgi @ rev 148

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