2004-12-16 09:49:14 +00:00
|
|
|
#!/bin/sh
|
2012-11-06 12:12:33 +00:00
|
|
|
#
|
|
|
|
# This file is part of the LibreOffice project.
|
|
|
|
#
|
|
|
|
# This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
# License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
|
|
|
#
|
|
|
|
# This file incorporates work covered by the following license notice:
|
|
|
|
#
|
|
|
|
# Licensed to the Apache Software Foundation (ASF) under one or more
|
|
|
|
# contributor license agreements. See the NOTICE file distributed
|
|
|
|
# with this work for additional information regarding copyright
|
|
|
|
# ownership. The ASF licenses this file to you under the Apache
|
|
|
|
# License, Version 2.0 (the "License"); you may not use this file
|
|
|
|
# except in compliance with the License. You may obtain a copy of
|
|
|
|
# the License at http://www.apache.org/licenses/LICENSE-2.0 .
|
|
|
|
#
|
2004-12-16 09:49:14 +00:00
|
|
|
|
|
|
|
linenum=LINENUMBERPLACEHOLDER
|
|
|
|
|
|
|
|
UNPACKDIR=/var/tmp/unpack_PRODUCTNAMEPLACEHOLDER
|
2005-01-31 09:38:50 +00:00
|
|
|
diskSpaceRequired=DISCSPACEPLACEHOLDER
|
|
|
|
checksum=CHECKSUMPLACEHOLDER
|
|
|
|
|
2006-05-08 14:34:13 +00:00
|
|
|
EXTRACTONLY="no"
|
|
|
|
if [ "$1" = "-x" ]
|
|
|
|
then
|
|
|
|
EXTRACTONLY=yes
|
|
|
|
fi
|
|
|
|
|
2005-01-31 09:38:50 +00:00
|
|
|
# Determining current platform
|
|
|
|
|
|
|
|
platform=`uname -s`
|
|
|
|
|
|
|
|
case $platform in
|
|
|
|
SunOS)
|
|
|
|
tail_prog="tail"
|
|
|
|
;;
|
|
|
|
Linux)
|
|
|
|
tail_prog="tail -n"
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
tail_prog="tail"
|
|
|
|
;;
|
|
|
|
esac
|
2004-12-16 09:49:14 +00:00
|
|
|
|
|
|
|
# Asking for the unpack directory
|
|
|
|
|
|
|
|
echo
|
2005-01-31 09:38:50 +00:00
|
|
|
echo "Select the directory in which to save the unpacked files. [$UNPACKDIR] "
|
2004-12-16 09:49:14 +00:00
|
|
|
read reply leftover
|
|
|
|
if [ "x$reply" != "x" ]
|
|
|
|
then
|
|
|
|
UNPACKDIR="$reply"
|
|
|
|
fi
|
|
|
|
|
2005-01-31 09:38:50 +00:00
|
|
|
if [ -d $UNPACKDIR ]; then
|
|
|
|
printf "Directory $UNPACKDIR already exists.\n"
|
|
|
|
printf "Please select a new directory name.\n"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
2004-12-16 09:49:14 +00:00
|
|
|
# Unpacking
|
|
|
|
|
2006-09-27 10:01:31 +00:00
|
|
|
mkdir -m 700 $UNPACKDIR
|
2004-12-16 09:49:14 +00:00
|
|
|
|
2005-04-04 09:11:14 +00:00
|
|
|
diskSpace=`df -k $UNPACKDIR | $tail_prog -1 | awk '{if ( $4 ~ /%/) { print $3 } else { print $4 } }'`
|
2005-01-31 09:38:50 +00:00
|
|
|
if [ $diskSpace -lt $diskSpaceRequired ]; then
|
|
|
|
printf "The selected drive does not have enough disk space available.\n"
|
|
|
|
printf "PRODUCTNAMEPLACEHOLDER requires at least %s kByte.\n" $diskSpaceRequired
|
|
|
|
exit 1
|
|
|
|
fi
|
2004-12-16 09:49:14 +00:00
|
|
|
|
|
|
|
trap 'rm -rf $UNPACKDIR; exit 1' HUP INT QUIT TERM
|
|
|
|
|
2005-01-31 09:38:50 +00:00
|
|
|
if [ -x /usr/bin/sum ] ; then
|
|
|
|
echo "File is being checked for errors ..."
|
2004-12-16 09:49:14 +00:00
|
|
|
|
2005-01-31 09:38:50 +00:00
|
|
|
sum=`$tail_prog +$linenum $0 | /usr/bin/sum`
|
|
|
|
sum=`echo $sum | awk '{ print $1 }'`
|
2004-12-16 09:49:14 +00:00
|
|
|
|
2005-01-31 09:38:50 +00:00
|
|
|
if [ $sum != $checksum ]; then
|
|
|
|
echo "The download file appears to be corrupted. Please download PRODUCTNAMEPLACEHOLDER again."
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
fi
|
2004-12-16 09:49:14 +00:00
|
|
|
|
2005-01-31 09:38:50 +00:00
|
|
|
echo "Unpacking ..."
|
2004-12-16 09:49:14 +00:00
|
|
|
|
2005-02-24 15:16:51 +00:00
|
|
|
$tail_prog +$linenum $0 | (cd $UNPACKDIR; tar xf -)
|
2004-12-16 09:49:14 +00:00
|
|
|
|
2005-01-31 09:38:50 +00:00
|
|
|
echo "All files have been successfully unpacked."
|
2004-12-16 09:49:14 +00:00
|
|
|
|
2006-05-08 14:34:13 +00:00
|
|
|
if [ "$EXTRACTONLY" != "yes" ]
|
2004-12-16 09:49:14 +00:00
|
|
|
then
|
2006-05-08 14:34:13 +00:00
|
|
|
if [ -f $UNPACKDIR/setup ]
|
|
|
|
then
|
|
|
|
chmod 775 $UNPACKDIR/setup
|
|
|
|
$UNPACKDIR/setup
|
|
|
|
fi
|
2004-12-16 09:49:14 +00:00
|
|
|
fi
|
|
|
|
|
|
|
|
exit 0
|