From a1e45d5e9cc45a2b0a747c6f615d15371122bcb6 Mon Sep 17 00:00:00 2001 From: hummypkg Date: Wed, 3 Apr 2013 23:50:25 +0000 Subject: [PATCH] 1.0.0 rc git-svn-id: file:///root/webif/svn/humax/pkg/src/webif/trunk@1519 2a923420-c742-0410-a762-8d5b09965624 --- var/mongoose/html/diag/clearlog.jim | 2 ++ var/mongoose/html/lib/header.jim | 1 + var/mongoose/include/diskcheck.jim | 6 ++++-- var/mongoose/include/notify.jim | 30 +++++++++++++++++++++++++++++ var/mongoose/lib/bin/auto | 3 +++ var/mongoose/lib/bin/diskattrs | 6 ++++++ var/mongoose/lib/system.class | 5 +++++ 7 files changed, 51 insertions(+), 2 deletions(-) create mode 100755 var/mongoose/include/notify.jim diff --git a/var/mongoose/html/diag/clearlog.jim b/var/mongoose/html/diag/clearlog.jim index ff4e76d..8212770 100755 --- a/var/mongoose/html/diag/clearlog.jim +++ b/var/mongoose/html/diag/clearlog.jim @@ -9,10 +9,12 @@ set logdirs {/var/log /mod/tmp /mnt/hd3} set logext {.log} set log [cgi_get file 0] +set unlink [cgi_get unlink 0] set ldir [file dirname $log] if {[file dirname $log] in $logdirs && [file extension $log] in $logext} { file copy -force "/dev/null" $log + if {$unlink} { file delete $log } puts "Cleared $log" exit } diff --git a/var/mongoose/html/lib/header.jim b/var/mongoose/html/lib/header.jim index d826daf..bb32109 100755 --- a/var/mongoose/html/lib/header.jim +++ b/var/mongoose/html/lib/header.jim @@ -26,6 +26,7 @@ puts "
" source /mod/webif/include/restart.jim puts "
" source /mod/webif/include/diskcheck.jim +source /mod/webif/include/notify.jim puts {
diff --git a/var/mongoose/include/diskcheck.jim b/var/mongoose/include/diskcheck.jim index a3cba52..5bdee59 100755 --- a/var/mongoose/include/diskcheck.jim +++ b/var/mongoose/include/diskcheck.jim @@ -40,11 +40,13 @@ foreach sa $smartattrs { } if {$smartmsg ne ""} { + if {![dict exists $env REQUEST_URI]} { set env(REQUEST_URI) "" } puts "
!! WARNING !!

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

[string map {"\n" "
"} $smartmsg] " @@ -56,7 +58,7 @@ There are some issues with the internal hard disk on this device. } else { puts "
- For help and assistance, visit + Don't panic; for help and assistance, visit hummy.tv " } diff --git a/var/mongoose/include/notify.jim b/var/mongoose/include/notify.jim new file mode 100755 index 0000000..5c8a7d7 --- /dev/null +++ b/var/mongoose/include/notify.jim @@ -0,0 +1,30 @@ +#!/mod/bin/jimsh + +if {[file exists /mod/tmp/notify.log]} { + +source /mod/webif/lib/setup +require cat + +puts " +
+!! WARNING !! +

+You have pending system notifications: +

+
+"
+cat /mod/tmp/notify.log
+puts {
+
+ +
+ +} + +} + diff --git a/var/mongoose/lib/bin/auto b/var/mongoose/lib/bin/auto index 0587497..fb4a69f 100755 --- a/var/mongoose/lib/bin/auto +++ b/var/mongoose/lib/bin/auto @@ -174,6 +174,7 @@ proc do_shrink {ts} { } } msg]} { log "Error during shrink: $msg" 0 + system notify "$file - auto-shrink - error $msg." return } @@ -348,6 +349,7 @@ proc do_mpg {ts} { } } msg]} { log "Error during mpg extract: $msg" 0 + system notify "$file - auto-mpg - error $msg." return } @@ -393,6 +395,7 @@ proc do_mp3 {ts} { } } msg]} { log "Error during mp3 extract: $msg" 0 + system notify "$file - auto-mp3 - error $msg." return } diff --git a/var/mongoose/lib/bin/diskattrs b/var/mongoose/lib/bin/diskattrs index 7918d6b..9f36896 100755 --- a/var/mongoose/lib/bin/diskattrs +++ b/var/mongoose/lib/bin/diskattrs @@ -38,8 +38,14 @@ if {[dict exists $attrs 5]} { } if {[dict exists $attrs 197]} { $settings _nval_setting "SMART_pending" $attrs(197) + if {$attrs(197) < [$settings _nval_setting "SMART_ack_pending"]} { + $settings _nval_setting "SMART_ack_pending" $attrs(197) + } } if {[dict exists $attrs 198]} { $settings _nval_setting "SMART_offline" $attrs(198) + if {$attrs(198) < [$settings _nval_setting "SMART_ack_offline"]} { + $settings _nval_setting "SMART_ack_offline" $attrs(198) + } } diff --git a/var/mongoose/lib/system.class b/var/mongoose/lib/system.class index c60bd24..590eb55 100644 --- a/var/mongoose/lib/system.class +++ b/var/mongoose/lib/system.class @@ -249,5 +249,10 @@ proc {system is_listening} {mport} { } proc {system notify} {msg} { + set logfd [open "/mod/tmp/notify.log" "a+"] + puts $logfd "[\ + clock format [clock seconds] -format "%d/%m/%Y %H:%M"\ + ] - $msg" + $logfd close }