#!/bin/bash -e

. ../../xi-sys.cfg

echo "INSTALL: phantomjs is being installed..."

# Delete the old archive
rm -rf phantomjs*

# Extract archive
package="phantomjs-2.1.1-linux-x86_64"

# Download the file
wget https://assets.nagios.com/downloads/nagiosxi/packages/$package.tar.bz2
tar xf $package.tar.bz2

# Move executables to proper location
cp -f $package/bin/phantomjs /usr/local/bin/phantomjs

#Clean up
rm -rf phantomjs*

# It is okay!
echo "INSTALL: PhantomJS installed OK."