Rename derivatives
[collab-qa/udd.git] / scripts / fetch_bibref.sh
1 #!/bin/sh
2
3 set -e
4
5 TARGETDIR=/srv/udd.debian.org/mirrors/bibref
6 FETCHURL=http://blends.debian.net/packages-metadata/packages-metadata.tar.bz2
7 ARCHIVE=`basename $FETCHURL`
8 CURDIR=`pwd`
9
10 rm -rf $TARGETDIR
11 mkdir -p $TARGETDIR
12 wget -q ${FETCHURL} -O ${TARGETDIR}/${ARCHIVE}
13 cd $TARGETDIR
14 tar -xjf ${ARCHIVE}
15 # There is no point in keeping non-yaml files which later just cause errors
16 rm -f $CURDIR/bibref_gatherer_fetch.log
17 for nonyamlfile in `find . -name "*.upstream" -exec file \{\} \; | grep -e HTML -e XML | sed 's/:.*$//'` ; do
18     file $nonyamlfile >> $CURDIR/bibref_gatherer_fetch.log
19     rm -f $nonyamlfile
20 done
21 rm -rf ${ARCHIVE}