-
Notifications
You must be signed in to change notification settings - Fork 5
/
install_phantomjs.sh
executable file
·47 lines (33 loc) · 1.07 KB
/
install_phantomjs.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#!/bin/bash
# tested on ubuntu 14.04.3 (gnome)
# tested on ubuntu 16.04 (gnome)
SCRIPT_NAME=$(basename $BASH_SOURCE)
SCRIPT_LOGFILE="./logs/"$(basename -s .sh $BASH_SOURCE)".log"
mkdir -p ./logs && chmod 755 ./logs
echo "running "$SCRIPT_NAME
#PJS="phantomjs-2.1.1-linux-x86_64"
PJS="phantomjs-1.9.8-linux-x86_64"
if [ "$1" == "rm" ]; then
echo " removing phantomjs"
sudo rm -f /usr/local/bin/phantomjs
sudo rm -rf /usr/local/share/$PJS
else
if hash phantomjs 2>/dev/null; then
echo " phantomjs already installed"
else
echo " phantomjs not installed"
sudo apt-get update
sudo apt-get install build-essential chrpath libssl-dev libxft-dev -y
sudo apt-get install libfreetype6 libfreetype6-dev -y
sudo apt-get install libfontconfig1 libfontconfig1-dev -y
rm -rf ~/.phantomjs
mkdir -p ~/.phantomjs
cd ~/.phantomjs
wget https://bitbucket.org/ariya/phantomjs/downloads/$PJS.tar.bz2
tar xvjf $PJS.tar.bz2
sudo mv $PJS /usr/local/share
sudo ln -sf /usr/local/share/$PJS/bin/phantomjs /usr/local/bin
rm -rf ~/.phantomjs
phantomjs --version
fi
fi