X-Git-Url: https://git.decadent.org.uk/gitweb/?a=blobdiff_plain;f=config%2Fdebian%2Fcron.dinstall;h=0fe0b1cf6528e1a71799d0c512943bb0507ba05c;hb=024bd84722b00b06cd5144bf92bdfd1eded5515c;hp=09415bea865fb7d0a194317393086ad4db182b3f;hpb=d3e7dbdd0037ccbcb4789365cbca67de06bce5fa;p=dak.git diff --git a/config/debian/cron.dinstall b/config/debian/cron.dinstall index 09415bea..0fe0b1cf 100755 --- a/config/debian/cron.dinstall +++ b/config/debian/cron.dinstall @@ -58,7 +58,6 @@ function cleanup() { # If we error out this one is called, *FOLLOWED* by cleanup above function onerror() { ERRDATE=$(date "+%Y.%m.%d-%H:%M:%S") - error=${ERR:-"false"} subject="ATTENTION ATTENTION!" if [ "${error}" = "false" ]; then @@ -75,20 +74,6 @@ function onerror() { # 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" <"${OUTFILE}" + + if [ -s "${OUTFILE}" ]; then + /usr/sbin/sendmail -odq -oi -t -f envelope@ftp-master.debian.org < +To: +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() { @@ -231,6 +235,7 @@ function mpfm() { function packages() { log "Generating Packages and Sources files" cd $configdir + GZIP='--rsyncable' ; export GZIP apt-ftparchive generate apt.conf } @@ -266,12 +271,70 @@ function buildd_dir() { 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 .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 scripts() { log "Running various scripts from $scriptsdir" cd $scriptsdir - ./mkmaintainers + mkmaintainers ./copyoverrides - ./mklslar + mklslar ./mkfilesindices ./mkchecksums } @@ -279,7 +342,7 @@ function scripts() { 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() { @@ -334,9 +397,12 @@ function merkel3() { 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() { @@ -408,14 +474,14 @@ function maillogfile() { 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 @@ -457,6 +523,8 @@ function stage() { ARGS='GO[@]' local "${!ARGS}" + error=${ERR:-"true"} + STAGEFILE="${stagedir}/${FUNC}" if [ -f "${STAGEFILE}" ]; then stamptime=$(/usr/bin/stat -c %Z "${STAGEFILE}") @@ -486,7 +554,7 @@ function stage() { exit 42 fi - if [ "${ERR}" = "false" ]; then + if [ "${error}" = "false" ]; then set +e fi ${FUNC} ${ARGS} @@ -550,9 +618,6 @@ DINSTALLEND="${lockdir}/dinstallend" 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" @@ -615,7 +680,7 @@ GO=( ARGS="" ERR="false" ) -stage $GO +stage $GO & GO=( FUNC="punew" @@ -639,7 +704,7 @@ GO=( ARGS="" ERR="false" ) -stage $GO +stage $GO & lockfile "$LOCK_ACCEPTED" lockfile "$LOCK_NEW" @@ -694,7 +759,7 @@ GO=( ARGS="" ERR="false" ) -stage $GO +stage $GO & GO=( FUNC="overrides" @@ -774,9 +839,8 @@ GO=( ARGS="" ERR="" ) -stage $GO +stage $GO & -rm -f "${NOTICE}" rm -f "${LOCK_DAILY}" ts "locked part finished" @@ -787,7 +851,7 @@ GO=( ARGS="" ERR="" ) -stage $GO +stage $GO & GO=( FUNC="expire" @@ -795,7 +859,7 @@ GO=( ARGS="" ERR="" ) -stage $GO +stage $GO & GO=( FUNC="transitionsclean" @@ -803,7 +867,7 @@ GO=( ARGS="" ERR="" ) -stage $GO +stage $GO & GO=( FUNC="reports" @@ -811,7 +875,7 @@ GO=( ARGS="" ERR="" ) -stage $GO +stage $GO & GO=( FUNC="dm" @@ -819,7 +883,7 @@ GO=( ARGS="" ERR="" ) -stage $GO +stage $GO & GO=( FUNC="bts" @@ -827,7 +891,7 @@ GO=( ARGS="" ERR="false" ) -stage $GO +stage $GO & GO=( FUNC="merkel2" @@ -835,11 +899,11 @@ GO=( ARGS="" ERR="false" ) -stage $GO +stage $GO & GO=( - FUNC="runparts" - TIME="run-parts" + FUNC="mirrorpush" + TIME="mirrorpush" ARGS="" ERR="false" ) @@ -859,7 +923,7 @@ GO=( ARGS="" ERR="false" ) -stage $GO +stage $GO & GO=( FUNC="testingsourcelist" @@ -879,21 +943,13 @@ GO=( ) 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" @@ -901,6 +957,14 @@ GO=( ARGS="" ERR="" ) +stage $GO & + +GO=( + FUNC="aptftpcleanup" + TIME="apt-ftparchive cleanup" + ARGS="" + ERR="false" +) stage $GO log "Daily cron scripts successful, all done"