-#! /bin/sh
+#! /bin/bash
set -e
-export SCRIPTVARS=/org/security.debian.org/katie/vars-security
+set -u
+
+export SCRIPTVARS=/srv/security-master.debian.org/dak/config/debian-security/vars
. $SCRIPTVARS
-cd $unchecked
+# And use one locale, no matter what the caller has set
+export LANG=C
+export LC_ALL=C
-changes=$(find . -maxdepth 1 -mindepth 1 -type f -name \*.changes | sed -e "s,./,," | xargs)
report=$queuedir/REPORT
+reportdis=$queuedir/REPORT.disembargo
timestamp=$(date "+%Y-%m-%d %H:%M")
+doanything=false
-if [ -z "$changes" ]; then
- echo "$timestamp": Nothing to do >> $report
- exit 0;
-fi;
+cd $newstage
+changes=$(find . -maxdepth 1 -mindepth 1 -type f -name \*.changes | sed -e "s,./,," | xargs)
+if [ -n "$changes" ]; then
+ echo "$timestamp": ${changes:-"Nothing to do in newstage"} >> $report
+ dak process-upload -a -d "$newstage" >> $report
+fi
+
+cd $unchecked
+changes=$(find . -maxdepth 1 -mindepth 1 -type f -name \*.changes | sed -e "s,./,," | xargs)
+if [ -n "$changes" ]; then
+ doanything=true
+ echo "$timestamp": ${changes:-"Nothing to do in unchecked"} >> $report
+ dak process-upload -a -d "$unchecked" >> $report
+fi
+
+cd $disembargo
+changes=$(find . -maxdepth 1 -mindepth 1 -type f -name \*.changes | sed -e "s,./,," | xargs)
+
+if [ -n "$changes" ]; then
+ doanything=true
+ echo "$timestamp": ${changes:-"Nothing to do in disembargo"} >> $reportdis
+ dak process-upload -a -d "$disembargo" >> $reportdis
+fi
-echo "$timestamp": "$changes" >> $report
-jennifer -a $changes >> $report
-echo "--" >> $report
+if ! $doanything; then
+ echo "$timestamp": Nothing to do >> $report
+ exit 0
+fi
-sh $masterdir/cron.buildd-security
+$masterdir/cron.buildd