forked from hummypkg/webif
Remove busybox package dependencies
This commit is contained in:
parent
40c7ebcf89
commit
ec8fe177c5
|
@ -9,13 +9,17 @@ httpheader "application/json"
|
|||
set dir [cgi_get dir "/media/My Video"]
|
||||
set dlen [string length "$dir/"]
|
||||
|
||||
proc du {args} {
|
||||
if {[catch {exec du {*}$args}} dutxt]} {
|
||||
set dutxt ""
|
||||
}
|
||||
return $dutxt
|
||||
}
|
||||
|
||||
#9.4G /media/My Video/Archive
|
||||
#1.4G /media/My Video/CSI_ Crime Scene Investigation
|
||||
puts "{"
|
||||
if {[catch {exec /mod/bin/busybox/du -h -l -d 1 "$dir/"} dutxt]} {
|
||||
set dutxt ""
|
||||
}
|
||||
foreach line [split $dutxt "\n"] {
|
||||
foreach line [split [du -h -l -d 1 "$dir/"] "\n"] {
|
||||
lassign [split $line "\t"] size node
|
||||
set node [string range $node $dlen end]
|
||||
if {[string length $node]} {
|
||||
|
@ -31,10 +35,7 @@ foreach file [readdir $dir] {
|
|||
if {![string match "/*" $lk]} { set lk "$dir/$lk" }
|
||||
|
||||
if {![file isdirectory $lk]} continue
|
||||
if {[catch {exec /mod/bin/busybox/du -h "$lk"} dutxt]} {
|
||||
set dutxt ""
|
||||
}
|
||||
foreach line [split $dutxt "\n"] {
|
||||
foreach line [split [du -h "$lk"] "\n"] {
|
||||
set fields [split $line "\t"]
|
||||
if {[lindex $fields 1] eq $lk} {
|
||||
set node [file tail $file]
|
||||
|
@ -44,11 +45,11 @@ foreach file [readdir $dir] {
|
|||
}
|
||||
}
|
||||
|
||||
if {[catch {exec /mod/bin/busybox/du -hs "$dir/"} dutxt]} {
|
||||
set dutxt [du -hs "$dir/"]
|
||||
if {$dutxt eq ""} {
|
||||
set dutxt "N/A"
|
||||
}
|
||||
lassign [split $dutxt] total
|
||||
puts "\"\": \"$total\""
|
||||
|
||||
puts "}"
|
||||
|
||||
|
|
Loading…
Reference in New Issue