mirror of
https://github.com/signalwire/freeswitch.git
synced 2026-07-04 19:31:56 +00:00
55 lines
1.1 KiB
Bash
Executable File
55 lines
1.1 KiB
Bash
Executable File
#!/bin/sh
|
|
##### -*- mode:shell-script; indent-tabs-mode:nil; sh-basic-offset:2 -*-
|
|
|
|
TAR=@TAR@
|
|
ZCAT=@ZCAT@
|
|
WGET=@WGET@
|
|
CURL=@CURL@
|
|
|
|
DIR=`pwd`
|
|
|
|
if [ -x "$WGET" ]; then
|
|
DOWNLOAD_CMD=$WGET
|
|
fi
|
|
if [ "x${DOWNLOAD_CMD}" = "x" -a -x "$CURL" ] ; then
|
|
DOWNLOAD_CMD="$CURL -L -O"
|
|
fi
|
|
|
|
base=https://github.com/freeswitch/freeswitch-sounds/releases/download
|
|
tarfile=$1
|
|
install=$2
|
|
|
|
# Build the GitHub release URL from the tarball name:
|
|
# freeswitch-sounds-<voice>-<rate>-<version>.tar.gz -> tag <voice>-<version>
|
|
fname=`basename "$tarfile"`
|
|
stem=${fname#freeswitch-sounds-}
|
|
stem=${stem%.tar.gz}
|
|
sver=${stem##*-}
|
|
srest=${stem%-*}
|
|
svoice=${srest%-*}
|
|
url=$base/$svoice-$sver/$fname
|
|
|
|
echo -n "#"
|
|
pwd
|
|
echo "# $0 $1 $2"
|
|
|
|
if [ -n "$FS_SOUNDS_DIR" ]; then
|
|
[ -d $FS_SOUNDS_DIR ] || mkdir -p $FS_SOUNDS_DIR
|
|
DIR=$FS_SOUNDS_DIR
|
|
fi
|
|
|
|
if [ ! -f $DIR/$tarfile ]; then
|
|
(cd $DIR && $DOWNLOAD_CMD $url)
|
|
if [ ! -f $DIR/$tarfile ]; then
|
|
echo "cannot find $tarfile"
|
|
exit 1
|
|
fi
|
|
fi
|
|
|
|
if [ ! -z "$install" ]; then
|
|
test -d $install || mkdir $install
|
|
(cd $install && $ZCAT -c -d $DIR/$tarfile | $TAR xf -)
|
|
fi
|
|
|
|
exit 0
|