]> git.decadent.org.uk Git - dak.git/blobdiff - config/backports/cron.unchecked
Rename to backports
[dak.git] / config / backports / cron.unchecked
diff --git a/config/backports/cron.unchecked b/config/backports/cron.unchecked
new file mode 100755 (executable)
index 0000000..bb2337e
--- /dev/null
@@ -0,0 +1,34 @@
+#! /bin/sh
+set -e
+export SCRIPTVARS=/org/backports.org/dak-config/vars
+. $SCRIPTVARS
+
+LOCKFILE="$lockdir/unchecked.lock"
+NOTICE="$lockdir/daily.lock"
+
+cleanup() {
+  rm -f "$LOCKFILE"
+  if [ ! -z $LOCKDAILY ]; then
+         rm -f "$NOTICE"
+  fi
+}
+trap cleanup 0
+
+# only run one cron.unchecked
+if lockfile -r3 $LOCKFILE; then
+       cd $unchecked
+
+       changes=$(find . -maxdepth 1 -mindepth 1 -type f -name \*.changes | sed -e "s,./,," | xargs)
+       report=$queuedir/REPORT
+       timestamp=$(date "+%Y-%m-%d %H:%M")
+
+       if [ ! -z "$changes" ]; then
+               echo "$timestamp": "$changes"  >> $report
+               dak process-unchecked -a $changes >> $report
+               echo "--" >> $report
+       else
+               echo "$timestamp": Nothing to do >> $report
+       fi
+fi
+
+rm -f "$LOCKFILE"