Last active
December 12, 2015 06:08
-
-
Save joshuakfarrar/4726515 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Written for CentOS 6.3 | |
# After installation, run `sudo /usr/local/bin/xvfb-run /usr/bin/wkhtmltopdf --use-xserver http://www.google.com ~/google.pdf` to use | |
if [[ $EUID -ne 0 ]] ; then | |
echo "This script must be run as root" | |
exit 1 | |
fi | |
echo -n "installing some required libraries.." | |
yum --assumeyes install Xvfb xauth libXrender libXext fontconfig 1>/dev/null | |
if [ "$?" -ne 0 ] ; then | |
echo "Error installing required libraries through yum" | |
exit 1 | |
fi | |
wait | |
if [ ! -f /usr/bin/wkhtmltopdf ] ; then | |
echo "installing wkhtmltopdf - this may take a minute" | |
FILENAME="wkhtmltopdf-0.11.0_rc1-static-amd64.tar.bz2" | |
wget http://wkhtmltopdf.googlecode.com/files/$FILENAME | |
sha1=`sha1sum $FILENAME | awk '{print $1}'` | |
if [ "$sha1" = "1f5a9ed45c029055b2770d56ec31c890a3e2d33f" ] ; then | |
tar xvjf $FILENAME 1>/dev/null | |
mv wkhtmltopdf-amd64 /usr/bin/wkhtmltopdf && rm -f $FILENAME | |
else | |
echo "Error downloading $FILENAME" | |
exit 1 | |
fi | |
else | |
echo "wkhtmltopdf appears to already installed" | |
fi | |
if [ ! -f /usr/local/bin/xvfb-run ] ; then | |
wget --no-check-certificate -O /usr/local/bin/xvfb-run https://raw.github.com/globalimpact/xvfb-run/master/xvfb-run | |
fi | |
wait | |
echo "wkhtmltopdf successfully installed!" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment