2010-01-15 07:55:12 -06:00
|
|
|
#!/bin/sh
|
|
|
|
#*************************************************************************
|
|
|
|
#
|
|
|
|
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
2010-11-16 08:22:02 -06:00
|
|
|
#
|
2010-04-27 07:21:26 -05:00
|
|
|
# Copyright 2000, 2010 Oracle and/or its affiliates.
|
2010-01-15 07:55:12 -06:00
|
|
|
#
|
|
|
|
# OpenOffice.org - a multi-platform office productivity suite
|
|
|
|
#
|
|
|
|
# This file is part of OpenOffice.org.
|
|
|
|
#
|
|
|
|
# OpenOffice.org is free software: you can redistribute it and/or modify
|
|
|
|
# it under the terms of the GNU Lesser General Public License version 3
|
|
|
|
# only, as published by the Free Software Foundation.
|
|
|
|
#
|
|
|
|
# OpenOffice.org is distributed in the hope that it will be useful,
|
|
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
# GNU Lesser General Public License version 3 for more details
|
|
|
|
# (a copy is included in the LICENSE file that accompanied this code).
|
|
|
|
#
|
|
|
|
# You should have received a copy of the GNU Lesser General Public License
|
|
|
|
# version 3 along with OpenOffice.org. If not, see
|
|
|
|
# <http://www.openoffice.org/license.html>
|
|
|
|
# for a copy of the LGPLv3 License.
|
|
|
|
#
|
|
|
|
#*************************************************************************
|
|
|
|
|
2010-12-01 16:44:49 -06:00
|
|
|
# environment setup yet?
|
|
|
|
if [ -z "$TARFILE_LOCATION" ]; then
|
|
|
|
. ./*[Ee]nv.[Ss]et.sh
|
|
|
|
fi
|
|
|
|
|
2010-11-28 17:45:45 -06:00
|
|
|
# we want to clone if we are in the bootstrap git repo and clone does not exist yet
|
|
|
|
# we need to test for a .git in order not to clone after rsync if we are called in
|
|
|
|
# the inner autogen of the buid-repo based build
|
2010-12-05 00:47:51 -06:00
|
|
|
if [ -d .git ] ; then
|
2010-12-01 16:44:49 -06:00
|
|
|
if [ -z "$GIT_LINK_SRC" ]; then
|
2010-12-05 00:47:51 -06:00
|
|
|
./g -f clone
|
2010-12-01 16:44:49 -06:00
|
|
|
else
|
|
|
|
# space-saving clone from another local workdir
|
|
|
|
mkdir clone
|
|
|
|
for i in $GIT_REPO_NAMES ; do
|
|
|
|
bin/git-new-workdir $GIT_LINK_SRC/$i clone/$i
|
|
|
|
done
|
|
|
|
fi
|
2010-01-15 07:55:12 -06:00
|
|
|
fi
|
|
|
|
|
|
|
|
if [ ! -d "$TARFILE_LOCATION" ]; then
|
|
|
|
mkdir $TARFILE_LOCATION
|
|
|
|
fi
|
|
|
|
if [ ! -d "$TARFILE_LOCATION" ]; then
|
2010-08-20 09:43:34 -05:00
|
|
|
echo "Error: Cannot create $TARFILE_LOCATION."
|
|
|
|
exit 1
|
2010-01-15 07:55:12 -06:00
|
|
|
fi
|
|
|
|
|
2010-08-20 09:43:34 -05:00
|
|
|
FILELIST="$1"
|
|
|
|
if [ -z "$FILELIST" ]; then
|
|
|
|
echo "No filelist provided, using the default ooo.lst."
|
|
|
|
FILELIST="ooo.lst"
|
2010-01-15 07:55:12 -06:00
|
|
|
fi
|
|
|
|
|
2010-01-20 06:29:22 -06:00
|
|
|
# check for wget and md5sum
|
|
|
|
wget=
|
|
|
|
md5sum=
|
2010-02-02 11:14:01 -06:00
|
|
|
curl=
|
2010-01-15 07:55:12 -06:00
|
|
|
|
2010-02-03 04:35:31 -06:00
|
|
|
for i in wget /usr/bin/wget /usr/local/bin/wget /usr/sfw/bin/wget /opt/sfw/bin/wget /opt/local/bin/wget; do
|
2010-01-20 06:29:22 -06:00
|
|
|
eval "$i --version" > /dev/null 2>&1
|
|
|
|
ret=$?
|
|
|
|
if [ $ret -eq 0 ]; then
|
|
|
|
wget=$i
|
2010-02-02 11:14:01 -06:00
|
|
|
echo found wget: $wget
|
2010-12-01 03:58:54 -06:00
|
|
|
break
|
2010-01-20 06:29:22 -06:00
|
|
|
fi
|
|
|
|
done
|
|
|
|
|
2010-04-27 07:21:26 -05:00
|
|
|
if [ -z "$wget" ]; then
|
|
|
|
for i in curl /usr/bin/curl /usr/local/bin/curl /usr/sfw/bin/curl /opt/sfw/bin/curl /opt/local/bin/curl; do
|
2010-11-16 08:22:02 -06:00
|
|
|
# mac curl returns "2" on --version
|
2010-04-27 07:21:26 -05:00
|
|
|
# eval "$i --version" > /dev/null 2>&1
|
|
|
|
# ret=$?
|
|
|
|
# if [ $ret -eq 0 ]; then
|
|
|
|
if [ -x $i ]; then
|
|
|
|
curl=$i
|
|
|
|
echo found curl: $curl
|
2010-12-01 03:58:54 -06:00
|
|
|
break
|
2010-04-27 07:21:26 -05:00
|
|
|
fi
|
|
|
|
done
|
|
|
|
fi
|
2010-02-02 11:14:01 -06:00
|
|
|
|
|
|
|
if [ -z "$wget" -a -z "$curl" ]; then
|
|
|
|
echo "ERROR: neither wget nor curl found!"
|
2010-01-20 06:29:22 -06:00
|
|
|
exit
|
|
|
|
fi
|
|
|
|
|
2010-04-27 07:21:26 -05:00
|
|
|
for i in md5 md5sum /usr/local/bin/md5sum gmd5sum /usr/sfw/bin/md5sum /opt/sfw/bin/gmd5sum /opt/local/bin/md5sum; do
|
|
|
|
if [ "$i" = "md5" ]; then
|
|
|
|
eval "$i -x" > /dev/null 2>&1
|
|
|
|
else
|
|
|
|
eval "$i --version" > /dev/null 2>&1
|
|
|
|
fi
|
2010-01-20 06:29:22 -06:00
|
|
|
ret=$?
|
|
|
|
if [ $ret -eq 0 ]; then
|
|
|
|
md5sum=$i
|
|
|
|
echo found md5sum: $md5sum
|
2010-12-01 03:58:54 -06:00
|
|
|
break
|
2010-01-20 06:29:22 -06:00
|
|
|
fi
|
|
|
|
done
|
|
|
|
|
2010-04-27 07:21:26 -05:00
|
|
|
if [ "$md5sum" = "md5" ]; then
|
2010-10-01 15:58:49 -05:00
|
|
|
if md5 -r < /dev/null > /dev/null 2>/dev/null; then
|
|
|
|
md5special=-r
|
|
|
|
elif md5 -n < /dev/null > /dev/null 2>/dev/null; then
|
|
|
|
md5special=-n
|
|
|
|
fi
|
2010-04-27 07:21:26 -05:00
|
|
|
fi
|
|
|
|
|
2010-01-20 06:29:22 -06:00
|
|
|
if [ -z "$md5sum" ]; then
|
2010-02-03 03:54:13 -06:00
|
|
|
echo "Warning: no md5sum: found!"
|
2010-01-20 06:29:22 -06:00
|
|
|
fi
|
|
|
|
|
|
|
|
start_dir=`pwd`
|
2010-04-27 07:21:26 -05:00
|
|
|
logfile=$TARFILE_LOCATION/fetch.log
|
|
|
|
date >> $logfile
|
|
|
|
|
2010-08-20 09:43:34 -05:00
|
|
|
filelist=`cat $FILELIST`
|
2010-04-27 07:21:26 -05:00
|
|
|
mkdir -p $TARFILE_LOCATION/tmp
|
|
|
|
cd $TARFILE_LOCATION/tmp
|
|
|
|
echo $$ > fetch-running
|
2010-03-10 09:11:08 -06:00
|
|
|
for i in $filelist ; do
|
2010-04-27 07:21:26 -05:00
|
|
|
# echo $i
|
2010-01-20 06:29:22 -06:00
|
|
|
if [ "$i" != `echo $i | sed "s/^http:\///"` ]; then
|
2010-01-15 07:55:12 -06:00
|
|
|
tarurl=$i
|
2010-11-16 08:22:02 -06:00
|
|
|
# TODO: check for comment
|
2010-01-15 07:55:12 -06:00
|
|
|
else
|
|
|
|
if [ "$tarurl" != "" ]; then
|
2010-04-27 07:21:26 -05:00
|
|
|
if [ ! -f "../$i" ]; then
|
|
|
|
echo $i
|
2010-03-15 07:13:46 -05:00
|
|
|
if [ ! -z "$wget" ]; then
|
2010-04-27 07:21:26 -05:00
|
|
|
$wget -nv -N $tarurl/$i 2>&1 | tee -a $logfile
|
2010-02-02 11:14:01 -06:00
|
|
|
else
|
|
|
|
echo fetching $i
|
2010-04-27 07:21:26 -05:00
|
|
|
$curl $file_date_check -O $tarurl/$i 2>&1 | tee -a $logfile
|
2010-02-02 11:14:01 -06:00
|
|
|
fi
|
|
|
|
wret=$?
|
|
|
|
if [ $wret -ne 0 ]; then
|
2010-04-27 07:21:26 -05:00
|
|
|
mv $i ${i}_broken
|
2010-02-02 11:14:01 -06:00
|
|
|
failed="$failed $i"
|
|
|
|
wret=0
|
|
|
|
fi
|
2010-03-15 07:13:46 -05:00
|
|
|
if [ -f $i -a -n "$md5sum" ]; then
|
2010-04-27 07:21:26 -05:00
|
|
|
sum=`$md5sum $md5special $i | sed "s/ .*//"`
|
2010-03-10 09:11:08 -06:00
|
|
|
sum2=`echo $i | sed "s/-.*//"`
|
|
|
|
if [ "$sum" != "$sum2" ]; then
|
2010-04-27 07:21:26 -05:00
|
|
|
echo checksum failure for $i 2>&1 | tee -a $logfile
|
2010-03-10 09:11:08 -06:00
|
|
|
failed="$failed $i"
|
2010-04-27 07:21:26 -05:00
|
|
|
mv $i ${i}_broken
|
|
|
|
else
|
|
|
|
mv $i ..
|
2010-03-10 09:11:08 -06:00
|
|
|
fi
|
2010-04-27 07:21:26 -05:00
|
|
|
else
|
|
|
|
mv $i ..
|
2010-01-15 09:26:10 -06:00
|
|
|
fi
|
2010-01-15 07:55:12 -06:00
|
|
|
fi
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
done
|
2010-04-27 07:21:26 -05:00
|
|
|
rm $TARFILE_LOCATION/tmp/*-*
|
2010-03-10 09:11:08 -06:00
|
|
|
cd $start_dir
|
2010-01-15 07:55:12 -06:00
|
|
|
|
2010-01-15 09:26:10 -06:00
|
|
|
if [ ! -z "$failed" ]; then
|
2010-02-02 11:14:01 -06:00
|
|
|
echo
|
|
|
|
echo ERROR: failed on:
|
|
|
|
for i in $failed ; do
|
|
|
|
echo $i
|
|
|
|
done
|
2010-01-29 05:27:48 -06:00
|
|
|
exit 1
|
2010-01-15 07:55:12 -06:00
|
|
|
fi
|
|
|
|
|
2010-11-29 04:05:10 -06:00
|
|
|
[ -x "post_download" ] || { echo "'post_download' script not found, run ./autogen.sh." ; exit 1 ; }
|
|
|
|
|
|
|
|
./post_download || exit 1
|