diff --git a/CONTROL/postinst b/CONTROL/postinst index 6d92a5cb..6a2be025 100755 --- a/CONTROL/postinst +++ b/CONTROL/postinst @@ -18,9 +18,11 @@ export tmpf=/tmp/cronf.$$ crontab=$PKG_ROOT/bin/crontab if [ -x $crontab ]; then - $crontab -l | grep -v webif/lib/bin/auto > $tmpf + $crontab -l | grep -v webif/lib/bin/auto \ + | grep -v webif/lib/auto > $tmpf cat $tmpf - << EOM | $crontab - -* * * * * /mod/webif/lib/bin/auto >/dev/null 2>&1 +* * * * * /mod/webif/lib/auto/scan >/dev/null 2>&1 +* * * * * /mod/webif/lib/auto/deq >/dev/null 2>&1 EOM fi @@ -47,6 +49,7 @@ $PKG_ROOT/etc/init.d/S02anacron start < /dev/null > /dev/null 2>&1 & #fi /mod/webif/lib/bin/diskattrs +/mod/webif/lib/auto/upgrade #/mod/webif/lib/bin/resetnew # Remove hook script placed by the legacy rt3070 package which does not work diff --git a/CONTROL/prerm b/CONTROL/prerm index ce2dc08c..196da1da 100755 --- a/CONTROL/prerm +++ b/CONTROL/prerm @@ -4,7 +4,8 @@ export tmpf=/tmp/cronf.$$ crontab=$PKG_ROOT/bin/crontab if [ -x $crontab ]; then - $crontab -l | grep -v webif/lib/bin/auto > $tmpf + $crontab -l | grep -v webif/lib/bin/auto \ + | grep -v webif/lib/auto > $tmpf [ -s $tmpf ] && $crontab $tmpf || $crontab -r fi diff --git a/webif/lib/auto/NOTES b/webif/lib/auto/NOTES index 45a7de6c..c714b4c0 100644 --- a/webif/lib/auto/NOTES +++ b/webif/lib/auto/NOTES @@ -1,6 +1,6 @@ Everything is a plugin. Those bundled with the web interface are in -/mod/webif/lib/auto/ and others are in /mod/webif/plugin/ +/mod/webif/lib/auto/plugin/ and others are in /mod/webif/plugin/ ---------------------------------------------------------------------- Priorities (* - additional package) diff --git a/webif/lib/auto/deq b/webif/lib/auto/deq index c97bb7af..0120086b 100755 --- a/webif/lib/auto/deq +++ b/webif/lib/auto/deq @@ -98,7 +98,7 @@ proc ::auto::register {plugin {priority 500}} { # Load plugins # Bundled -eval_plugins queue 1 "" /mod/webif/lib/auto +eval_plugins queue 1 "" /mod/webif/lib/auto/plugin # Third party diff --git a/webif/lib/auto/decrypt/auto.hook b/webif/lib/auto/plugin/decrypt/auto.hook similarity index 100% rename from webif/lib/auto/decrypt/auto.hook rename to webif/lib/auto/plugin/decrypt/auto.hook diff --git a/webif/lib/auto/decrypt/queue.hook b/webif/lib/auto/plugin/decrypt/queue.hook similarity index 100% rename from webif/lib/auto/decrypt/queue.hook rename to webif/lib/auto/plugin/decrypt/queue.hook diff --git a/webif/lib/auto/dedup/auto.hook b/webif/lib/auto/plugin/dedup/auto.hook similarity index 100% rename from webif/lib/auto/dedup/auto.hook rename to webif/lib/auto/plugin/dedup/auto.hook diff --git a/webif/lib/auto/expire/auto.hook b/webif/lib/auto/plugin/expire/auto.hook similarity index 100% rename from webif/lib/auto/expire/auto.hook rename to webif/lib/auto/plugin/expire/auto.hook diff --git a/webif/lib/auto/mp3/auto.hook b/webif/lib/auto/plugin/mp3/auto.hook similarity index 100% rename from webif/lib/auto/mp3/auto.hook rename to webif/lib/auto/plugin/mp3/auto.hook diff --git a/webif/lib/auto/mp3/queue.hook b/webif/lib/auto/plugin/mp3/queue.hook similarity index 100% rename from webif/lib/auto/mp3/queue.hook rename to webif/lib/auto/plugin/mp3/queue.hook diff --git a/webif/lib/auto/mpg/auto.hook b/webif/lib/auto/plugin/mpg/auto.hook similarity index 100% rename from webif/lib/auto/mpg/auto.hook rename to webif/lib/auto/plugin/mpg/auto.hook diff --git a/webif/lib/auto/mpg/queue.hook b/webif/lib/auto/plugin/mpg/queue.hook similarity index 100% rename from webif/lib/auto/mpg/queue.hook rename to webif/lib/auto/plugin/mpg/queue.hook diff --git a/webif/lib/auto/shrink/auto.hook b/webif/lib/auto/plugin/shrink/auto.hook similarity index 100% rename from webif/lib/auto/shrink/auto.hook rename to webif/lib/auto/plugin/shrink/auto.hook diff --git a/webif/lib/auto/shrink/queue.hook b/webif/lib/auto/plugin/shrink/queue.hook similarity index 100% rename from webif/lib/auto/shrink/queue.hook rename to webif/lib/auto/plugin/shrink/queue.hook diff --git a/webif/lib/auto/scan b/webif/lib/auto/scan index 89463b2d..35719f5f 100755 --- a/webif/lib/auto/scan +++ b/webif/lib/auto/scan @@ -273,7 +273,7 @@ proc register {type fn {priority 50}} { # Load plugins # Bundled -eval_plugins auto 1 "" /mod/webif/lib/auto +eval_plugins auto 1 "" /mod/webif/lib/auto/plugin # Third party diff --git a/webif/lib/auto/upgrade b/webif/lib/auto/upgrade new file mode 100755 index 00000000..d310b063 --- /dev/null +++ b/webif/lib/auto/upgrade @@ -0,0 +1,11 @@ +#!/mod/bin/jimsh + +source /mod/webif/lib/setup +require queue.class + +if {[queue version] == 1} { + queue dbhandle -close + file delete /mod/etc/queue.db + queue dbhandle +} + diff --git a/webif/lib/queue.class b/webif/lib/queue.class index 88299858..89e9ebe8 100644 --- a/webif/lib/queue.class +++ b/webif/lib/queue.class @@ -219,6 +219,21 @@ proc {queue size} {} { return [llength [queue runcandidates]] } +proc {queue version} {} { + set db [queue dbhandle] + + set version 1 + catch { + foreach row [$db query { + select val from config + where var = 'version' + }] { + lassign $row x version + } + } + return $version +} + queue method update {_status {_log ""} {_retries 0} {_runtime 0}} { set db [queue dbhandle] $db query {