From d2712f2a76ace0098525abfb8619450989a9cccf Mon Sep 17 00:00:00 2001 From: hummypkg Date: Sat, 4 Aug 2012 21:42:02 +0000 Subject: [PATCH] add diskspace check and remove escape git-svn-id: file:///root/webif/svn/humax/pkg/src/webif/trunk@1103 2a923420-c742-0410-a762-8d5b09965624 --- CONTROL/control | 4 ++-- var/mongoose/lib/bin/auto | 24 ++++++++++++++++++------ 2 files changed, 20 insertions(+), 8 deletions(-) diff --git a/CONTROL/control b/CONTROL/control index 41793f6b..03335460 100644 --- a/CONTROL/control +++ b/CONTROL/control @@ -1,9 +1,9 @@ Package: webif Priority: optional Section: web -Version: 0.9.13 +Version: 0.9.13-1 Architecture: mipsel Maintainer: af123@hummypkg.org.uk Depends: webif-channelicons(>=1.0.2),mongoose(>=3.0-7),jim(>=0.73-1),jim-oo,jim-sqlite3(>=0.73),jim-cgi(>=0.5),service-control(>=1.2),busybox(>=1.19.3-1),lsof,epg(>=1.0.9),hmt(>=1.1.6),ssmtp,anacron,trm,openssl-command,nicesplice,id3v2,file,rsvsync(>=1.0.2),webif-charts(>=1.2),stripts(>=1.1.2) -Suggests: ffmpeg,webif-iphone +Suggests: ffmpeg Description: An evolving web interface for the Humax. diff --git a/var/mongoose/lib/bin/auto b/var/mongoose/lib/bin/auto index ab0037e1..d12bd612 100755 --- a/var/mongoose/lib/bin/auto +++ b/var/mongoose/lib/bin/auto @@ -3,6 +3,16 @@ source /mod/webif/lib/setup require lock system.class ts.class tdelete +proc dsc {} { + lassign [system diskspace] x x perc + if {$perc > 90} { + puts "Insufficient disk space, terminating." + exit + } +} + +dsc + if {![acquire_lock webif_auto]} { puts "Cannot acquire exclusive lock, terminating." exit @@ -20,7 +30,7 @@ if {![file exists $tmp]} { } # Clean-up the temporary directory -foreach file [readdir -nocomplain $tmp] { file delete -force "$tmp/$file" } +foreach file [readdir -nocomplain $tmp] { tdelete "$tmp/$file" } if {[system pkginst undelete]} { set dustbin "[system dustbin]" @@ -43,8 +53,8 @@ proc escape {str} { proc dedup {dir} { #puts "DEDUP: \[$dir]" - puts [exec /mod/webif/html/dedup/dedup -yes [escape $dir]] - exec /mod/webif/html/dedup/dedup -yes [escape $dir] + puts [exec /mod/webif/html/dedup/dedup -yes $dir] + exec /mod/webif/html/dedup/dedup -yes $dir } proc do_shrink {ts} { @@ -134,7 +144,7 @@ proc do_decrypt {ts} { # Move the decrypted copy into place. file rename "$tmp/$bfile" $file # Patch the HMT - quickest way to get back to a playable file. - exec /mod/bin/hmt -encrypted [escape "$rfile.hmt"] + exec /mod/bin/hmt -encrypted "$rfile.hmt" puts " Removing/binning old copy." # Move the old recording to the bin if undelete is installed. @@ -148,18 +158,19 @@ proc do_decrypt {ts} { if {$ext eq "hmt"} { # Patch the binned HMT back exec /mod/bin/hmt +encrypted \ - [escape "$bin/$tail.hmt"] + "$bin/$tail.hmt" } } } } else { - file delete "$rfile.encrypted" + tdelete "$rfile.encrypted" } puts " Done." } proc entries {dir callback} { foreach entry [readdir -nocomplain $dir] { + dsc if {![string match {*.ts} $entry} continue if {[catch {set ts [ts fetch "$dir/$entry"]}]} continue if {$ts == 0} continue @@ -188,6 +199,7 @@ proc scan {dir attr} {{indent 0}} { if {[string match {\[*} $dir]} continue + dsc if {[file exists "$dir/.auto$attr"]} { $attr $dir } foreach entry [readdir -nocomplain $dir] {