check connectivity

git-svn-id: file:///root/webif/svn/humax/pkg/src/webif/trunk@2030 2a923420-c742-0410-a762-8d5b09965624
This commit is contained in:
hummypkg 2014-08-28 18:44:42 +00:00
parent 252d6bf7f6
commit 4d895e464d
3 changed files with 18 additions and 3 deletions

View File

@ -1,10 +1,10 @@
Package: webif
Priority: optional
Section: web
Version: 1.0.16-1
Version: 1.0.16-2
Architecture: mipsel
Maintainer: af123@hummypkg.org.uk
Depends: webif-channelicons(>=1.1.12-1),lighttpd(>=1.4.35-2),jim(>=0.75-1),jim-oo,jim-sqlite3(>=0.75),jim-cgi(>=0.7),jim-binary(>=0.75),service-control(>=1.2),busybox(>=1.20.2-1),lsof(>=4.87),epg(>=1.0.13),hmt(>=1.1.21),ssmtp,anacron,trm(>=1.1),openssl-command,nicesplice,id3v2,file,rsvsync(>=1.0.2),webif-charts(>=1.2-1),stripts(>=1.2.5-3),smartmontools,tmenu(>=1.08),ffmpeg,id3v2,multienv(>=1.6),mongoose
Depends: webif-channelicons(>=1.1.12-2),lighttpd(>=1.4.35-2),jim(>=0.75-1),jim-oo,jim-sqlite3(>=0.75),jim-cgi(>=0.7),jim-binary(>=0.75),service-control(>=1.2),busybox(>=1.20.2-1),lsof(>=4.87),epg(>=1.0.13),hmt(>=1.1.21),ssmtp,anacron,trm(>=1.1),openssl-command,nicesplice,id3v2,file,rsvsync(>=1.0.2),webif-charts(>=1.2-1),stripts(>=1.2.5-3),smartmontools,tmenu(>=1.08),ffmpeg,id3v2,multienv(>=1.6),mongoose
Suggests:
Description: An evolving web interface for the Humax.
Tags: http://hummy.tv/forum/threads/5031/

View File

@ -2,7 +2,7 @@
package require cgi
source /mod/webif/lib/setup
require pkg.class
require pkg.class system.class
cgi_input
#cgi_dump
@ -22,6 +22,14 @@ proc opkg {cmd} {
httpheader "text/plain"
if {![system connectivity]} {
puts ""
puts "!! ERROR - No network connectivity to package repository !!"
puts ""
puts "Check your Internet connection and DNS service and then try again."
exit
}
if {$cmd eq "upgrade"} { opkg update }
opkg $cmd

View File

@ -375,3 +375,10 @@ proc {system filename} {str {extra ""}} {
return [regsub -all "\[$chars]" $str "_"]
}
proc {system connectivity} {{site "hpkg.tv"}} {
if {[catch {exec /bin/ping -4 -c 2 -W 3 -w 3 -q $site >/dev/null}]} {
return 0
}
return 1
}