forked from hummypkg/webif
improve rmdir_if_empty, 1.2.5
git-svn-id: file:///root/webif/svn/pkg/webif/trunk@2488 2a923420-c742-0410-a762-8d5b09965624
This commit is contained in:
parent
c24374c4c0
commit
e7ca1d7742
@ -1,7 +1,7 @@
|
||||
Package: webif
|
||||
Priority: optional
|
||||
Section: web
|
||||
Version: 1.2.4-9
|
||||
Version: 1.2.5
|
||||
Architecture: mipsel
|
||||
Maintainer: af123@hummypkg.org.uk
|
||||
Depends: webif-channelicons(>=1.1.18),lighttpd(>=1.4.35-2),jim(>=0.76),jim-oo,jim-sqlite3(>=0.76),jim-cgi(>=0.7),jim-binary(>=0.76),service-control(>=2.1),busybox(>=1.20.2-1),lsof(>=4.87),epg(>=1.2.0),hmt(>=2.0.7),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),tcpping(>=1.1),e2fsprogs,wireless-tools(>=29-1),dbupdate,recmon(>=2.0.7)
|
||||
|
@ -427,23 +427,36 @@ proc {system mkdir_p} {dir} {
|
||||
exec /mod/bin/busybox/mkdir -p $dir
|
||||
}
|
||||
|
||||
proc {system rmdir_if_empty} {dir {why 0}} {
|
||||
proc {system dirblockers} {dir {permitted {".*"}}} {
|
||||
set fl {}
|
||||
foreach e [readdir -nocomplain $dir] {
|
||||
if {$e eq "." || $e eq ".."} continue
|
||||
if {$e in {. ..}} continue
|
||||
if {[file isdirectory "$dir/$e"]} {
|
||||
if {!$why} { return 0 }
|
||||
lappend fl $e
|
||||
} elseif {[string index $e 0] ne "."} {
|
||||
if {!$why} { return 0 }
|
||||
continue
|
||||
}
|
||||
set flag 1
|
||||
foreach p $permitted {
|
||||
if {[string match -nocase $p $e]} {
|
||||
set flag 0
|
||||
break
|
||||
}
|
||||
}
|
||||
if {$flag} {
|
||||
lappend fl $e
|
||||
}
|
||||
}
|
||||
if {!$why} {
|
||||
return $fl
|
||||
}
|
||||
|
||||
proc {system rmdir_if_empty} {dir {permitted {".*"}}} {
|
||||
set fl [system dirblockers $dir $permitted]
|
||||
|
||||
if {![llength $fl]} {
|
||||
file delete -force $dir
|
||||
return 1
|
||||
}
|
||||
return $fl
|
||||
return 0
|
||||
}
|
||||
|
||||
proc {system listening} {{mport 0}} {
|
||||
|
Loading…
Reference in New Issue
Block a user