tazpanel rev 622

hardware.cgi: /dev/mapper/ disks support
author Pascal Bellard <pascal.bellard@slitaz.org>
date Thu Dec 21 16:29:11 2017 +0100 (2017-12-21)
parents fb585e9d299a
children 35a202701366
files hardware.cgi
line diff
     1.1 --- a/hardware.cgi	Tue Dec 19 20:36:00 2017 +0100
     1.2 +++ b/hardware.cgi	Thu Dec 21 16:29:11 2017 +0100
     1.3 @@ -21,7 +21,7 @@
     1.4  
     1.5  disk_info() {
     1.6  	fdisk -l | fgrep Disk | while read a b c; do
     1.7 -		d=${b#/dev/}
     1.8 +		d=${b##*/}
     1.9  		t="HD"
    1.10  		[ "$(cat /sys/block/${d%:}/queue/rotational)" -eq "0" ] && t="SSD"
    1.11  		d="/sys/block/${d%:}/device"
    1.12 @@ -441,29 +441,29 @@
    1.13  
    1.14  			# size
    1.15  			[ -z "$size" ] &&
    1.16 -			size="$(blk2h $(cat /sys/block/${fs#/dev/}/size /sys/block/*/${fs#/dev/}/size))"
    1.17 +			size="$(blk2h $(cat /sys/block/${fs##*/}/size /sys/block/*/${fs##*/}/size))"
    1.18  
    1.19  			# image
    1.20  			disktype="@hdd@"
    1.21 -			case "$(cat /sys/block/${fs#/dev/}/removable 2>/dev/null ||
    1.22 +			case "$(cat /sys/block/${fs##*/}/removable 2>/dev/null ||
    1.23  				cat /sys/block/${fs:5:3}/removable 2>/dev/null)" in
    1.24  			1) disktype="@removable@" ;;
    1.25  			esac
    1.26 -			case "$(cat /sys/block/${fs#/dev/}/ro 2>/dev/null ||
    1.27 +			case "$(cat /sys/block/${fs##*/}/ro 2>/dev/null ||
    1.28  				cat /sys/block/${fs:5:3}/ro 2>/dev/null)" in
    1.29  			1) disktype="@cd@" ;;
    1.30  			esac
    1.31  
    1.32  			# boot flag
    1.33 -			dsk="${fs#/dev/}"
    1.34 +			dsk="${fs##*/}"
    1.35  			case " $bootdevs " in *\ $fs\ *) dsk="<i>$dsk</i>";; esac
    1.36  
    1.37 -			radio="<input type=\"radio\" name=\"device\" value=\"$action $fs\" id=\"${fs#/dev/}\"/>"
    1.38 +			radio="<input type=\"radio\" name=\"device\" value=\"$action $fs\" id=\"${fs##*/}\"/>"
    1.39  			[ "$REMOTE_USER" == "root" ] || radio=""
    1.40  			cat <<EOT
    1.41  			<tr>
    1.42  				<td>$radio<!--
    1.43 -					--><label for="${fs#/dev/}" data-icon="$disktype">&thinsp;$dsk</label></td>
    1.44 +					--><label for="${fs##*/}" data-icon="$disktype">&thinsp;$dsk</label></td>
    1.45  				<td>$(blkid $fs | sed '/LABEL=/!d;s/.*LABEL="\([^"]*\).*/\1/')</td>
    1.46  				<td>$type</td>
    1.47  				<td>$size</td>
    1.48 @@ -562,7 +562,7 @@
    1.49  			<tbody>
    1.50  EOT
    1.51  for devloop in $(ls /dev/*loop[0-9]*); do
    1.52 -	loop="${devloop#/dev/}"
    1.53 +	loop="${devloop##*/}"
    1.54  	dir=/sys/block/$loop
    1.55  	case "$(cat $dir/ro 2>/dev/null)" in
    1.56  	0) ro="$(_ "read/write")" ;;