2007-03-13 23:02:46 -04:00
|
|
|
#!/bin/sh
|
2012-05-28 05:18:28 -04:00
|
|
|
##### -*- mode:shell-script; indent-tabs-mode:nil; sh-basic-offset:2 -*-
|
2007-03-13 23:02:46 -04:00
|
|
|
|
|
|
|
TAR=@TAR@
|
|
|
|
ZCAT=@ZCAT@
|
2011-10-27 16:03:28 -04:00
|
|
|
BZIP=@BZIP@
|
|
|
|
XZ=@XZ@
|
2007-03-13 23:02:46 -04:00
|
|
|
WGET=@WGET@
|
|
|
|
CURL=@CURL@
|
|
|
|
|
2011-10-27 16:03:28 -04:00
|
|
|
if [ -f "$WGET" ]; then
|
2012-05-28 05:18:28 -04:00
|
|
|
DOWNLOAD_CMD=$WGET
|
2011-10-27 16:03:28 -04:00
|
|
|
elif [ -f "$CURL" ]; then
|
2015-05-26 01:09:42 -04:00
|
|
|
DOWNLOAD_CMD="$CURL -L -O"
|
2011-02-21 21:01:01 -05:00
|
|
|
fi
|
|
|
|
|
2011-10-27 16:03:28 -04:00
|
|
|
if [ -n "`echo $1 | grep '://'`" ]; then
|
2012-05-28 05:18:28 -04:00
|
|
|
base=$1/
|
|
|
|
tarfile=$2
|
2011-10-27 16:03:28 -04:00
|
|
|
else
|
2012-05-28 05:18:28 -04:00
|
|
|
base=http://files.freeswitch.org/downloads/libs/
|
|
|
|
tarfile=$1
|
2007-03-21 19:42:16 -04:00
|
|
|
fi
|
2007-03-13 23:02:46 -04:00
|
|
|
|
2011-10-27 16:03:28 -04:00
|
|
|
uncompressed=`echo $tarfile | sed 's/\(\(\.tar\.gz\|\.tar\.bz2\|\.tar\.xz\)\|\(\.tgz\|\.tbz2\)\)$//'`
|
|
|
|
|
2012-03-14 17:40:37 -04:00
|
|
|
case `echo $tarfile | sed 's/^.*\.//'` in
|
2012-05-28 05:18:28 -04:00
|
|
|
bz2|tbz2) UNZIPPER=$BZIP ;;
|
|
|
|
xz) UNZIPPER=$XZ ;;
|
|
|
|
gz|tgz|*) UNZIPPER=$ZCAT ;;
|
2011-10-27 16:03:28 -04:00
|
|
|
esac
|
|
|
|
|
|
|
|
if [ ! -d $tarfile ]; then
|
2012-05-28 05:18:28 -04:00
|
|
|
if [ ! -f $tarfile ]; then
|
|
|
|
rm -fr $uncompressed
|
|
|
|
$DOWNLOAD_CMD $base$tarfile
|
2011-10-27 16:03:28 -04:00
|
|
|
if [ ! -f $tarfile ]; then
|
2012-05-28 05:18:28 -04:00
|
|
|
echo cannot find $tarfile
|
|
|
|
exit 1
|
2007-03-13 23:02:46 -04:00
|
|
|
fi
|
2012-05-28 05:18:28 -04:00
|
|
|
fi
|
|
|
|
if [ ! -d $uncompressed ]; then
|
|
|
|
$UNZIPPER -c -d $tarfile | $TAR -xf -
|
|
|
|
fi
|
2007-03-13 23:02:46 -04:00
|
|
|
fi
|
|
|
|
|
|
|
|
exit 0
|