2011-06-07 13:26:45 +00:00
|
|
|
#!/mod/bin/jimsh
|
|
|
|
|
2011-06-07 14:45:01 +00:00
|
|
|
if {[os.gethostname] eq "hosting"} {
|
|
|
|
set size "1TB"
|
|
|
|
set used "100GB"
|
|
|
|
set perc "10"
|
|
|
|
} else {
|
2011-07-14 19:28:00 +00:00
|
|
|
set used 0
|
|
|
|
set size 0
|
|
|
|
set perc 0
|
2011-06-21 22:38:20 +00:00
|
|
|
foreach df [split [exec df -h 2>>/dev/null] "\n\r"] {
|
2011-07-14 19:28:00 +00:00
|
|
|
if {[string match *sd?2* $df] || \
|
|
|
|
[string match *media/drive1* $df]} {
|
2011-06-07 14:45:01 +00:00
|
|
|
regsub -all -- {[[:space:]]+} $df " " df
|
|
|
|
set fields [split $df]
|
|
|
|
set size [lindex $fields 1]
|
|
|
|
set used [lindex $fields 2]
|
|
|
|
set perc [string trimright [lindex $fields 4] "%"]
|
2011-07-14 19:28:00 +00:00
|
|
|
break
|
2011-06-07 14:45:01 +00:00
|
|
|
}
|
2011-06-07 13:26:45 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
set file [format "%02d" [expr {$perc * 25 / 100 + 1}]]
|
|
|
|
|
2011-07-07 22:33:19 +00:00
|
|
|
# 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>
|
2011-06-07 13:26:45 +00:00
|
|
|
|
2011-07-07 22:33:19 +00:00
|
|
|
<span style=\"float: right\">
|
|
|
|
<br>
|
|
|
|
Total space: $size<br>
|
|
|
|
Used: $used ($perc%)
|
|
|
|
</span>
|
|
|
|
"
|
2011-06-07 13:26:45 +00:00
|
|
|
|