#!/mod/bin/jimsh source /mod/webif/lib/setup require system.class if {[system model] eq "HDR"} { require settings.class set smartattrs {realloc pending offline} set smartattribs(SMART_status) "Unknown" foreach sa $smartattrs { set smartattribs(SMART_$sa) 0 set smartattribs(SMART_ack_$sa) 0 } foreach line [[settings] smartdata] { lassign $line x name x n x t if {$name eq "SMART_status"} { set smartattribs($name) $t } else { set smartattribs($name) $n } } # (SMART_ack_status 0 SMART_ack_pending 0 SMART_status PASSED SMART_pending 7 SMART_ack_realloc 0 SMART_ack_offline 0 SMART_realloc 0 SMART_offline 7) set smartmsg "" if {$smartattribs(SMART_status) ne "PASSED"} { append smartmsg \ "Disk overall health assessment is: $smartattribs(SMART_status)\n" } foreach sa $smartattrs { if {$smartattribs(SMART_$sa) != $smartattribs(SMART_ack_$sa)} { append smartmsg \ "Disk $sa sector count is: $smartattribs(SMART_$sa)" if {$smartattribs(SMART_ack_$sa) > 0} { append smartmsg " (was $smartattribs(SMART_ack_$sa))" } append smartmsg "\n" } } if {$smartmsg ne ""} { if {![dict exists $env REQUEST_URI]} { set env(REQUEST_URI) "" } puts "
!! WARNING !!

There appear to be some hardware problems with the internal hard disk on this device.

[string map {"\n" "
"} $smartmsg] " if {$env(REQUEST_URI) ne "/diag/disk.jim"} { puts "
Go to disk diagnostics " } else { puts "
Don't panic; for help, visit wiki.hummy.tv " } puts "
" } }