# HG changeset patch # User Pascal Bellard # Date 1428917599 -7200 # Node ID 5d33b8aaf36df1a556da6f81c08eb13379f58326 # Parent 6bd26fb55b06723e3c3cb544aafb5c16921b2d8d boot.cgi: user blk2h diff -r 6bd26fb55b06 -r 5d33b8aaf36d boot.cgi --- a/boot.cgi Mon Apr 13 11:11:51 2015 +0200 +++ b/boot.cgi Mon Apr 13 11:33:19 2015 +0200 @@ -28,15 +28,6 @@ EOT } -disksize() -{ - size=$(($(cat /sys/block/$1/size)/2048)) - for i in MB GB TB ; do - [ $size -lt 2048 ] && break - size=$(((512+$size)/1024)) - done - echo "$size$i" -} # # Commands @@ -418,7 +409,7 @@ sed 's|^/dev/\(.*\):.*LABEL="\([^"]*\).* TYPE="\([^"]*\).*|\1 "\2" \3|' | \ while read dev label type; do echo -n "" + echo "$(blk2h < /sys/block/${dev:0:3}/$dev/size) $type" done cat < @@ -432,7 +423,7 @@ sed 's|/sys/block/\(.*\)/removable|\1|' | while read dev; do grep -qs 1 /sys/block/$DEV/ro && continue echo -n "" done cat < 1024; i++) n /= 1024