webif/var/mongoose/include/diskspace.jim

33 lines
705 B
Plaintext
Raw Normal View History

#!/mod/bin/jimsh
source /mod/webif/lib/setup
require system.class
lassign [system diskspace] size used perc free fperc
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%)<br>
Free: $free ($fperc%)
</span>
"