1b8761b8f3
git-svn-id: file:///root/webif/svn/humax/pkg/src/webif/trunk@276 2a923420-c742-0410-a762-8d5b09965624
50 lines
996 B
Plaintext
Executable File
50 lines
996 B
Plaintext
Executable File
#!/mod/bin/jimsh
|
|
|
|
proc extract {line} {
|
|
regsub -all -- {[[:space:]]+} $line " " line
|
|
set fields [split $line]
|
|
set ::size [lindex $fields 1]
|
|
set ::used [lindex $fields 2]
|
|
set ::perc [string trimright [lindex $fields 4] "%"]
|
|
}
|
|
|
|
set used 0
|
|
set size 0
|
|
set perc 0
|
|
|
|
foreach df [split [exec df -h 2>>/dev/null] "\n\r"] {
|
|
if {[string match *sd?2* $df]} {
|
|
extract $df
|
|
break;
|
|
}
|
|
if {[string match *media/drive* $df]} {
|
|
extract $df
|
|
}
|
|
}
|
|
|
|
set file [format "%02d" [expr {$perc * 25 / 100 + 1}]]
|
|
|
|
# The HD model only has the USB images which are blue. I prefer the green
|
|
# one so use those if available.
|
|
if {[file exists /opt/share/images/blue/345_2_14_ST_HDD_01.png]} {
|
|
set prefix 345_2_14_ST_HDD
|
|
} else {
|
|
set prefix 345_1_27_ST_USB
|
|
}
|
|
|
|
puts "
|
|
|
|
<span style=\"float: right;
|
|
background:url('/images/345_1_27_ST_USB_BG.png')
|
|
no-repeat\">
|
|
<img src=/images/${prefix}_$file.png>
|
|
</span>
|
|
|
|
<span style=\"float: right\">
|
|
<br>
|
|
Total space: $size<br>
|
|
Used: $used ($perc%)
|
|
</span>
|
|
"
|
|
|