From fb81a7e9543d5107de57af71506d4da5de7af648 Mon Sep 17 00:00:00 2001 From: hummypkg Date: Fri, 2 May 2014 11:25:25 +0000 Subject: [PATCH] defer shrink until after decryption if both are pending git-svn-id: file:///root/webif/svn/humax/pkg/src/webif/trunk@1872 2a923420-c742-0410-a762-8d5b09965624 --- CONTROL/control | 2 +- webif/lib/bin/auto | 18 +++++++++++++++--- 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/CONTROL/control b/CONTROL/control index 885a63c..0013cfb 100644 --- a/CONTROL/control +++ b/CONTROL/control @@ -1,7 +1,7 @@ Package: webif Priority: optional Section: web -Version: 1.0.12 +Version: 1.0.12-1 Architecture: mipsel Maintainer: af123@hummypkg.org.uk Depends: webif-channelicons(>=1.1.10),mongoose(>=3.0.11),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),stripts(>=1.2.5-3),smartmontools,tmenu(>=1.08),ffmpeg,id3v2,multienv(>=1.6) diff --git a/webif/lib/bin/auto b/webif/lib/bin/auto index 8d926ed..6064d2f 100755 --- a/webif/lib/bin/auto +++ b/webif/lib/bin/auto @@ -8,6 +8,8 @@ set settings [settings] set loglevel [$settings autolog] set audiomp3 [$settings audiomp3] +set modules {decrypt dedup shrink mpg mp3 expire} + if {![acquire_lock webif_auto]} { puts "Cannot acquire exclusive lock, terminating." exit @@ -49,8 +51,6 @@ proc endclock {size} { return "[pretty_size $size] in $el seconds - [pretty_size $rate]/s" } -set modules {decrypt dedup shrink mpg mp3 expire} - foreach mod $modules { set "hook_pre${mod}scan" {} set "hook_pre$mod" {} @@ -187,6 +187,18 @@ proc do_shrink {ts} { return } + # If the directory is flagged for decryption as well as shrink + # then check to see if decryption has already occured. If not, + # defer the shrink for now. + set dir [file dirname $file] + if {[file exists "$dir/.autodecrypt"] || [scanup $dir decrypt] == 1} { + log " $dir is also set for decryption." 2 + if {[$ts flag "ODEncrypted"]} { + log " $file - deferring shrink until decrypted." 1 + return + } + } + set file [file rootname [$ts get file]] if {[$ts inuse]} { @@ -291,7 +303,7 @@ proc do_decrypt {ts} { set anencd [exec /mod/bin/stripts -qE $rfile] if {$anencd != "1"} { log " $file - already decrypted but the HMT flag is wrong." 0 - system notify "$file - auto-decrypt - file is already decrypted but the HMT flag is wrong." + system notify "$file - auto-decrypt - file is already decrypted but the HMT flag is wrong. Run the 'fixencflags' diagnostic." return }