--- /dev/null
+#! /bin/bash
+
+set -e
+
+## Initial setup.
+mkdir -p $MIRRORS/eprint-bib; cd $MIRRORS/eprint-bib
+eprint=http://eprint.iacr.org
+rm -f list tags
+
+## Fetch the master index.
+curl -sS -o list -z '1 hour ago' $eprint/complete/
+[ -r list ] || exit 0
+
+## Pick out the article tags.
+sed -n '/^<a href="\/\([0-9]\+\/[0-9]\+\)">.*$/ s::\1:p' list >tags
+
+## For each tag, make sure we have the article information.
+while read tag; do
+ dir=${tag%/*}
+ mkdir -p $dir
+ file=$dir/eprint-${tag/\//-}.bib
+ [ -r $file ] || {
+ curl -sS -o $file.in "$eprint/cgi-bin/cite.pl?entry=$tag"
+ sed -n "
+ /^<PRE>/,/<\/PRE>/ {
+ /^<PRE>/ d
+ s:</PRE>.*::
+ s%note =.*\$%url = {http://eprint.iacr.org/$tag},%
+ p
+ }" $file.in >$file.sed
+ mv $file.sed $file
+ rm -f $file.in
+ echo $tag
+ }
+done <tags
+
+## Build the main bibliography.
+{
+ cat header
+ find . -name 'eprint-*.bib' -print | sort | xargs cat
+} >eprint.bib.new
+mv eprint.bib.new eprint.bib