Annotation of OpenXM/src/util/oxfetch.sh, Revision 1.1
1.1 ! ohara 1: #!/bin/sh
! 2: # $OpenXM$
! 3:
! 4: fetch="wget --no-directories --passive-ftp --quiet --timestamping"
! 5: url=$1
! 6: distdir=${2:-.}
! 7: md5file=$3
! 8: distfile=`basename "$url"`
! 9:
! 10: _usage () {
! 11: echo 'usage: oxfetch URL [savedir] [md5file]'
! 12: exit 1
! 13: }
! 14:
! 15: _mkdir () {
! 16: if [ ! -d "$1" ]; then
! 17: mkdir -p "$1"
! 18: fi
! 19: }
! 20:
! 21: _fetch () {
! 22: if [ "distfile" != "" -a ! -f "$distdir/$distfile" ]; then
! 23: (cd $distdir; $fetch $url)
! 24: fi
! 25: }
! 26:
! 27: _check () {
! 28: if [ -f "$md5file" ]; then
! 29: (cd $distdir; md5 "$distfile" > "md5.$distfile" )
! 30: if cmp "$distdir/md5.$distfile" "$md5file" ; then
! 31: echo "Checksum OK for $distfile".
! 32: else
! 33: echo "Checksum mismatch for $distfile".
! 34: fi
! 35: rm -f "$distdir/md5.$distfile"
! 36: fi
! 37: }
! 38:
! 39: if [ $# -eq 0 ]; then
! 40: _usage
! 41: fi
! 42:
! 43: _mkdir $distdir
! 44: _fetch
! 45: _check
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>