diff options
author | Hans-Joachim Lankenau <hjs@openoffice.org> | 2010-01-20 13:29:22 +0100 |
---|---|---|
committer | Hans-Joachim Lankenau <hjs@openoffice.org> | 2010-01-20 13:29:22 +0100 |
commit | 5c72b627fb70b196b7ce254c957d7e7cf7dee59c (patch) | |
tree | 78277f3641659f87bddcb38766cc569ef25afbd2 /fetch_tarballs.sh | |
parent | dd33ab04c42f29ca9e490558464a467c701e683b (diff) |
ause110: #i106731# replace non-sh code; some checks
Diffstat (limited to 'fetch_tarballs.sh')
-rwxr-xr-x | fetch_tarballs.sh | 51 |
1 files changed, 39 insertions, 12 deletions
diff --git a/fetch_tarballs.sh b/fetch_tarballs.sh index b8c85576ca68..3d43214bf7a0 100755 --- a/fetch_tarballs.sh +++ b/fetch_tarballs.sh @@ -50,41 +50,68 @@ if [ -z "$1" ]; then exit fi -# TDOD: check for wget and md5sum +# check for wget and md5sum +wget= +md5sum= +for i in wget /usr/local/bin/wget /usr/sfw/bin/wget /opt/sfw/bin/wget; do + eval "$i --version" > /dev/null 2>&1 + ret=$? + if [ $ret -eq 0 ]; then + wget=$i + echo found wget $wget + break 2 + fi +done + +if [ -z "$wget" ]; then + echo "ERROR: no wget found!" + exit +fi + +for i in md5sum /usr/local/bin/md5sum gmd5sum /usr/sfw/bin/md5sum /opt/sfw/bin/gmd5sum; do + eval "$i --version" > /dev/null 2>&1 + ret=$? + if [ $ret -eq 0 ]; then + md5sum=$i + echo found md5sum: $md5sum + break 2 + fi +done + +if [ -z "$md5sum" ]; then + echo "ERROR: no md5sum: found!" + exit +fi + +start_dir=`pwd` for i in `cat $1` ; do # echo $i - if [ "$i" != "${i#http}" ]; then + if [ "$i" != `echo $i | sed "s/^http:\///"` ]; then tarurl=$i - # check for comment + # TODO: check for comment else if [ "$tarurl" != "" ]; then cd $TARFILE_LOCATION - wget -N -nv -c $tarurl/$i + $wget -nv -N $tarurl/$i wret=$? if [ $wret -ne 0 ]; then failed="$failed $i" wret=0 fi if [ -f $i ]; then - sum=`md5sum $i | sed "s/ [ *].*//"` + sum=`$md5sum $i | sed "s/ [ *].*//"` sum2=`echo $i | sed "s/-.*//"` if [ "$sum" != "$sum2" ]; then echo checksum failure for $i failed="$failed $i" fi fi - cd - > /dev/null + cd $start_dir fi fi done -#pushd $TARFILE_LOCATION > /dev/null -#for i in * ; do -# wget --spider -nv -c $tarurl/$i -#done -#popd > /dev/null - if [ ! -z "$failed" ]; then echo $failed | sed "s/ /\n/g" | sed "s/^/ERROR: failed to download: /" fi |