Skip to content

Instantly share code, notes, and snippets.

@stomita
Created March 5, 2012 09:31
Show Gist options
  • Save stomita/1977632 to your computer and use it in GitHub Desktop.
Save stomita/1977632 to your computer and use it in GitHub Desktop.
#!/bin/sh
#
# This installation script is for creating environment of heroku buildpack of PhantomJS
# Assuming the script to be run on fakesu command by using fakesu buildpack.
# See. https://github.com/fabiokung/heroku-buildpack-fakesu
#
export PATH=/sbin:/usr/sbin:$PATH
cd /app/
#
# These pacakges are necessary for installation script
#
apt-get install gawk -y
apt-get install make -y
apt-get install wget -y
apt-get install g++ -y
apt-get install gnupg -y
#
# Adding registries to add Japanese font package
#
wget -q https://www.ubuntulinux.jp/ubuntu-ja-archive-keyring.gpg -O- | apt-key add -
wget -q https://www.ubuntulinux.jp/ubuntu-jp-ppa-keyring.gpg -O- | apt-key add -
wget https://www.ubuntulinux.jp/sources.list.d/lucid.list -O /etc/apt/sources.list.d/ubuntu-ja.list
apt-get update -y
apt-get upgrade -y
# IPA OpenType font (Japanese)
apt-get install otf-ipafont -y
#
# Installing Xvfb and others
#
apt-get install xvfb -y
apt-get install x11-xkb-utils -y
# apt-get install xfonts-100dpi -y
# apt-get install xfonts-75dpi -y
# apt-get install xfonts-scalable -y
# apt-get install xfonts-cyrillic -y
apt-get install libqt4-dev -y
apt-get install libqt4-webkit -y
#
# Building PhantomJS binary
#
wget http://phantomjs.googlecode.com/files/phantomjs-1.4.1-source.tar.gz
tar zxvf phantomjs-1.4.1-source.tar.gz
mv phantomjs-1.4.1 phantomjs
cd phantomjs
qmake-qt4 && make
cd ..
cp ./phantomjs/bin/phantomjs ./bin
rm -rf phantomjs-1.4.1-source.tar.gz phantomjs
#
# Uninstall unnecessary packages
#
apt-get purge gnupg -y
apt-get purge g++ -y
apt-get purge wget -y
apt-get purge make -y
apt-get purge gawk -y
apt-get purge libqt4-dev -y
#
# Those packages is using a lot of disk spaces and phantomJS seems not directly using.
#
apt-get purge libgl1-mesa-dri -y
apt-get purge python2.6 -y
apt-get purge locales -y
#
# Remove & Clean packages
#
apt-get autoremove -y
apt-get autoclean
apt-get clean
#
# Removing apt/dpkg packaging system. Very destructive operation, but helps reducing disk size
#
rm -rf /var/cache/apt/*
rm -rf /var/lib/apt/*
rm -rf /var/lib/dpkg/*
rm -rf /var/log/*
rm -rf /usr/share/doc/*
rm -rf /usr/share/man/*
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment