#!/bin/bash
apt-get update -y && apt-get install -y build-essential \ 
	g++ \
	flex \
	bison \
	gperf \
	ruby \
	perl \
  	libsqlite3-dev \
  	libfontconfig1-dev \
  	libicu-dev \
  	libfreetype6 \
  	libssl-dev \
  	libpng-dev \
  	libjpeg-dev

cd /opt/
mkdir phantomJS
cd phantomJS
git clone git://github.com/ariya/phantomjs.git
cd phantomjs
git checkout 2.0
./build.sh --confirm --jobs 8
ln -s /opt/phantomJS/phantomjs/bin/phantomjs /usr/bin/phantomjs
#!/bin/bash
apt-get update -y && apt-get install -y build-essential \
  bison \
  flex \
  g++ \
  gperf \
  libfontconfig1-dev \
  libfreetype6 \
  libicu-dev \
  libjpeg-dev \
  libpng-dev \
  libsqlite3-dev \
  libssl-dev \
  perl \
  ruby \
  || exit 1

cd /opt/ || exit 1
mkdir phantomJS || exit 1
cd phantomJS || exit 1
git clone git://github.com/ariya/phantomjs.git || exit 1
cd phantomjs || exit 1
git checkout 2.0 || exit 1
./build.sh --confirm --jobs 8 || exit 1
ln -s /opt/phantomJS/phantomjs/bin/phantomjs /usr/bin/phantomjs || exit 1

Fix spurious space after quoted-newline
Fix spurious space after quoted-newline

Also improve script robustness to fail early if needed
