2 #*************************************************************************
4 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
6 # Copyright 2000, 2010 Oracle and/or its affiliates.
8 # OpenOffice.org - a multi-platform office productivity suite
10 # This file is part of OpenOffice.org.
12 # OpenOffice.org is free software: you can redistribute it and/or modify
13 # it under the terms of the GNU Lesser General Public License version 3
14 # only, as published by the Free Software Foundation.
16 # OpenOffice.org is distributed in the hope that it will be useful,
17 # but WITHOUT ANY WARRANTY; without even the implied warranty of
18 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 # GNU Lesser General Public License version 3 for more details
20 # (a copy is included in the LICENSE file that accompanied this code).
22 # You should have received a copy of the GNU Lesser General Public License
23 # version 3 along with OpenOffice.org. If not, see
24 # <http://www.openoffice.org/license.html>
25 # for a copy of the LGPLv3 License.
27 #*************************************************************************
29 if [ -z "$TARFILE_LOCATION" ]; then
30 echo "ERROR: no destination defined! please set TARFILE_LOCATION!"
34 if [ ! -d "$TARFILE_LOCATION" ]; then
35 mkdir
$TARFILE_LOCATION
37 if [ ! -d "$TARFILE_LOCATION" ]; then
38 echo "ERROR: can't create"
43 echo "ERROR: parameter missing!"
44 echo "usage: $0 <fetch list>"
45 echo "first line must define the base url."
49 # check for wget and md5sum
54 for i
in wget
/usr
/bin
/wget
/usr
/local
/bin
/wget
/usr
/sfw
/bin
/wget
/opt
/sfw
/bin
/wget
/opt
/local
/bin
/wget
; do
55 eval "$i --version" > /dev
/null
2>&1
57 if [ $ret -eq 0 ]; then
59 echo found wget
: $wget
64 if [ -z "$wget" ]; then
65 for i
in curl
/usr
/bin
/curl
/usr
/local
/bin
/curl
/usr
/sfw
/bin
/curl
/opt
/sfw
/bin
/curl
/opt
/local
/bin
/curl
; do
66 # mac curl returns "2" on --version
67 # eval "$i --version" > /dev/null 2>&1
69 # if [ $ret -eq 0 ]; then
72 echo found curl
: $curl
78 if [ -z "$wget" -a -z "$curl" ]; then
79 echo "ERROR: neither wget nor curl found!"
83 for i
in md5
md5sum /usr
/local
/bin
/md5sum gmd5sum
/usr
/sfw
/bin
/md5sum /opt
/sfw
/bin
/gmd5sum
/opt
/local
/bin
/md5sum; do
84 if [ "$i" = "md5" ]; then
85 eval "$i -x" > /dev
/null
2>&1
87 eval "$i --version" > /dev
/null
2>&1
90 if [ $ret -eq 0 ]; then
92 echo found
md5sum: $md5sum
97 if [ "$md5sum" = "md5" ]; then
101 if [ -z "$md5sum" ]; then
102 echo "Warning: no md5sum: found!"
106 logfile
=$TARFILE_LOCATION/fetch.log
110 mkdir
-p $TARFILE_LOCATION/tmp
111 cd $TARFILE_LOCATION/tmp
112 echo $$
> fetch-running
113 for i
in $filelist ; do
115 if [ "$i" != `echo $i | sed "s/^http:\///"` ]; then
117 # TODO: check for comment
119 if [ "$tarurl" != "" ]; then
120 if [ ! -f "../$i" ]; then
122 if [ ! -z "$wget" ]; then
123 $wget -nv -N $tarurl/$i 2>&1 |
tee -a $logfile
126 $curl $file_date_check -O $tarurl/$i 2>&1 |
tee -a $logfile
129 if [ $wret -ne 0 ]; then
134 if [ -f $i -a -n "$md5sum" ]; then
135 sum=`$md5sum $md5special $i | sed "s/ .*//"`
136 sum2
=`echo $i | sed "s/-.*//"`
137 if [ "$sum" != "$sum2" ]; then
138 echo checksum failure
for $i 2>&1 |
tee -a $logfile
151 rm $TARFILE_LOCATION/tmp
/*-*
154 if [ ! -z "$failed" ]; then
156 echo ERROR
: failed on
:
157 for i
in $failed ; do