# If we error out this one is called, *FOLLOWED* by cleanup above
function onerror() {
ERRDATE=$(date "+%Y.%m.%d-%H:%M:%S")
- cat "${STAGEFILE}.log" | mail -s "ATTENTION ATTENTION! dinstall error at ${ERRDATE} in ${STAGEFILE} - (Be quiet, Brain, or I'll stab you with a Q-tip)" cron@ftp-master.debian.org
+
+ subject="ATTENTION ATTENTION!"
+ if [ "${error}" = "false" ]; then
+ subject="${subject} (continued)"
+ else
+ subject="${subject} (interrupted)"
+ fi
+ subject="${subject} dinstall error at ${ERRDATE} in ${STAGEFILE} - (Be quiet, Brain, or I'll stab you with a Q-tip)"
+
+ cat "${STAGEFILE}.log" | mail -s "${subject}" -a "X-Debian: DAK" cron@ftp-master.debian.org
}
########################################################################
# the actual dinstall functions follow #
########################################################################
-# Setup the notice file to tell bad mirrors they used the wrong time
-function notice() {
- rm -f "$NOTICE"
- cat > "$NOTICE" <<EOF
-Packages are currently being installed and indices rebuilt.
-Maintenance is automatic, starting at 01|07|13|19:52 UTC,
-and ending about an hour later. This file is then removed.
-
-You should not mirror the archive during this period. If you find this
-file on a Debian mirror please have a nice talk with the admin. They
-are doing something wrong.
-EOF
-}
-
# pushing merkels QA user, part one
function merkel1() {
log "Telling merkels QA user that we start dinstall"
function cruft() {
log "Checking for cruft in overrides"
dak check-overrides
-
- log "Fixing symlinks in $ftpdir"
- symlinks -d -r $ftpdir
}
function msfl() {
function fingerprints() {
log "Updating fingerprints"
dak import-keyring -L /srv/keyring.debian.org/keyrings/debian-keyring.gpg
+
+ OUTFILE=$(mktemp)
+ dak import-keyring --generate-users "%s" /srv/keyring.debian.org/keyrings/debian-maintainers.gpg >"${OUTFILE}"
+
+ if [ -s "${OUTFILE}" ]; then
+ /usr/sbin/sendmail -odq -oi -t -f envelope@ftp-master.debian.org <<EOF
+From: Debian FTP Masters <ftpmaster@ftp-master.debian.org>
+To: <debian-project@lists.debian.org>
+Subject: Debian Maintainers Keyring changes
+Content-Type: text/plain; charset=utf-8
+MIME-Version: 1.0
+
+The following changes to the debian-maintainers keyring have just been activated:
+
+$(cat $OUTFILE)
+
+Debian distribution maintenance software,
+on behalf of the Keyring maintainers
+
+EOF
+ fi
+ rm -f "$OUTFILE"
}
function overrides() {
function packages() {
log "Generating Packages and Sources files"
cd $configdir
+ GZIP='--rsyncable' ; export GZIP
apt-ftparchive generate apt.conf
}
make_buildd_dir
}
+function mklslar() {
+ cd $ftpdir
+
+ FILENAME=ls-lR
+
+ log "Removing any core files ..."
+ find -type f -name core -print0 | xargs -0r rm -v
+
+ log "Checking permissions on files in the FTP tree ..."
+ find -type f \( \! -perm -444 -o -perm +002 \) -ls
+ find -type d \( \! -perm -555 -o -perm +002 \) -ls
+
+ log "Checking symlinks ..."
+ symlinks -rd .
+
+ log "Creating recursive directory listing ... "
+ rm -f .${FILENAME}.new
+ TZ=UTC ls -lR > .${FILENAME}.new
+
+ if [ -r ${FILENAME}.gz ] ; then
+ mv -f ${FILENAME}.gz ${FILENAME}.old.gz
+ mv -f .${FILENAME}.new ${FILENAME}
+ rm -f ${FILENAME}.patch.gz
+ zcat ${FILENAME}.old.gz | diff -u - ${FILENAME} | gzip --rsyncable -9cfn - >${FILENAME}.patch.gz
+ rm -f ${FILENAME}.old.gz
+ else
+ mv -f .${FILENAME}.new ${FILENAME}
+ fi
+
+ gzip --rsyncable -9cfN ${FILENAME} >${FILENAME}.gz
+ rm -f ${FILENAME}
+}
+
+function mkmaintainers() {
+ log -n 'Creating Maintainers index ... '
+
+ cd $indices
+ dak make-maintainers ${scriptdir}/masterfiles/pseudo-packages.maintainers | \
+ sed -e "s/~[^ ]*\([ ]\)/\1/" | awk '{printf "%-20s ", $1; for (i=2; i<=NF; i++) printf "%s ", $i; printf "\n";}' > .new-maintainers
+
+ set +e
+ cmp .new-maintainers Maintainers >/dev/null
+ rc=$?
+ set -e
+ if [ $rc = 1 ] || [ ! -f Maintainers ] ; then
+ log -n "installing Maintainers ... "
+ mv -f .new-maintainers Maintainers
+ gzip --rsyncable -9v <Maintainers >.new-maintainers.gz
+ mv -f .new-maintainers.gz Maintainers.gz
+ elif [ $rc = 0 ] ; then
+ log '(same as before)'
+ rm -f .new-maintainers
+ else
+ log cmp returned $rc
+ false
+ fi
+}
+
+function copyoverrides() {
+ log 'Copying override files into public view ...'
+
+ for f in $copyoverrides ; do
+ cd $overridedir
+ chmod g+w override.$f
+
+ cd $indices
+ rm -f .newover-$f.gz
+ pc="`gzip 2>&1 -9nv <$overridedir/override.$f >.newover-$f.gz`"
+ set +e
+ nf=override.$f.gz
+ cmp -s .newover-$f.gz $nf
+ rc=$?
+ set -e
+ if [ $rc = 0 ]; then
+ rm -f .newover-$f.gz
+ elif [ $rc = 1 -o ! -f $nf ]; then
+ echo " installing new $nf $pc"
+ mv -f .newover-$f.gz $nf
+ chmod g+w $nf
+ else
+ echo $? $pc
+ exit 1
+ fi
+ done
+}
+
function scripts() {
log "Running various scripts from $scriptsdir"
cd $scriptsdir
- ./mkmaintainers
- ./copyoverrides
- ./mklslar
+ mkmaintainers
+ copyoverrides
+ mklslar
./mkfilesindices
./mkchecksums
}
function mirror() {
echo "Regenerating \"public\" mirror/ hardlink fun"
cd ${mirrordir}
- rsync -aH --link-dest ${ftpdir} --exclude Archive_Maintenance_In_Progress --delete --delete-after --ignore-errors ${ftpdir}/. .
+ rsync -aH --link-dest ${ftpdir} --delete --delete-after --ignore-errors ${ftpdir}/. .
}
function wb() {
ssh -2 -o BatchMode=yes -o SetupTimeOut=30 -o ConnectTimeout=30 -i ~/.ssh/push_merkel_ddaccess dak@merkel.debian.org sleep 1
}
-function runparts() {
- log "Using run-parts to run scripts in $base/scripts/distmnt"
- run-parts --report $base/scripts/distmnt
+function mirrorpush() {
+ log "Starting the mirrorpush"
+ date -u > /srv/ftp.debian.org/web/mirrorstart
+ echo "Using dak v1" >> /srv/ftp.debian.org/web/mirrorstart
+ echo "Running on host $(hostname -f)" >> /srv/ftp.debian.org/web/mirrorstart
+ sudo -H -u archvsync /home/archvsync/runmirrors > ~dak/runmirrors.log 2>&1 &
}
function i18n2() {
function renamelogfile() {
if [ -f "${dbdir}/dinstallstart" ]; then
NOW=$(cat "${dbdir}/dinstallstart")
- maillogfile
+# maillogfile
mv "$LOGFILE" "$logdir/dinstall_${NOW}.log"
logstats "$logdir/dinstall_${NOW}.log"
bzip2 -9 "$logdir/dinstall_${NOW}.log"
else
error "Problem, I don't know when dinstall started, unable to do log statistics."
NOW=`date "+%Y.%m.%d-%H:%M:%S"`
- maillogfile
+# maillogfile
mv "$LOGFILE" "$logdir/dinstall_${NOW}.log"
bzip2 -9 "$logdir/dinstall_${NOW}.log"
fi
ARGS='GO[@]'
local "${!ARGS}"
+ error=${ERR:-"true"}
+
STAGEFILE="${stagedir}/${FUNC}"
if [ -f "${STAGEFILE}" ]; then
stamptime=$(/usr/bin/stat -c %Z "${STAGEFILE}")
exit 42
fi
- if [ "${ERR}" = "false" ]; then
+ if [ "${error}" = "false" ]; then
set +e
fi
${FUNC} ${ARGS}
touch "${DINSTALLSTART}"
ts "startup"
-# Tell everyone we are doing some work
-NOTICE="$ftpdir/Archive_Maintenance_In_Progress"
-
# lock cron.unchecked (it immediately exits when this exists)
LOCK_DAILY="$lockdir/daily.lock"
ARGS=""
ERR="false"
)
-stage $GO
+stage $GO &
GO=(
FUNC="punew"
ARGS=""
ERR="false"
)
-stage $GO
+stage $GO &
lockfile "$LOCK_ACCEPTED"
lockfile "$LOCK_NEW"
ARGS=""
ERR="false"
)
-stage $GO
+stage $GO &
GO=(
FUNC="overrides"
ARGS=""
ERR=""
)
-stage $GO
+stage $GO &
-rm -f "${NOTICE}"
rm -f "${LOCK_DAILY}"
ts "locked part finished"
ARGS=""
ERR=""
)
-stage $GO
+stage $GO &
GO=(
FUNC="expire"
ARGS=""
ERR=""
)
-stage $GO
+stage $GO &
GO=(
FUNC="transitionsclean"
ARGS=""
ERR=""
)
-stage $GO
+stage $GO &
GO=(
FUNC="reports"
ARGS=""
ERR=""
)
-stage $GO
+stage $GO &
GO=(
FUNC="dm"
ARGS=""
ERR=""
)
-stage $GO
+stage $GO &
GO=(
FUNC="bts"
ARGS=""
ERR="false"
)
-stage $GO
+stage $GO &
GO=(
FUNC="merkel2"
ARGS=""
ERR="false"
)
-stage $GO
+stage $GO &
GO=(
- FUNC="runparts"
- TIME="run-parts"
+ FUNC="mirrorpush"
+ TIME="mirrorpush"
ARGS=""
ERR="false"
)
ARGS=""
ERR="false"
)
-stage $GO
+stage $GO &
GO=(
FUNC="testingsourcelist"
)
stage $GO &
-GO=(
- FUNC="aptftpcleanup"
- TIME="apt-ftparchive cleanup"
- ARGS=""
- ERR="false"
-)
-stage $GO
-
GO=(
FUNC="merkel3"
TIME="merkel ddaccessible sync"
ARGS=""
ERR="false"
)
-stage $GO
+stage $GO &
GO=(
FUNC="compress"
ARGS=""
ERR=""
)
+stage $GO &
+
+GO=(
+ FUNC="aptftpcleanup"
+ TIME="apt-ftparchive cleanup"
+ ARGS=""
+ ERR="false"
+)
stage $GO
log "Daily cron scripts successful, all done"