diff --git a/CONTROL/control b/CONTROL/control index cbf1e33..208c304 100644 --- a/CONTROL/control +++ b/CONTROL/control @@ -1,7 +1,7 @@ Package: webif Priority: optional Section: web -Version: 1.0.13-4 +Version: 1.0.13-5 Architecture: mipsel 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 diff --git a/webif/lib/system.class b/webif/lib/system.class index 1e2d1f7..64de84d 100644 --- a/webif/lib/system.class +++ b/webif/lib/system.class @@ -144,11 +144,15 @@ proc {system dustbin} {{short 0}} { return "[system mediaroot]/$dustbin" } -proc {system diskdev} {} { +proc {system diskpart} {} { switch [system model] { - HDR { set part /mnt/hd2 } - HD { set part /media/drive1 } + HDR { return "/mnt/hd2" } + HD { return "/media/drive1" } } +} + +proc {system diskdev} {} { + set part [system diskpart] foreach line [split [\ exec /mod/bin/busybox/df $part 2>>/dev/null] "\n\r"] { if {[string match "/*" $line]} { @@ -163,23 +167,13 @@ proc {system disk} {} { 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. - # Only supported on firmwares with tune2fs in the root filesystem. +proc {system diskspace} {{raw 0}} { + set part [system diskpart] - require pretty_size - - 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 } - } - } + lassign [exec /mod/bin/busybox/stat -f -c {%S %b %f} $part] \ + bsize blocks fblocks set size $($bsize * $blocks) set free $($bsize * $fblocks) @@ -193,58 +187,13 @@ if {[file exists /sbin/tune2fs]} { set used [pretty_size $used] } - return [list $size $used $perc $free $fperc $dev] - } + return [list $size $used $perc $free $fperc] +} - proc {system diskfree} {} { - return [lindex [system diskspace 1] 3] - } - -} 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 diskfree} {} { + lassign [exec /mod/bin/busybox/stat -f -c {%S %f} [system diskpart]] \ + bsize fblocks + return $($bsize * $fblocks) } proc {system busy} {} {