#!/bin/bash #/*********************************************************************** #* EasyVoxBox and Xelatec - install.sh #* Copyright (c) 2007, 2008 #* Exabar Phone Systems, EasyVoxBox Project. All rights reserved. #* #* Permission to use, copy, modify, and/or distribute this software #* for any purpose with or without fee is hereby granted, provided #* that the above copyright notice and this permission notice appear #* in all copies. #* #* THIS SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL #* WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED #* WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE #* AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR #* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS #* OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, #* NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN #* CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. #* #************************************************************************* #* 20080911 1000 Steven Henke, sph@xelatec.com http://www.xelatec.com #* 20091211 1340 sph adding openvz and x86_64 handlers #* 20091214 1335 sph new vtiger and webmin #************************************************************************* #* This script is NOT designed to be called directly. #* This script is NOT designed to reinstall, repair or update the product. #* Refer to the associated apploader.sh script. #*************************************************************************/ # # SOURCE CONFIGURATION VALUES # cd /etc/EVB if [ -e /etc/EVB/app.conf ]; then echo "Found and loading configuration file /etc/EVB/app.conf." . /etc/EVB/app.conf else echo "ERROR: Unable to find configuration file /etc/EVB/app.conf." exit 1 fi # # INITIALIZE VARIABLES # SVN_FILE_VERSION="$Revision$" SVN_FILE_ID="$Id$" verbose=0 # src_dir=$APP_WORKDIR"/inst" ast_dir="asterisk-1.4.21.2" ast_addons_ver="asterisk-addons-1.4.7.tar.gz" ast_addons_dir="asterisk-addons-1.4.7" libpri_ver="libpri-1.4.5.tar.gz" libpri_dir="libpri-1.4.5" zaptel_dir="zaptel-1.4.12" iksemel_ver="iksemel-1.3.tar.gz" iksemel_dir="iksemel-1.3" speex_ver="speex-1.2beta3.tar.gz" speex_dir="speex-1.2beta3" autoconf_ver="autoconf-2.61.tar.gz" autoconf_dir="autoconf-2.61" fpbx_dir="freepbx-2.5.1" lame_ver="lame-3.97.tar.gz" lame_dir="lame-3.97" spandsp_ver="spandsp-0.0.4pre16.tgz" spandsp_dir="spandsp-0.0.4" cmake_ver="cmake-2.6.1.tar.gz" cmake_dir="cmake-2.6.1" agx_ast_addons_ver="agx-ast-addons.tgz" agx_ast_addons_dir="agx-ast-addons" webmin_ver="webmin-1.500-1.noarch.rpm" # # DEFINE FUNCTIONS # conf_read() { echo "install - conf_read" # acf=$APP_CONFDIR/$APP_CONF if [ -e $acf ]; then confok=1 . $APP_CONFDIR/$APP_CONF else confok=0 echo "ERROR: Cannot find $APP_CONFDIR/$APP_CONF" echo -n "Press Enter to Continue." read text exit 1 fi } # ast_user() { echo "*********************************************************" echo "* $APP_ACRO install - ast_user @ $(date +%H:%M:%S)" echo "*********************************************************" # # if not exist add the asterisk group grep -c "^asterisk:" /etc/group &> /dev/null if [ $? = 1 ] then echo "Adding group asterisk..." /usr/sbin/groupadd -r -f asterisk else echo "group asterisk already present" fi # if not exist add the asterisk user grep -c "^asterisk:" /etc/passwd &> /dev/null if [ $? = 1 ]; then echo "adding user asterisk..." /usr/sbin/useradd -c "Asterisk VoIP PBX" -g asterisk \ -r -s /bin/bash -m -d /var/lib/asterisk \ asterisk else echo "user asterisk already present" fi # chown asterisk /var/lib/php/session/ return } # inst_iperf() { TPNAME="iperf-2.0.4" cd /usr/src if [ $APP_MIRROR_TYPE = 2 ]; then wget http://www.xelatec.com/pub/misc/$TPNAME.tar.gz else wget http://www.easyvoxbox.org/pub/misc/$TPNAME.tar.gz fi tar xzf $TPNAME.tar.gz cd ./$TPNAME ./configure if ! [ $? = 0 ]; then echo "ERROR: $TPNAME configure failed." return fi # make if ! [ $? = 0 ]; then echo "ERROR: $TPNAME make failed." return fi make install if ! [ $? = 0 ]; then echo "ERROR: $TPNAME make install failed." return fi } # httpd() { echo "*********************************************************" echo "* $APP_ACRO install - httpd @ $(date +%H:%M:%S)" echo "*********************************************************" # cp $APP_WORKDIR/scripts/httpd.conf /etc/httpd/conf # if [ ! -d $APP_CONFDIR/passwd ]; then mkdir -p $APP_CONFDIR/passwd fi htpasswd -c -b $APP_CONFDIR/passwd/evbpasswd wwwadmin password htpasswd -b $APP_CONFDIR/passwd/evbpasswd easyvoxbox password echo "Admin: easyvoxbox" >$APP_CONFDIR/passwd/evbgroup echo "Manager: username" >>$APP_CONFDIR/passwd/evbgroup echo "Operator: username" >>$APP_CONFDIR/passwd/evbgroup echo "User: username" >>$APP_CONFDIR/passwd/evbgroup chown -R asterisk $APP_CONFDIR/passwd chgrp -R asterisk $APP_CONFDIR/passwd /sbin/service httpd restart rpm -ih $APP_WORKDIR/web_overlay/$webmin_ver chkconfig --level 345 webmin on return } sql() { echo "*********************************************************" echo "* $APP_ACRO install - sql @ $(date +%H:%M:%S)" echo "*********************************************************" # /usr/bin/mysql_install_db /sbin/service mysqld start chkconfig mysqld on sleep 5 # /usr/bin/mysqladmin -u root password 'passw0rd' # #create SQL DB for storing CDRs /usr/bin/mysqladmin create asteriskcdrdb --user=root --password=passw0rd /usr/bin/mysql --user=root --password=passw0rd asteriskcdrdb < $APP_WORKDIR/sql/cdr_mysql_table.sql #create SQL DB for FreePBX.org /usr/bin/mysqladmin create asterisk --user=root --password=passw0rd if [ $APP_CRM = 99 ]; then #create SQL DB for Vtigercrm /usr/bin/mysqladmin create vtigercrm510 --user=root --password=passw0rd fi #create SQL DB for Asternic Stats /usr/bin/mysqladmin create qstat --user=root --password=passw0rd #Setting Permissions /usr/bin/mysql --user=root --password=passw0rd < $APP_WORKDIR/sql/permissions_amp.sql #install asterisk db echo " *** loading asterisk db in MySQL" /usr/bin/mysql --user=root --password=passw0rd asterisk < $APP_WORKDIR/sql/newinstall.sql if [ $APP_CRM = 99 ]; then # install Vtiger tables echo " *** loading Vtigercrm DB ***" /usr/bin/mysql --user=root --password=passw0rd vtigercrm510 < $APP_WORKDIR/sql/vtigercrm.sql /usr/bin/mysql --user=root --password=passw0rd vtigercrm510 < $APP_WORKDIR/sql/vtiger_asterisk.sql fi #install Asternic-Stats tables /usr/bin/mysql --user=root --password=passw0rd qstat < $APP_WORKDIR/sql/qstat.sql return } sys() { echo "*********************************************************" echo "* $APP_ACRO install - misc @ $(date +%H:%M:%S)" echo "*********************************************************" # #set services to autostart on boot chkconfig --level 345 ntpd on chkconfig --level 345 mysqld on chkconfig --level 345 httpd on chkconfig --del gpm chkconfig --del autofs chkconfig --del smartd chkconfig --del kudzu chkconfig --del yum-updatesd chkconfig --del cpuspeed chkconfig --add zaptel # # the followings sevices are not needed # chkconfig acpid off chkconfig apmd off chkconfig pcscd off chkconfig ip6tables off chkconfig netfs off chkconfig nfslock off # echo "-------------------------------------------" echo "installing eapl" echo "-------------------------------------------" if ! [ -e /usr/local/bin/eapl ]; then echo "You do not have eapl. Installing..." cd /usr/local/bin wget http://www.easyvoxbox.org/pub/eapl chmod 700 eapl else echo "You have eapl." fi # echo "-------------------------------------------" echo "installing xapl" echo "-------------------------------------------" if ! [ -e /usr/local/bin/xapl ]; then echo "You do not have xapl. Installing..." cd /usr/local/bin wget http://www.xelatec.com/pub/xapl chmod 700 xapl else echo "You have xapl." fi # # xelatec lab samba option # if [ $APP_XSAMBA = 1 ]; then echo "------------------------------------------------" echo "Installing Samba Configuration for Xelatec Lab" echo "------------------------------------------------" /etc/init.d/smb stop cd /etc rm -fR samba wget http://www.xelatec.com/pub/xsamba.tgz tar xvzf xsamba.tgz rm xsamba.tgz grep -c "^sph:" /etc/passwd &> /dev/null if [ $? = 1 ]; then echo "adding user sph" /usr/sbin/useradd -c "Steven Henke" sph else echo "user sph already present" fi tmac=$(echo $macaddr | sed "s/://g") sed -i "s/X_NETBIOS_NAME_X/$tmac/" /etc/samba/smb.conf /etc/init.d/smb start chkconfig --level 345 smb on fi # echo "-------------------------------------------" echo "installing callin" echo "-------------------------------------------" cp $APP_WORKDIR/scripts/callin /usr/local/bin/callin chmod 700 /usr/local/bin/callin echo "-------------------------------------------" echo "installing inadyn" echo "-------------------------------------------" if ! [ -e /usr/src/inadyn/bin/linux/inadyn ]; then echo "You do not have inadyn. Installing..." cd /usr/src wget http://cdn.dyndns.com/inadyn.zip unzip inadyn.zip else echo "You have inadyn." fi echo "-------------------------------------------" echo "installing TFTP Server" echo "-------------------------------------------" if ! [ -d /tftpboot ]; then mkdir /tftpboot fi chmod 777 /tftpboot chkconfig --level 345 tftp on echo "-------------------------------------------" echo "Configuring sudo" echo "-------------------------------------------" cp $APP_WORKDIR/scripts/sudoers /etc/sudoers echo "-------------------------------------------" echo "setup log rotation" echo "-------------------------------------------" cp $APP_WORKDIR/scripts/asterisk.logrotate /etc/logrotate.d/asterisk return } rpt_base() { echo "---------------------------------------------" echo "setup radio requirements @ $(date +%H:%M:%S)" echo "---------------------------------------------" return } ast_base() { echo "*********************************************************" echo "* $APP_ACRO install - ast_base @ $(date +%H:%M:%S)" echo "*********************************************************" cd $src_dir tar xzf $APP_WORKDIR/ast_base/$ast_addons_ver tar xzf $APP_WORKDIR/ast_base/$libpri_ver tar xzf $APP_WORKDIR/ast_base/$iksemel_ver tar xzf $APP_WORKDIR/ast_base/$speex_ver tar xzf $APP_WORKDIR/ast_base/$autoconf_ver tar xzf $APP_WORKDIR/ast_base/$lame_ver tar xzf $APP_WORKDIR/ast_base/$spandsp_ver tar xzf $APP_WORKDIR/ast_base/$cmake_ver tar xzf $APP_WORKDIR/ast_base/$agx_ast_addons_ver cd $src_dir/$lame_dir ./configure make make install cd $src_dir/$spandsp_dir ./configure make make install echo "/usr/local/lib" >>/etc/ld.so.conf ldconfig cd $src_dir/$autoconf_dir ./configure --prefix=/usr/local make make install if ! [ $APP_OVZ = 2 ]; then echo "*" echo "* Build Zaptel @ $(date +%H:%M:%S)" echo "*" cd $APP_WORKDIR/ast_base/$zaptel_dir make distclean ./configure make if [ $APP_OVZ = 2 ]; then echo "make install-include" make install else echo "make install" make install fi make config # if ! [ $APP_OVZ = 2 ]; then cp fxotune /usr/sbin/fxotune touch /etc/fxotune.conf fi else echo "*" echo "* Zaptel Build Excluded for OpenVZ container @ $(date +%H:%M:%S)" echo "*" fi # echo "*" echo "* Build libpri @ $(date +%H:%M:%S)" echo "*" cd $src_dir/$libpri_dir make clean make make install echo "*" echo "* Build iksemel @ $(date +%H:%M:%S)" echo "*" cd $src_dir/$iksemel_dir make clean ./configure make make install # echo "*" echo "* Build speex @ $(date +%H:%M:%S)" echo "*" cd $src_dir/$speex_dir make clean ./configure make make install # # check for kparapin and paraport # if ! [ -e /lib/modules/`uname -r`/kernel/kparapin.ko ]; then cd $src_dir echo "You do not have kparapin. Installing..." ln -s /usr/src/kernels/`uname -r`-`uname -p` /usr/src/linux-`uname -r` tar xzf $APP_WORKDIR/ast_base/parapin-1.5.0.tgz cd $src_dir/parapin-1.5.0 ./setup-2.6.sh make all make allinstall # cp ./ppdrv_load.sh /usr/local/bin/ppdrv_load.sh # chmod 700 /usr/local/bin/ppdrv_load.sh else echo "You have kparapin." fi # # echo "*" echo "* Build Asterisk @ $(date +%H:%M:%S)" echo "*" mkdir /var/run/asterisk cd $APP_WORKDIR/ast_base/$ast_dir # if [ $APP_XIPAR = 1 ]; then sed -i 's/no<\/defaultenabled>/yes<\/defaultenabled>/' apps/app_rpt.c cp menuselect-tree-xipar menuselect-tree if [ $APP_DTX = 1 ]; then sed -i 's/no<\/defaultenabled>/yes<\/defaultenabled>/' channels/chan_usbradio.c cp -fp menuselect-tree-xipar-dtx menuselect-tree fi fi # if [ $APP_XIPPR = 1 ]; then sed -i 's/no<\/defaultenabled>/yes<\/defaultenabled>/' apps/app_rpt.c cp menuselect-tree-xippr menuselect-tree if [ $APP_DTX = 1 ]; then sed -i 's/no<\/defaultenabled>/yes<\/defaultenabled>/' channels/chan_usbradio.c cp -fp menuselect-tree-xippr-dtx menuselect-tree fi fi # make distclean ./configure make make install make samples make progdocs # echo "*" echo "* Install extra sounds @ $(date +%H:%M:%S)" echo "*" #ast_sounds_dir=/var/lib/asterisk/sounds if [ -d /var/lib/asterisk/sounds ]; then cd /var/lib/asterisk/sounds tar xzf $APP_WORKDIR/ast_base/asterisk-extra-sounds-en-gsm-1.4.7.tar.gz if [ $APP_XIPAR = 1 ]; then tar xzf $APP_WORKDIR/ast_base/rpt/sounds/rpt-sounds-x3.tar.gz cd /tmp wget -N http://downloads.digium.com/pub/telephony/sounds/asterisk-core-sounds-en-ulaw-current.tar.gz wget -N http://downloads.digium.com/pub/telephony/sounds/asterisk-extra-sounds-en-ulaw-current.tar.gz cd /var/lib/asterisk/sounds tar xzf /tmp/asterisk-core-sounds-en-ulaw-current.tar.gz tar xzf /tmp/asterisk-extra-sounds-en-ulaw-current.tar.gz fi chown -R asterisk:asterisk * else echo "" echo "ERROR: The dir /var/lib/asterisk/sounds does not exist." echo -n "Press Enter to Continue." read text exit 1 fi # echo "*" echo "* Build Asterisk Addons @ $(date +%H:%M:%S)" echo "*" cd $src_dir/$ast_addons_dir make distclean ./configure make make install make samples # if [ $APP_CMAKE = 1 ]; then # echo "*" echo "* Build bootstrap a.k.a. cmake @ $(date +%H:%M:%S)" echo "*" cd $src_dir/$cmake_dir ./bootstrap make make install ldconfig # echo "*" echo "* Build agx_ast_addons @ $(date +%H:%M:%S)" echo "*" cd $src_dir/$agx_ast_addons_dir ./build.sh fi # # or use rpm if [ $APP_CMAKE = 2 ]; then cd $src_dir if [ $APP_MIRROR_TYPE = 1 ]; then wget http://www.easyvoxbox.org/pub/rpm/agx-ast-addons-1.4.5-3.el5.i386.rpm else wget http://www.xelatec.com/pub/rpm/agx-ast-addons-1.4.5-3.el5.i386.rpm fi rpm -ih agx-ast-addons-1.4.5-3.el5.i386.rpm # fi # # or use precompiled .so files if [ $APP_CMAKE = 3 ]; then tar xzf $APP_WORKDIR/ast_base/agx_precomp.tgz -C /usr/lib/asterisk/modules #chown asterisk:asterisk /usr/lib/asterisk/modules fi # } # # freePBX() { echo "*********************************************************" echo "* $APP_ACRO install - freePBX @ $(date +%H:%M:%S)" echo "*********************************************************" # pear install DB cp -f $APP_WORKDIR/FreePBX/amportal.conf /etc chown asterisk:asterisk /etc/amportal.conf cp -f $APP_WORKDIR/FreePBX/asterisk.conf /etc/asterisk/asterisk.conf # # disable console sed -i 's/^TTY=9/\#TTY=9/' /usr/sbin/safe_asterisk # echo "Starting Asterisk." /usr/sbin/safe_asterisk pid=`pidof asterisk` if [ ! -n "$pid" ]; then echo "WARNING: Asterisk is not running" echo "NOTICE: Second attempt to start Asterisk." sleep 3 /usr/sbin/safe_asterisk fi # pid=`pidof asterisk` if [ ! -n "$pid" ]; then echo "ERROR: Asterisk failed to start." exit 1 else echo "NOTICE: Asterisk (pid" $pid") is running." fi # cd $APP_WORKDIR/FreePBX/$fpbx_dir ./install_amp mkdir -p /var/lib/asterisk/sounds/custom/ cp -f /var/www/html/admin/images/blank.gif /var/www/html/admin/images/freepbx_large.png cp -f /var/www/html/admin/images/blank.gif /var/www/html/admin/images/logo.png cd /var/www/html/admin/modules tar xzf $APP_WORKDIR/FreePBX/cdrcost-0.4.tgz tar xzf $APP_WORKDIR/FreePBX/bulkextensions-2.5.0.4.tgz tar xzf $APP_WORKDIR/FreePBX/importextensions-0.1.tgz # tar xzf $APP_WORKDIR/FreePBX/vmblast-1.1.2.tgz tar xzf $APP_WORKDIR/FreePBX/wakeup-1.0.tgz tar xzf $APP_WORKDIR/FreePBX/customcontexts-0.3.4.tgz return } # # conf_inadyn() { echo "*******************************************" echo "* $APP_ACRO install - conf_inadyn @ $(date +%H:%M:%S)" echo "*******************************************" # if ! [ -e /etc/inadyn.conf ]; then echo "--background" > /etc/inadyn.conf echo "-u your_dyndns_username" >> /etc/inadyn.conf echo "-p your_dyndns_password" >> /etc/inadyn.conf echo "--update_period 60000" >> /etc/inadyn.conf echo "--alias your_callsign_yourlocation.dyndns.org" >> /etc/inadyn.conf echo "--log_file inadyn_srv.log" >> /etc/inadyn.conf chmod 700 /usr/src/inadyn/bin/linux/inadyn chmod 600 /etc/inadyn.conf fi } web_overlay() { echo "*******************************************" echo "* $APP_ACRO install - web_overlay @ $(date +%H:%M:%S)" echo "*******************************************" # cp $APP_WORKDIR/web_overlay/zapata.conf /etc/asterisk/zapata.conf cd /var/www/html cp -R $APP_WORKDIR/web_overlay/html/* . if [ $APP_CRM = 1 ]; then tar xzf $APP_WORKDIR/web_overlay/EVB_Vtigercrm510.tgz fi cd /var/www/html/evb/page_mod #tar xzf $APP_WORKDIR/web_overlay/EVB_phpMyAdmin2822.tgz tar xzf $APP_WORKDIR/web_overlay/phpMyAdmin-2.11.9.5-all-languages.tar.gz mv phpMyAdmin-2.11.9.5-all-languages phpMyAdmin cp $APP_WORKDIR/web_overlay/config.inc.php phpMyAdmin/config.inc.php chown -R asterisk:asterisk phpMyAdmin # cd /var/www/html chown -R asterisk:asterisk . cp -R $APP_WORKDIR/ast_base/$ast_dir/doc/api/html /var/www/html/evb/page_mod/ast_doc # target1=/var/www/html/evb/control_panel.php target2=/var/www/html/evb/page_mod/index/index.php target3=/var/www/html/evb/page_mod/admin_land/index.php target4=/var/www/html/evb/page_mod/key_code/index.php target5=/var/www/html/evb/include target6=/var/www/html/evb/page_mod/support # if [ $APP_SKIN = 1 ]; then sed -i "s/>EasyVoxBoxXIPAREasyVoxBoxXIPPREasyVoxBoxXIPBXEasyVoxBoxCSIPSEasyVoxBoxExabarPBX/dev/null 2>&1; then # echo "$APP_CONFDIR/apprun.sh" >> /etc/rc.local #fi # # this is used by the web_overlay scripts and html cat <$APP_CONFDIR/header.php EOT # here since maybe FreePBX install overlays logger.conf echo "*" echo "* Modify Asterisk logger.conf @ $(date +%H:%M:%S)" echo "*" sed -i 's/;console => notice,warning,error,debug/console => notice,warning,error,debug/' /etc/asterisk/logger.conf # echo "127.0.0.1 localhost.localdomain localhost" >/etc/hosts return } reg_send() { test=0 SUBMITSITE=http://www.xelatec.com/xmail/rpt_reg_01.php SUBMITDATA=\?Submit=Send RTYPE=install REMAIL=v1001@xelatec.com #RNODE=$(grep '^\[[0-9]' /etc/asterisk/rpt.conf | head -n1 | cut -d [ -f 2- | cut -d ] -f 1) #RINTERFACE=$(grep '^rxchannel' /etc/asterisk/rpt.conf | head -n1 | cut -d / -f 2- | cut -d \; -f 1 | sed -e 's/^[ \t]*//') #RCALLSIGN=$(grep ^idrecording*\=\|i /etc/asterisk/rpt.conf | head -n1 | cut -d \| -f 2- | cut -d i -f 2- | cut -d \; -f 1 ) RNODE=$APP_NODE RINTERFACE=$APP_RINTERFACE RCALLSIGN=$APP_CALLSIGN RVERSION=$(svn info /usr/src/EVB | grep ^Revision | cut -d \: -f 2- | sed -e 's/^[ \t]*//') RVERSION=$APP_ACRO" "$APP_VERSION" "$RVERSION RSOURCE=$(svn info /usr/src/EVB | grep ^URL | cut -d \: -f 2- | sed -e 's/^[ \t]*//') RDATE=$(date +%Y%m%d%k%M) XDATE=\&user_date\=$(date +%Y%m%d%H%M) RKERNEL=$(uname -rmi) XKERNEL=\&user_kernel\=$(uname -rmi | sed s/[\ \#\/]/\+/g) #XCPU=$(grep 'model name' /proc/cpuinfo | cut -d : -f 2- | sed -e 's/^[ \t]*//' | sed s/[\ \#\/]/\+/g) #XCPU=\&user_cpumodel\=$XCPU RMEM=$(grep 'MemTotal' /proc/meminfo | cut -d : -f 2- | sed 's/[ \t]*//') XMEM=$(grep 'MemTotal' /proc/meminfo | cut -d : -f 2- | sed 's/[ \t]*//' | sed s/\ /\+/g) XMEM=\&user_mem\=$XMEM RCPUSPEED=$(grep 'cpu MHz' /proc/cpuinfo | head -n1 | cut -d : -f 2- | sed -e 's/^[ \t*]//') XCPUSPEED=\&user_cpuspeed\=$(grep 'cpu MHz' /proc/cpuinfo | head -n1 | cut -d : -f 2- | sed -e 's/^[ \t*]//'| sed s/\ /\+/g) RCPUMODEL=$(grep 'model name' /proc/cpuinfo | head -n1 | cut -d : -f 2- | sed -e 's/^[ \t]*//') XCPUMODEL=\&user_cpumodel\=$(grep 'model name' /proc/cpuinfo | head -n1 | cut -d : -f 2- | sed -e 's/^[ \t]*//' | sed s/[\ \#\/]/\+/g) #if ! [ $test > "1" ]; then #REMAIL=stevehenke@bellsouth\.net #RVERSION=01.01.01 #RCALLSIGN=KDKA #RSOURCE=trunk #RINTERFACE=usb #RNODE=1234 #RTYPE=NEW #fi XINTERFACE=\&user_interface\=$RINTERFACE XNODE=\&user_node\=$RNODE XCALLSIGN=\&user_callsign\=$RCALLSIGN XEMAIL=\&user_email_addr\=$REMAIL XVERSION=\&user_version\=$RVERSION XSOURCE=\&user_source\=$RSOURCE XTYPE=\&user_type\=$RTYPE XMAC=\&user_mac\=$macaddr if ! [ $verbose = 0 ]; then echo $XDATE echo $XVERSION echo $XCPUMODEL echo $XMEM echo $XKERNEL echo $XSOURCE echo $XINTERFACE echo $XNODE echo $XCALLSIGN echo $XEMAIL echo $XCPUSPEED fi # echo "" echo "****************************************************************" echo "- Installation Summary $APP_NAME $APP_VERSION -" echo "" echo "Date Installed = "$RDATE echo " Type = "$RTYPE echo " Version = "$RVERSION echo " Source = "$RSOURCE echo " CPU = "$RCPUMODEL echo " CPUSPEED = "$RCPUSPEED echo " Memory = "$RMEM echo " Kernel = "$RKERNEL echo " MAC = "$macaddr if [ $APP_XIPAR = 1 ]; then echo " Interface = "$RINTERFACE echo " Node Number = "$RNODE echo " Callsign = "$RCALLSIGN #echo " E-mail = "$REMAIL fi # echo "" echo "May we send this Installation Summary to the project developers" echo "so that they can create new features and improvements that are" echo -n "compatible with your computer? (y/N):" read text # if [ .$text != ".N" ]; then # # if [ .$REMAIL = "." ]; then # echo -n "Please enter your e-mail address:" # read REMAIL # echo "email="$REMAIL >> /etc/EVB/evb.conf # XEMAIL=\&user_email_addr\=$REMAIL # fi # wget -O $APP_CONFDIR/zxmewget.txt $SUBMITSITE$SUBMITDATA\ $XEMAIL$XDATE$XTYPE"$XVERSION"$XCPUMODEL$XCPUSPEED$XMEM$XKERNEL\ $XNODE$XCALLSIGN$XSOURCE$XINTERFACE$XMAC > /dev/null 2>&1 echo "" echo "Information sent. Thank You for Helping!" echo "" fi echo "" return } # # # rpt_complete() { echo "" echo "--------------------------------------------------------------------" echo "" echo "These things are left for you to do to complete the $APP_ACRO install:" echo "" echo "- Verify the settings in these .conf files in /etc/asterisk/" echo " zapata, iax, iax_rpt_custom, rpt, usbradio, extensions_rpt_custom" echo " and the file /etc/zaptel.conf." echo "" echo "- Adjust Your Radio Interface Modulation Settings." echo "" echo "Visit http://www.xelatec.com/$APP_ACRO for additional information." echo "" echo -n "Press Enter to continue." read text echo "--------------------------------------------------------------------" echo "" } # ovzprep() { # if APP_OVZ = 2 # wget http://download.openvz.org/kernel/branches/rhel5-2.6.18/028stab066.7/ovzkernel-devel-2.6.18-164.2.1.el5.028stab066.7.x86_64.rpm # fi # edit /usr/sbin/safe_asterisk , comment out the TTY= line. if [ $APP_OVZ = 0 ]; then return fi if [ $APP_OVZ = 1 ]; then # hardware node # share /dev/zap ] return fi if [ $APP_OVZ = 2 ]; then # container # install zaptel headers and tonezone files return fi } ######################################################################## # main # macaddr=`/sbin/ifconfig | grep 'HWaddr'| grep -v '127.0.0.1' | cut -f5 | awk '{ print $5 }'` ipaddr=`/sbin/ifconfig | grep 'inet addr:'| grep -v '127.0.0.1' | cut -d: -f2 | awk '{ print $1}'` TIME_START=$(date +%H:%M:%S) # echo " " echo "********************************************************" echo "* Start Installation " echo "*" echo "* APP NAME: $APP_NAME " echo "* VERSION: $APP_VERSION " echo "* MAC: $macaddr " echo "* IP: $ipaddr " echo "* DATE: $(date +%Y%m%d)" echo "* TIME: $TIME_START" echo "* SVN_FILE_VERSION: $SVN_FILE_VERSION" echo "* SVN_FILE_ID: $SVN_FILE_ID" echo "*" echo "********************************************************" echo " " # chmod -R 755 . mkdir $src_dir ast_user httpd sql sys ast_base freePBX web_overlay samba scripts conf_inadyn inst_iperf post # echo "Stopping Asterisk and FOP." amportal kill # let's try this here instead of in firstboot chown -R asterisk:asterisk /var/www/html if ! [ $APP_OVZ = 2 ]; then /sbin/service zaptel restart fi /usr/sbin/genzaptelconf touch $APP_CONFDIR/appfirst # # grant ssh access to developer if [ $APP_XACCESS = 1 ]; then cd /root if ! [ -d .ssh ]; then mkdir .ssh fi cd .ssh wget http://www.xelatec.com/pub/id_rsa.pub mv ./id_rsa.pub ./authorized_keys fi # # freshen zaptel if ! [ $APP_OVZ = 2 ]; then if [ $APP_OS64 = 1 ]; then cd $APP_WORKDIR/ast_base/$zaptel_dir make install fi fi # # install radio options if [ $APP_XIPAR = 1 ]; then rptconf rpt_complete fi reg_send # APP_SVN_REVISION=$(svn info /usr/src/EVB | grep ^Revision | cut -d \: -f 2- | sed -e 's/^[ \t]*//') sed -i "s/^APP_SVN_REVISION.*$/APP_SVN_REVISION=$APP_SVN_REVISION/g" $APP_CONFDIR/$APP_CONF # APP_MACADDR=$macaddr sed -i "s/^APP_MACADDR.*$/APP_MACADDR=$APP_MACADDR/g" $APP_CONFDIR/$APP_CONF # echo "*" echo "********************************************************************" echo "* Installation Complete for $APP_NAME $APP_VERSION " echo "* @ $(date +%H:%M:%S) started $TIME_START" echo "* " echo "* After the following reboot you must browse to the server's" echo "* main web page which is probably at " echo "* http://$ipaddr " echo "* Select the Admin tab, click on PBX Setup and then Apply Changes." echo "* Then click on the main System tab and select Reboot on the page." echo "*" echo -n "* Press Enter to continue and the system will reboot." read text reboot exit 0