#!/bin/bash

CWD=`pwd`
NBRPM=$1

mkdir /tmp/netborder/

cp -a $NBRPM /tmp/netborder/

cd /tmp/netborder/

rpm2cpio $NBRPM | cpio -idmv

cp -a opt/Sangoma_NetBorderCallAnalyzer /opt

cd /etc/init.d/

wget http://download.vicidial.com/netborder/netborder-engine
wget http://download.vicidial.com/netborder/netborder-service

chmod +x netborder-engine
chmod +x netborder-service

ln -s /opt/Sangoma_NetBorderCallAnalyzer/config/ /etc/netborder
ln -s /opt/Sangoma_NetBorderCallAnalyzer/logs /var/log/netborder

chkconfig netborder-service on
chkconfig netborder-engine on

cd $CWD
rm -Rf /tmp/netborder/
