Advertisement
Guest User

Rodrigo Lang

a guest
Nov 6th, 2010
238
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #!/bin/sh
  2.  
  3. [ `id -u` -eq 0 ] || { echo "You must have root privilege to run this script." && exit 0; }
  4.  
  5. check_network() {
  6.  
  7.     echo "\nTesting your internet connection. This process may take a few seconds..."
  8.     ping 8.8.8.8 -W5 -c1 >/dev/null;
  9.  
  10.     if [ $? != "0" ]; then
  11.         echo "Wait..."
  12.         ping 4.2.2.2 -W5 -c1 >/dev/null;
  13.         if [ $? != "0" ]; then
  14.                 echo "You must have an Internet connection to run this script."
  15.                 exit 0
  16.         fi
  17.     else
  18.         echo "Your Internet connection is Ok."
  19.     fi
  20.  
  21. }
  22.  
  23. install_sounds() {
  24.  
  25.     make cd-sounds-install && make cd-moh-install
  26.     make uhd-sounds-install && make uhd-moh-install
  27.     make hd-sounds-install && make hd-moh-install
  28.     make sounds-install && make moh-install
  29.  
  30. }
  31.  
  32. install_dependences() {
  33.  
  34.     apt-get -y install git-core build-essential automake autoconf libtool wget make libncurses5 libncurses5-dev \
  35.                 libgdbm-dev libdb-dev libperl-dev zlib1g-dev libtiff4-dev libjpeg62-dev debhelper           \
  36.                 unixodbc-dev libasound2-dev libcurl4-openssl-dev libssl-dev libogg-dev libvorbis-dev            \
  37.                 libgdbm-dev libgnutls-dev devscripts curl >/dev/null;
  38.  
  39. }
  40.  
  41. install_freeswitch() {
  42.  
  43.     sleep 2
  44.     cd /usr/src/
  45.     get -c http://files.freeswitch.org/freeswitch-1.0.6.tar.gz
  46.     tar zxvf freeswitch-1.0.6.tar.gz
  47.     cd /usr/src/freeswitch-1.0.6/
  48.     ./configure && make && make check && make samples
  49.  
  50. }
  51.  
  52. commands_freeswitch() {
  53.  
  54.     ln -s /usr/local/freeswitch/bin/freeswitch /usr/local/bin/freeswitch
  55.     ln -s /usr/local/freeswitch/bin/fs_cli /usr/local/bin/fs_cli
  56.  
  57. }
  58.  
  59. echo "\nCopyright© Rodrigo Ferreira Lang"
  60. echo "Purpose: Script made to install FreeSWITCH-1.0.6 in Debian/Ubuntu OS."
  61. check_network
  62. echo "\nTo install FreeSWITCH you must have some dependences. Do you want upgrade? [Y/n]" && read option
  63.  
  64. case $option in
  65.     [Nn])
  66.         echo "Canceling the instalation."
  67.         exit 0
  68.         ;;
  69.     *)
  70.         install_dependences
  71.         ;;
  72. esac
  73.  
  74. echo "Starting the instalation of FreeSWITCH."
  75. install_freeswitch
  76. echo "Creating commands."
  77. commands_freeswitch
  78. echo "\nDo you want install the default sounds of FreeSWITCH? [Y/n]" && read option
  79.  
  80. case $option in
  81.     [Nn])
  82.         echo "Instalation completed."
  83.         exit 0
  84.         ;;
  85.     *)
  86.         install_sounds
  87.         ;;
  88. esac
  89. echo "Instalation completed."
  90. exit 0
Advertisement
Advertisement
Advertisement
RAW Paste Data Copied
Advertisement