freeswitch/build/getsounds.sh.in

45 lines
772 B
Bash
Raw Normal View History

#!/bin/sh
##### -*- mode:shell-script; indent-tabs-mode:nil; sh-basic-offset:2 -*-
TAR=@TAR@
ZCAT=@ZCAT@
WGET=@WGET@
CURL=@CURL@
DIR=`pwd`
2012-04-25 04:05:42 -04:00
if [ -x "$WGET" ]; then
DOWNLOAD_CMD=$WGET
fi
if [ "x${DOWNLOAD_CMD}" = "x" -a -x "$CURL" ] ; then
DOWNLOAD_CMD="$CURL -L -O"
fi
base=http://files.freeswitch.org/
tarfile=$1
install=$2
echo -n "#"
pwd
echo "# $0 $1 $2"
2012-04-25 04:05:42 -04:00
if [ -n "$FS_SOUNDS_DIR" ]; then
[ -d $FS_SOUNDS_DIR ] || mkdir -p $FS_SOUNDS_DIR
DIR=$FS_SOUNDS_DIR
fi
2012-04-25 04:05:42 -04:00
if [ ! -f $DIR/$tarfile ]; then
(cd $DIR && $DOWNLOAD_CMD $base$tarfile)
2012-04-25 04:05:42 -04:00
if [ ! -f $DIR/$tarfile ]; then
echo "cannot find $tarfile"
exit 1
fi
fi
2012-04-25 04:05:42 -04:00
if [ ! -z "$install" ]; then
test -d $install || mkdir $install
2012-04-25 04:05:42 -04:00
(cd $install && $ZCAT -c -d $DIR/$tarfile | $TAR xf -)
fi
exit 0