fetch.sh 399 Bytes
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
#! /bin/sh

URLBASE=http://www.emulab.net/downloads/linux-dkms
TARBALLDIR="$1"
shift

mkdir -p $TARBALLDIR
for file in $@; do
    outfile="$TARBALLDIR/$file"
    tmpfile="$outfile.tmp"
    [ -f "$outfile" ] && continue
    rm -f "$tmpfile"
    wget -O "$tmpfile" "$URLBASE/$file"

    if [ $? -ne 0 ]; then
	rm -f "$tmpfile"
	break
    fi

    mv -f "$TARBALLDIR/$file.tmp" "$TARBALLDIR/$file"
done