#!/bin/sh # Name: setup-polycom # Version: 1.2 # Date: 04/26/07 # # Copyright (C) 2007 Fonality Inc. (fonality.com) # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License # as published by the Free Software Foundation; either version 2 # of the License, or (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # clear function setup_polycom { mkdir -p /tftpboot/polycom/logs mkdir -p /tftpboot/polycom/overrides mkdir -p /tftpboot/polycom/contacts cd /tftpboot chmod -R 777 * #IFCONFIG=`which ifconfig 2>/dev/null||echo /sbin/ifconfig` #IPADDR=`$IFCONFIG eth0|gawk '/inet addr/{print $2}'|gawk -F: '{print $2}'` ############################# cat > /tftpboot/server.cfg < EOF ############################# cat > /tftpboot/polycom_template.cnf < EOF ############################# cat > /tftpboot/sip.cfg <
EOF echo "Created /tftpboot/server.cfg using $IPADDR for the proxy. If the" echo "IP address of your Asterisk system changes run this script again and reboot." echo "Reboot your Polycom phones by disconnectiong the power to the phone." echo "" } echo "polycom Phone Setup Tool" echo "" echo "This will help you setup your system to provision polycom phones" echo "from the trixbox Endpoint Manager." echo "" echo "Please select which network interface you would like to use" echo "" echo "" echo "[1] eth0:" echo "[2] eth1:" echo "[3] other" echo "[q] quit" echo "" echo -n "Select interface: " read interface case "$interface" in "1" ) IFCONFIG=`which ifconfig 2>/dev/null||echo /sbin/ifconfig` IPADDR=`$IFCONFIG eth0|gawk '/inet addr/{print $2}'|gawk -F: '{print $2}'` setup_polycom ;; "2" ) IFCONFIG=`which ifconfig 2>/dev/null||echo /sbin/ifconfig` IPADDR=`$IFCONFIG eth1|gawk '/inet addr/{print $2}'|gawk -F: '{print $2}'` setup_polycom ;; "3" ) echo "Please sepcify which network interface you would like to use. It needs to be a number.. " echo -n "eth" read ointerface IFCONFIG=`which ifconfig 2>/dev/null||echo /sbin/ifconfig` IPADDR=`$IFCONFIG eth$ointerface|gawk '/inet addr/{print $2}'|gawk -F: '{print $2}'` setup_polycom ;; "q" |"Q" ) echo "Exiting." exit 0 ;; * ) echo "Sorry, try again." ;; esac