]> git.decadent.org.uk Git - dak.git/blob - config/debian/cron.daily
Use more https://
[dak.git] / config / debian / cron.daily
1 #! /bin/bash
2 #
3 # Run daily via cron, out of dak's crontab.
4
5 set -e
6 set -o pipefail
7 set -u
8 export SCRIPTVARS=/srv/ftp-master.debian.org/dak/config/debian/vars
9 . $SCRIPTVARS
10
11 # common functions are "outsourced"
12 . "${configdir}/common"
13
14 ################################################################################
15
16 TMPFILE=$( mktemp -p ${TMPDIR} )
17
18 function cleanup {
19     ERRVAL=$?
20     rm -f ${TMPFILE}
21     exit ${ERRVAL}
22 }
23 trap cleanup SIGHUP SIGINT SIGPIPE SIGTERM EXIT ERR
24
25 # log to dinstall's logfile instead of sending email
26 PROGRAM="cron.daily"
27 # Start logging
28 NOW=`date "+%Y.%m.%d-%H:%M:%S"`
29 LOGFILE="$logdir/daily_${NOW}.log"
30 exec >> "$LOGFILE" 2>&1
31
32 # get the latest list of wnpp bugs and their source packages
33 wget -q -O${TMPFILE} https://qa.debian.org/data/bts/wnpp_rm
34 chmod go+r ${TMPFILE}
35 mv ${TMPFILE} /srv/ftp-master.debian.org/scripts/masterfiles/wnpp_rm
36
37 # Push files over to security
38 # The key over there should have the following set for the ssh key:
39 #  command="/usr/bin/xzcat | /usr/bin/psql -1 -c 'DELETE FROM external_files; COPY external_files (id, filename, size, md5sum, last_used, sha1sum, sha256sum, created, modified) FROM STDIN' obscurity"
40 psql -c 'COPY files (id, filename, size, md5sum, last_used, sha1sum, sha256sum, created, modified) TO STDOUT' projectb | \
41             xz -3 | \
42             ssh -o BatchMode=yes -o ConnectTimeout=30 -o SetupTimeout=30 -2 \
43                 -i ${base}/s3kr1t/push_external_files dak@security-master.debian.org sync
44
45 # Update wanna-build dump
46 echo "Update wanna-build database dump"
47 $base/dak/scripts/nfu/get-w-b-db
48
49 reports
50
51 clean_debbugs
52
53 # Generate list of override disparities
54 dak override-disparity | gzip -9 > ${webdir}/override-disparity.gz
55
56 # Generate stats about the new queue
57 dak stats new ${webdir}/NEW-stats.yaml 2> /dev/null
58
59 # Generate the contributor data
60 # FIXME: In a day or three, when this worked from cron without
61 # failure, redirect its output to dev/null. Alternatively until then
62 # enrico added a --quiet and we use that.
63 REQUESTS_CA_BUNDLE=/etc/ssl/ca-debian/ca-certificates.crt dc-tool --mine="${configdir}/contributor.source" --auth-token @"${base}/s3kr1t/contributor.auth" --source ftp.debian.org --post
64
65 ${scriptsdir}/link_morgue.sh
66
67 ################################################################################
68
69 echo "Finally, all is done, compressing logfile"
70 exec > /dev/null 2>&1
71
72 bzip2 -9 "$LOGFILE"