tazpanel rev 431

hardware.cgi: show disk model
author Pascal Bellard <pascal.bellard@slitaz.org>
date Mon Apr 06 17:38:32 2015 +0200 (2015-04-06)
parents 958365a41cdb
children 2ce8e949aef9
files hardware.cgi
line diff
     1.1 --- a/hardware.cgi	Mon Apr 06 13:08:02 2015 +0200
     1.2 +++ b/hardware.cgi	Mon Apr 06 17:38:32 2015 +0200
     1.3 @@ -19,6 +19,13 @@
     1.4  	[ -s $module ] && . $module "$@"
     1.5  }
     1.6  
     1.7 +disk_info() {
     1.8 +	fdisk -l | fgrep Disk | while read a b c; do
     1.9 +		d=${b#/dev/}
    1.10 +		d="/sys/block/${d%:}/device"
    1.11 +		[ -d $d ] && echo "$a $b $c, $(cat $d/vendor) $(cat $d/model)"
    1.12 +	done 2> /dev/null | sed 's/  */ /g'
    1.13 +}
    1.14  
    1.15  lsusb_table() {
    1.16  	cat <<EOT
    1.17 @@ -319,7 +326,7 @@
    1.18  	<form action="#mount" class="wide">
    1.19  		<header id="disk">$(gettext 'Filesystem usage statistics')</header>
    1.20  		<div>
    1.21 -			<pre>$(fdisk -l | fgrep Disk)</pre>
    1.22 +			<pre>$(disk_info)</pre>
    1.23  		</div>
    1.24  EOT
    1.25  
    1.26 @@ -374,7 +381,7 @@
    1.27  			# action
    1.28  			action="mount"
    1.29  			[ -n "$mp" ] && action="umount"
    1.30 -			type=$(blkid $fs | sed '/TYPE=/!d;s/.*TYPE="\([^"]*\).*/\1/')
    1.31 +			type=$(blkid $fs | sed '/TYPE=/!d;s/.* TYPE="\([^"]*\).*/\1/')
    1.32  			[ "$type" == "swap" ] && action="swapon"
    1.33  			if grep -q "^$fs " /proc/swaps; then
    1.34  				action="swapoff"