tazpanel diff 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 diff
1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/hardware.cgi Fri Apr 08 05:59:24 2011 +0200 1.3 @@ -0,0 +1,92 @@ 1.4 +#!/bin/sh 1.5 +# 1.6 +# Hardware part of TazPanel - Devices, drivers, printing 1.7 +# 1.8 +# Copyright (C) 2011 SliTaz GNU/Linux - GNU gpl v3 1.9 +# 1.10 +echo "Content-Type: text/html" 1.11 +echo "" 1.12 + 1.13 +# Common functions from libtazpanel 1.14 +. lib/libtazpanel 1.15 +get_config 1.16 + 1.17 +# Include gettext helper script. 1.18 +. /usr/bin/gettext.sh 1.19 + 1.20 +# Export package name for gettext. 1.21 +TEXTDOMAIN='tazpanel' 1.22 +export TEXTDOMAIN 1.23 + 1.24 +TITLE="- Hardware" 1.25 + 1.26 +# 1.27 +# Commands 1.28 +# 1.29 + 1.30 +case "$QUERY_STRING" in 1.31 + print*) 1.32 + echo "TODO" ;; 1.33 + *) 1.34 + # 1.35 + # Default to summary with mounted filesystem, loaded modules 1.36 + # 1.37 + xhtml_header 1.38 + cat << EOT 1.39 +<div id="wrapper"> 1.40 + <h2>`gettext "Drivers & Devices"`</h2> 1.41 + <p>`gettext "Manage your computer hardware`</p> 1.42 +</div> 1.43 +EOT 1.44 + echo '<pre>' 1.45 + fdisk -l | fgrep Disk 1.46 + echo '</pre>' 1.47 + echo '<h3>Filesystem usage statistics</h3>' 1.48 + echo '<pre>' 1.49 + df -h | grep ^/dev 1.50 + echo '</pre>' 1.51 + echo '<h3>Loaded kernel modules</h3>' 1.52 + # We may want modinfi output 1.53 + 1.54 + case "$QUERY_STRING" in 1.55 + modinfo=*) 1.56 + mod=${QUERY_STRING#modinfo=} 1.57 + gettext "Detailled information for module:"; echo " $mod" 1.58 + echo '<pre>' 1.59 + modinfo $mod 1.60 + echo '</pre>' ;; 1.61 + rmmod=*) 1.62 + mod=${QUERY_STRING#rmmod=} 1.63 + modprobe -r $mod ;; 1.64 + esac 1.65 + cat << EOT 1.66 + `table_start` 1.67 + <tr class="thead"> 1.68 + <td>`gettext "Module"`</td> 1.69 + <td>`gettext "Size"`</td> 1.70 + <td>`gettext "Used"`</td> 1.71 + <td>`gettext "by"`</td> 1.72 + </tr> 1.73 +EOT 1.74 + # Get the list of modules and link to modinfo 1.75 + lsmod | grep ^[a-z] | while read MOD SIZE USED BY 1.76 + do 1.77 + cat << EOT 1.78 + <tr> 1.79 + <td><a href="$SCRIPT_NAME?modinfo=$MOD">$MOD</a></td> 1.80 + <td>$SIZE</td> 1.81 + <td>$USED</td> 1.82 + <td>`echo $BY | sed s/","/" "/g`</td> 1.83 + </tr> 1.84 +EOT 1.85 + done 1.86 + table_end 1.87 + echo '<h3>lspci</h3>' 1.88 + echo '<pre>' 1.89 + lspci 1.90 + echo '</pre>' 1.91 + ;; 1.92 +esac 1.93 + 1.94 +xhtml_footer 1.95 +exit 0