add system inuse

git-svn-id: file:///root/webif/svn/humax/pkg/src/webif/trunk@705 2a923420-c742-0410-a762-8d5b09965624
This commit is contained in:
hummypkg 2012-01-30 21:59:18 +00:00
parent 924bc72832
commit a3ecbe1d3f
2 changed files with 15 additions and 1 deletions

View File

@ -1,7 +1,7 @@
Package: webif Package: webif
Priority: optional Priority: optional
Section: web Section: web
Version: 0.9.0-2 Version: 0.9.0-3
Architecture: mipsel Architecture: mipsel
Maintainer: af123@hummypkg.org.uk Maintainer: af123@hummypkg.org.uk
Depends: mongoose(>=3.0-7),jim(>=0.73-1),jim-oo,jim-sqlite3(>=0.73),jim-cgi(>=0.5),service-control,busybox(>=1.19.3-1),lsof,epg(>=1.0.8),hmt(>=1.1.4),ssmtp,anacron,trm,openssl-command,nicesplice,id3v2 Depends: mongoose(>=3.0-7),jim(>=0.73-1),jim-oo,jim-sqlite3(>=0.73),jim-cgi(>=0.5),service-control,busybox(>=1.19.3-1),lsof,epg(>=1.0.8),hmt(>=1.1.4),ssmtp,anacron,trm,openssl-command,nicesplice,id3v2

View File

@ -96,6 +96,20 @@ proc {system busy} {} {
return 0 return 0
} }
proc {system inuse} {file} {
# Is humaxtv using the file?
if {[catch {set pid [exec /mod/bin/busybox/pgrep humaxtv]}]} {
return 0
}
regsub -all {([\\["$])} [file rootname [file tail $file]] {\\\1} file
set c 0
foreach line [split [exec /mod/bin/lsof -p $pid] "\n"] {
if {[string match "*$file*" $line]} { incr c }
}
if {$c > 0} { return 1 }
return 0
}
proc {system reboot} {} { proc {system reboot} {} {
exec /etc/init.d/S90settop shut exec /etc/init.d/S90settop shut
exec /sbin/reboot exec /sbin/reboot