office-gobmx/download

236 lines
7.3 KiB
Text
Raw Normal View History

#!/bin/sh
#*************************************************************************
#
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# Copyright 2000, 2010 Oracle and/or its affiliates.
#
# 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.
#
#*************************************************************************
# environment setup yet?
if [ -z "$TARFILE_LOCATION" ]; then
. ./*[Ee]nv.[Ss]et.sh
fi
# 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
if [ -d .git ] ; then
if [ -z "$GIT_LINK_SRC" ]; then
./g -f clone
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
for i in clone/$i/* ; do
ln -sf $i $(basename $i)
done
done
fi
fi
if [ ! -d "$TARFILE_LOCATION" ]; then
mkdir $TARFILE_LOCATION
fi
if [ ! -d "$TARFILE_LOCATION" ]; then
echo "Error: Cannot create $TARFILE_LOCATION."
exit 1
fi
FILELIST="$1"
if [ -z "$FILELIST" ]; then
echo "No filelist provided, using the default ooo.lst."
FILELIST="ooo.lst"
fi
# check for wget and md5sum
wget=
md5sum=
curl=
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
eval "$i --version" > /dev/null 2>&1
ret=$?
if [ $ret -eq 0 ]; then
wget=$i
echo found wget: $wget
break
fi
done
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
# mac curl returns "2" on --version
# eval "$i --version" > /dev/null 2>&1
# ret=$?
# if [ $ret -eq 0 ]; then
if [ -x $i ]; then
curl=$i
echo found curl: $curl
break
fi
done
fi
if [ -z "$wget" -a -z "$curl" ]; then
echo "ERROR: neither wget nor curl found!"
exit
fi
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
ret=$?
if [ $ret -eq 0 ]; then
md5sum=$i
echo found md5sum: $md5sum
break
fi
done
if [ "$md5sum" = "md5" ]; then
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
fi
if [ -z "$md5sum" ]; then
echo "Warning: no md5sum: found!"
fi
start_dir=`pwd`
logfile=$TARFILE_LOCATION/fetch.log
date >> $logfile
downloaditem()
{
if [ "$1" != "" ]; then
if [ ! -f "../$2" ]; then
echo $2
if [ ! -z "$wget" ]; then
$wget -nv -N $1/$2 2>&1 | tee -a $logfile
else
echo fetching $2
$curl $file_date_check -O $1/$2 2>&1 | tee -a $logfile
fi
wret=$?
if [ $wret -ne 0 ]; then
mv $2 ${i}_broken
failed="$failed $2"
wret=0
fi
if [ -f $2 -a -n "$md5sum" ]; then
sum=`$md5sum $md5special $2 | sed "s/ .*//"`
if [ "$sum" != "$3" ]; then
echo checksum failure for $2 2>&1 | tee -a $logfile
failed="$failed $2"
mv $2 ${i}_broken
else
mv $2 ..
fi
else
mv $2 ..
fi
fi
fi
}
filelist=`cat $FILELIST`
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
# echo $i
if [ "$i" != `echo $i | sed "s/^http:\///"` ]; then
tarurl=$i
# TODO: check for comment
else
if [ "$tarurl" != "" ]; then
sum=`echo $i | sed "s/-.*//"`
downloaditem $tarurl $i $sum
fi
fi
done
if [ "$GUI" = "WNT" ]; then
downloaditem "http://download.microsoft.com/download/platformsdk/Redist/5.0.2195.1/W9XNT4/EN-US/" "dbghinst.EXE" "096f1d53d9ba09cde27d6f7c2ea6cc47"
downloaditem "http://download.microsoft.com/download/a/b/c/abc45517-97a0-4cee-a362-1957be2f24e1/" "WindowsXP-KB975337-x86-ENU.exe" "946d00d87e4094f3a6e425e2d538eadd"
msvcver=`$SRC_ROOT/oowintool --msvc-ver`
case "$msvcver" in
9.0)
downloaditem "http://download.microsoft.com/download/9/7/7/977B481A-7BA6-4E30-AC40-ED51EB2028F2/" "vcredist_x86.exe" "fd30acc7a696c32f661b33668e73bf7b"
downloaditem "http://download.microsoft.com/download/d/2/4/d242c3fb-da5a-4542-ad66-f9661d0a8d19/" "vcredist_x64.exe" "a31dc1a74f1dee5caf63aec8ebb5fe20"
;;
*)
;;
esac
fi
rm $TARFILE_LOCATION/tmp/*-*
2010-03-10 09:11:08 -06:00
cd $start_dir
if [ ! -z "$failed" ]; then
echo
echo ERROR: failed on:
for i in $failed ; do
echo $i
done
exit 1
fi
if [ "$GUI" = "WNT" -a -n "$md5sum" ]; then
TMPUNPACK=`cygpath -d $TARFILE_LOCATION/tmp`
if [ ! -f ./external/dbghelp/dbghelp.dll -a -f $TARFILE_LOCATION/dbghinst.EXE ]; then
$TARFILE_LOCATION/dbghinst.EXE /T:$TMPUNPACK /C
sum=`$md5sum $md5special $TARFILE_LOCATION/tmp/dbghelp.exe | sed "s/ .*//"`
if [ "$sum" == "cd3086a91e37965dd761ef5fd5df5b15" ]; then
unzip -LL -j -o -d ./external/dbghelp $TARFILE_LOCATION/tmp/dbghelp.exe
fi
fi
if [ ! -f ./external/gdiplus/gdiplus.dll -a -f $TARFILE_LOCATION/WindowsXP-KB975337-x86-ENU.exe ]; then
$TARFILE_LOCATION/WindowsXP-KB975337-x86-ENU.exe /extract:$TMPUNPACK /q
sum=`$md5sum $md5special $TARFILE_LOCATION/tmp/asms/10/msft/windows/gdiplus/gdiplus.dll | sed "s/ .*//"`
if [ "$sum" == "4721ab485e0c29cd1617a5f296b9cc47" ]; then
cp $TARFILE_LOCATION/tmp/asms/10/msft/windows/gdiplus/gdiplus.dll ./external/gdiplus/gdiplus.dll
fi
fi
if [ ! -f ./external/vcredist/vcredist_x86.exe -a -f $TARFILE_LOCATION/vcredist_x86.exe ]; then
cp $TARFILE_LOCATION/vcredist_x86.exe ./external/vcredist/vcredist_x86.exe
fi
if [ ! -f ./external/vcredist/vcredist_x64.exe -a -f $TARFILE_LOCATION/vcredist_x64.exe ]; then
cp $TARFILE_LOCATION/vcredist_x64.exe ./external/vcredist/vcredist_x64.exe
fi
fi
[ -x "post_download" ] || { echo "'post_download' script not found, run ./autogen.sh." ; exit 1 ; }
./post_download || exit 1
# vim:set shiftwidth=4 softtabstop=4 expandtab: