]> git.decadent.org.uk Git - dak.git/blobdiff - config/debian/dinstall
dinstall
[dak.git] / config / debian / dinstall
index 0f6a7c8fef7f07c8f9324bfd575c8d9c33d1f9bd..9ee1781cc83f9ad994a860c4db45a7843066b0b7 100755 (executable)
@@ -63,7 +63,8 @@ function ts() {
 
 # Cleanup actions
 function cleanup() {
-    savelog -c ${LOGROTATE} -j "$LOGFILE"
+       rm -f ${LOCK_DAILY}
+       rm -f ${LOCK_ACCEPTED}
 }
 
 # Setup the notice file to tell bad mirrors they used the wrong time
@@ -166,10 +167,9 @@ function i18n1() {
 # Process the accepted queue
 function accepted() {
     log "Processing queue/accepted"
-    cd "$accepted"
-    rm -f REPORT
-    dak process-accepted -pa *.changes | tee REPORT | \
-        mail -s "Install for $(date +"%D - %R")" ftpmaster@ftp-master.debian.org
+    rm -f "$accepted/REPORT"
+    dak process-accepted -pa -d "$accepted" > "$accepted/REPORT"
+    cat REPORT | mail -s "Install for $(date +"%D - %R")" ftpmaster@ftp-master.debian.org
     chgrp debadmin REPORT
     chmod 664 REPORT
 }
@@ -223,7 +223,7 @@ function release() {
     dak generate-releases
 }
 
-function cleanup() {
+function dakcleanup() {
     log "Cleanup old packages/files"
     dak clean-suites
     dak clean-queues
@@ -313,7 +313,7 @@ function i18n2() {
     ln -sfT ${scriptdir}/i18n/${STAMP} i18n
 
     cd ${scriptdir}
-    find ./i18n -mtime +2 -mindepth 1 -maxdepth 1 -not -name "${STAMP}" -type d -print0 | xargs --no-run-if-empty -0 rm -rf
+    find ./i18n -mindepth 1 -maxdepth 1 -mtime +2 -not -name "${STAMP}" -type d -print0 | xargs --no-run-if-empty -0 rm -rf
 }
 
 function stats() {
@@ -384,7 +384,12 @@ function stage() {
     # it has to cd first!
     cd ${configdir}
 
-    if [ "${ERR}" = "false"]; then
+       if [ -f "${LOCK_STOP}" ]; then
+               log "${LOCK_STOP} exists, exiting immediately"
+               exit 42
+       fi
+
+    if [ "${ERR}" = "false" ]; then
         set +e
     fi
     ${FUNC} ${ARGS}
@@ -397,6 +402,11 @@ function stage() {
 
     touch "${stagedir}/${FUNC}"
 
+       if [ -f "${LOCK_STOP}" ]; then
+               log "${LOCK_STOP} exists, exiting immediately"
+               exit 42
+       fi
+
     if [ -n "${TIME}" ]; then
         ts "${TIME}"
     fi
@@ -407,7 +417,7 @@ function stage() {
 # We need logs.
 LOGFILE="$logdir/dinstall.log"
 
-exec > "$LOGFILE" 2>&1
+exec >> "$LOGFILE" 2>&1
 
 # usually we are not using debug logs. Set to 1 if you want them.
 DEBUG=0
@@ -445,6 +455,10 @@ LOCK_ACCEPTED="$lockdir/unchecked.lock"
 # from our point of view
 LOCK_BRITNEY="$lockdir/britney.lock"
 
+# If this file exists we exit immediately after the currently running
+# function is done
+LOCK_STOP="$lockdir/archive.stop"
+
 lockfile -l 3600 "${LOCK_DAILY}"
 trap cleanup EXIT ERR TERM HUP INT QUIT
 
@@ -478,7 +492,7 @@ GO=(
     FUNC="updates"
     TIME="External Updates"
     ARGS=""
-    ERR=""
+    ERR="false"
 )
 stage $GO
 
@@ -524,7 +538,7 @@ GO=(
 )
 stage $GO
 
-rm -f $LOCKAC
+rm -f "$LOCK_ACCEPTED"
 
 GO=(
     FUNC="msfl"
@@ -583,7 +597,7 @@ GO=(
 stage $GO
 
 GO=(
-    FUNC="cleanup"
+    FUNC="dakcleanup"
     TIME="cleanup"
     ARGS=""
     ERR=""
@@ -701,7 +715,7 @@ GO=(
 )
 stage $GO
 
-rm -f ${BRITNEYLOCK}
+rm -f ${LOCK_BRITNEY}
 
 GO=(
     FUNC="aptftpcleanup"
@@ -733,6 +747,8 @@ stage $GO
 
 cat "$LOGFILE" | mail -s "Log for dinstall run of ${NOW}" cron@ftp-master.debian.org
 
+savelog -c ${LOGROTATE} -j "$LOGFILE"
+
 # Now, at the very (successful) end of dinstall, make sure we remove
 # our stage files, so the next dinstall run will do it all again.
 rm -f "${stagedir}/*"