/etc/cron.daily/umegaya-refresh-blends is in umegaya 1.0.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 | #!/bin/bash
set -e
# Exit if refresh_blends is null in umegaya.conf.
[ ! "$(awk '/^refresh_blends/ {print $2}' /etc/umegaya/umegaya.conf)" = 1 ] && exit 0
# Debug mode ?
[ "$(awk '/^debug/ {print $2}' /etc/umegaya/umegaya.conf)" = 1 ] && DEBUG=1
# Exit if curl, debcheckout, umegaya-adm, umegaya-guess-url or svn are not installed.
# Exit code is zero as this script is intended as a cron job.
[ -x /usr/bin/curl ] || exit 0
[ -x /usr/bin/debcheckout ] || exit 0
[ -x /usr/bin/umegaya-adm ] || exit 0
[ -x /usr/bin/umegaya-guess-url ] || exit 0
[ -x /usr/bin/svn ] || exit 0
# Hardcode the location of the tasks files, since we are transitionning
# from Subversion to Git.
DEBICHEM_URL="svn://svn.debian.org/blends/projects/debichem/trunk/debichem"
DEBIAN_MED_URL="svn://svn.debian.org/blends/projects/med/trunk/debian-med"
DEBIAN_SCIENCE_URL="git://anonscm.debian.org/blends/projects/science.git"
declare -A BLENDS
BLENDS[debichem-URLs]='for file in $(svn ls $DEBICHEM_URL/tasks) ; do svn cat $DEBICHEM_URL/tasks/$file ; done'
BLENDS[debichem-pack]='svn cat $DEBICHEM_URL/debian/control'
BLENDS[debian-med-URLs]='for file in $(svn ls $DEBIAN_MED_URL/tasks) ; do svn cat $DEBIAN_MED_URL/tasks/$file ; done'
BLENDS[debian-med-pack]='svn cat $DEBIAN_MED_URL/debian/control'
BLENDS[debian-science-URLs]='git archive --remote=$DEBIAN_SCIENCE_URL HEAD:tasks | tar xf - --to-stdout'
BLENDS[debian-science-pack]='git archive --remote=$DEBIAN_SCIENCE_URL HEAD:debian control | tar xf - --to-stdout'
for BLEND in debichem debian-med debian-science
do
[ $DEBUG ] && echo "Next blend: $BLEND"
# Override the Umegaya database with the information from the tasks file.
for VCS_URL in $(eval ${BLENDS[$BLEND-URLs]} | awk '/^Vcs-[SG]/ {print $2}')
do
[ $DEBUG ] && echo "$VCS_URL"
PACKAGE=$(umegaya-guess-url $VCS_URL | cut -f1)
[ $PACKAGE ] &&
umegaya-adm -p $PACKAGE -k YAML-URL -v $VCS_URL
done
# Refresh Umegaya for each package.
PACKAGES=$(
eval ${BLENDS[$BLEND-pack]} |
grep-dctrl -s Recommends,Suggests - |
sed -e 's/,//g' -e 's/|//g' -e 's/Recommends://g' -e 's/Suggests://g' |
sort -u )
for PACKAGE in $PACKAGES
do
[ $DEBUG ] && echo "$PACKAGE"
SOURCE=$(apt-cache showsrc $PACKAGE 2> /dev/null | grep Package -m1 | awk '{print $2}')
if [ "$SOURCE" != "" ] ; then
# make sure a failed ping will not interupt script
curl --silent "http://localhost/umegaya/$SOURCE/ping" || true
if [ $? != 0 ] ; then
echo "$0: Problem pinging $SOURCE ($?)"
fi
fi
done
done
# create downloadable archive of the fetched files
STOREFILES=`grep ^store_files /etc/umegaya/umegaya.conf | sed -r 's/store_files:\s+//'`
TARGETARCHIVE=`grep ^archive_for_bibref_gatherer /etc/umegaya/umegaya.conf | sed -r 's/archive_for_bibref_gatherer:\s+//'`
if [ $TARGETARCHIVE != "" -a $STOREFILES != "" ] ; then
STOREDIR=`dirname $STOREFILES`
if [ -d $STOREDIR ] ; then
cd $STOREDIR
BASESTOREDIR=`basename $STOREFILES`
if [ -d $BASESTOREDIR ] ; then
tmpignorezerolengthfiles=`mktemp`
find packages-metadata -size 0 >> $tmpignorezerolengthfiles
tar --exclude-vcs --exclude-from $tmpignorezerolengthfiles -cjf $TARGETARCHIVE $BASESTOREDIR
rm -f $tmpignorezerolengthfiles
fi
fi
fi
|