forked from hummypkg/webif
improve disk space calculation
git-svn-id: file:///root/webif/svn/humax/pkg/src/webif/trunk@1924 2a923420-c742-0410-a762-8d5b09965624
This commit is contained in:
parent
bf67161898
commit
fc9c912f99
@ -1,7 +1,7 @@
|
|||||||
Package: webif
|
Package: webif
|
||||||
Priority: optional
|
Priority: optional
|
||||||
Section: web
|
Section: web
|
||||||
Version: 1.0.13-4
|
Version: 1.0.13-5
|
||||||
Architecture: mipsel
|
Architecture: mipsel
|
||||||
Maintainer: af123@hummypkg.org.uk
|
Maintainer: af123@hummypkg.org.uk
|
||||||
Depends: webif-channelicons(>=1.1.11),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,epg(>=1.0.13),hmt(>=1.1.14),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.11),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,epg(>=1.0.13),hmt(>=1.1.14),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
|
||||||
|
@ -144,11 +144,15 @@ proc {system dustbin} {{short 0}} {
|
|||||||
return "[system mediaroot]/$dustbin"
|
return "[system mediaroot]/$dustbin"
|
||||||
}
|
}
|
||||||
|
|
||||||
proc {system diskdev} {} {
|
proc {system diskpart} {} {
|
||||||
switch [system model] {
|
switch [system model] {
|
||||||
HDR { set part /mnt/hd2 }
|
HDR { return "/mnt/hd2" }
|
||||||
HD { set part /media/drive1 }
|
HD { return "/media/drive1" }
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
proc {system diskdev} {} {
|
||||||
|
set part [system diskpart]
|
||||||
foreach line [split [\
|
foreach line [split [\
|
||||||
exec /mod/bin/busybox/df $part 2>>/dev/null] "\n\r"] {
|
exec /mod/bin/busybox/df $part 2>>/dev/null] "\n\r"] {
|
||||||
if {[string match "/*" $line]} {
|
if {[string match "/*" $line]} {
|
||||||
@ -163,23 +167,13 @@ proc {system disk} {} {
|
|||||||
return [string range [system diskdev] 0 end-1]
|
return [string range [system diskdev] 0 end-1]
|
||||||
}
|
}
|
||||||
|
|
||||||
if {[file exists /sbin/tune2fs]} {
|
require pretty_size
|
||||||
|
|
||||||
# New version of diskspace functions that ignores reserved blocks.
|
proc {system diskspace} {{raw 0}} {
|
||||||
# Only supported on firmwares with tune2fs in the root filesystem.
|
set part [system diskpart]
|
||||||
|
|
||||||
require pretty_size
|
lassign [exec /mod/bin/busybox/stat -f -c {%S %b %f} $part] \
|
||||||
|
bsize blocks fblocks
|
||||||
proc {system diskspace} {{raw 0}} {
|
|
||||||
set dev [system diskdev]
|
|
||||||
foreach line [split [exec /sbin/tune2fs -l $dev] "\n\r"] {
|
|
||||||
lassign [split $line ":"] key val
|
|
||||||
switch $key {
|
|
||||||
"Block size" { set bsize $val }
|
|
||||||
"Block count" { set blocks $val }
|
|
||||||
"Free blocks" { set fblocks $val }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
set size $($bsize * $blocks)
|
set size $($bsize * $blocks)
|
||||||
set free $($bsize * $fblocks)
|
set free $($bsize * $fblocks)
|
||||||
@ -193,58 +187,13 @@ if {[file exists /sbin/tune2fs]} {
|
|||||||
set used [pretty_size $used]
|
set used [pretty_size $used]
|
||||||
}
|
}
|
||||||
|
|
||||||
return [list $size $used $perc $free $fperc $dev]
|
return [list $size $used $perc $free $fperc]
|
||||||
}
|
}
|
||||||
|
|
||||||
proc {system diskfree} {} {
|
proc {system diskfree} {} {
|
||||||
return [lindex [system diskspace 1] 3]
|
lassign [exec /mod/bin/busybox/stat -f -c {%S %f} [system diskpart]] \
|
||||||
}
|
bsize fblocks
|
||||||
|
return $($bsize * $fblocks)
|
||||||
} else {
|
|
||||||
|
|
||||||
proc {system diskspace} {} {
|
|
||||||
switch [system model] {
|
|
||||||
HDR { set part /mnt/hd2 }
|
|
||||||
HD { set part /media/drive1 }
|
|
||||||
}
|
|
||||||
|
|
||||||
foreach line [split [\
|
|
||||||
exec /mod/bin/busybox/df -h $part 2>>/dev/null] "\n\r"] {
|
|
||||||
if {[string match "/*" $line]} {
|
|
||||||
regsub -all -- {[[:space:]]+} $line " " line
|
|
||||||
set fields [split $line]
|
|
||||||
set dev [lindex $fields 0]
|
|
||||||
set size [lindex $fields 1]
|
|
||||||
set used [lindex $fields 2]
|
|
||||||
set free [lindex $fields 3]
|
|
||||||
set perc [string trimright [lindex $fields 4] "%"]
|
|
||||||
set fperc $(100 - $perc)
|
|
||||||
break
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return [list $size $used $perc $free $fperc $dev]
|
|
||||||
}
|
|
||||||
|
|
||||||
proc {system diskfree} {} {
|
|
||||||
switch [system model] {
|
|
||||||
HDR { set part /mnt/hd2 }
|
|
||||||
HD { set part /media/drive1 }
|
|
||||||
}
|
|
||||||
|
|
||||||
set free 0
|
|
||||||
foreach line [split [exec /mod/bin/busybox/df -k $part 2>>/dev/null] "\n\r"] {
|
|
||||||
if {[string match "/*" $line]} {
|
|
||||||
regsub -all -- {[[:space:]]+} $line " " line
|
|
||||||
set fields [split $line]
|
|
||||||
set free [lindex $fields 3]
|
|
||||||
set free $($free * 1024)
|
|
||||||
break
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return $free
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
proc {system busy} {} {
|
proc {system busy} {} {
|
||||||
|
Loading…
Reference in New Issue
Block a user