[BACK]Return to oxfetch.sh CVS log [TXT][DIR] Up to [local] / OpenXM / src / util

Diff for /OpenXM/src/util/oxfetch.sh between version 1.3 and 1.10

version 1.3, 2003/11/16 17:20:54 version 1.10, 2016/06/05 13:53:34
Line 1 
Line 1 
 #!/bin/sh  #!/bin/sh
 # $OpenXM: OpenXM/src/util/oxfetch.sh,v 1.2 2003/11/16 17:17:02 ohara Exp $  # $OpenXM: OpenXM/src/util/oxfetch.sh,v 1.9 2015/02/21 06:20:36 ohara Exp $
   
 fetch="wget --no-directories --passive-ftp --quiet --timestamping"  MASTER_SITES="http://www.math.kobe-u.ac.jp/pub/OpenXM/misc/"
   fetch="wget --no-directories --passive-ftp --timestamping"
   curl="curl --remote-name --remote-time"
 url=$1  url=$1
 distdir=${2:-.}  distdir=${2:-.}
 distinfo=$3  distinfo=${3:-./distinfo}
 distfile=`basename "$url"`  distfile=`basename "$url"`
   
 _usage () {  _usage () {
Line 19  _mkdir () {
Line 21  _mkdir () {
 }  }
   
 _fetch () {  _fetch () {
     if [ "distfile" != "" -a ! -f "$distdir/$distfile" ]; then      if ! which wget > /dev/null 2>&1; then fetch="${curl}"; fi
       if [ "$distfile" != "" -a ! -f "$distdir/$distfile" ]; then
         (cd $distdir; $fetch $url)          (cd $distdir; $fetch $url)
     fi      fi
 }  }
   
 # usage: cat distinfo | _md5 gc6.2.tar.gz  # usage: _md5grep gc6.2.tar.gz distinfo
 _md5 () {  _md5grep () {
     if [ $# -gt 0 ]; then      if [ $# -gt 0 ]; then
         grep "^MD5 ($1) =" | sed -e "s/^MD5 ($1) = //"          awk '/^MD5 \('"$1"'\) =/{print $NF}' $2
     fi      fi
 }  }
   
 _check () {  _md5sum () {
           md5.sh "$1" | awk '{print $NF}'
   }
   
   _check() {
       if [ ! -f "$distdir/$distfile" ]; then
           echo "Error: ${distfile} not found."
           exit 1
       fi
     if [ -f "$distinfo" ]; then      if [ -f "$distinfo" ]; then
         key1=`(cd $distdir; md5 "$distfile" ) | _md5 $distfile`          key1=`_md5sum  "${distdir}/${distfile}"`
         key2=`cat $distinfo | _md5 "$distfile"`          key2=`_md5grep "${distfile}" ${distinfo}`
         if [ "$key1" = "$key2" ] ; then          if [ "$key1" = "$key2" ] ; then
             echo "Checksum OK for $distfile".              echo "Checksum OK for $distfile".
           elif [ -z "$key1" ]; then
               echo "Warnig: no md5 checker."
         else          else
             echo "Checksum mismatch for $distfile".              echo "Error: checksum mismatch for $distfile".
             exit 1              exit 1
         fi          fi
     fi      fi

Legend:
Removed from v.1.3  
changed lines
  Added in v.1.10

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>