getsounds.sh.in 772 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. #!/bin/sh
  2. ##### -*- mode:shell-script; indent-tabs-mode:nil; sh-basic-offset:2 -*-
  3. TAR=@TAR@
  4. ZCAT=@ZCAT@
  5. WGET=@WGET@
  6. CURL=@CURL@
  7. DIR=`pwd`
  8. if [ -x "$WGET" ]; then
  9. DOWNLOAD_CMD=$WGET
  10. fi
  11. if [ "x${DOWNLOAD_CMD}" = "x" -a -x "$CURL" ] ; then
  12. DOWNLOAD_CMD="$CURL -L -O"
  13. fi
  14. base=http://files.freeswitch.org/
  15. tarfile=$1
  16. install=$2
  17. echo -n "#"
  18. pwd
  19. echo "# $0 $1 $2"
  20. if [ -n "$FS_SOUNDS_DIR" ]; then
  21. [ -d $FS_SOUNDS_DIR ] || mkdir -p $FS_SOUNDS_DIR
  22. DIR=$FS_SOUNDS_DIR
  23. fi
  24. if [ ! -f $DIR/$tarfile ]; then
  25. (cd $DIR && $DOWNLOAD_CMD $base$tarfile)
  26. if [ ! -f $DIR/$tarfile ]; then
  27. echo "cannot find $tarfile"
  28. exit 1
  29. fi
  30. fi
  31. if [ ! -z "$install" ]; then
  32. test -d $install || mkdir $install
  33. (cd $install && $ZCAT -c -d $DIR/$tarfile | $TAR xf -)
  34. fi
  35. exit 0